Activation Key For .Net Core (appSettings.json)

92 views
Skip to first unread message

Can Dolgun

unread,
May 2, 2019, 9:27:36 AM5/2/19
to NJ4X Forum
Hi,

I have two questions. Can you help me please?

1. How I can use activation key for .net core application?
2. IsLimitedFunctionality returns true. Is it means (for example) SymbolInfo return values slower than unlimited functionality?

Apologize for bad English.
Thank you.

Roman Gerasimenko

unread,
May 2, 2019, 9:36:05 AM5/2/19
to NJ4X Forum
Hi Can,

This is appsettings.json format which works for me, do you have similar format? - 

{
  "nj4x_activation_key": "209083599"
}

Please share your project (sample .net core app) so I can check possible configuration issues or dependencies misses.

чт, 2 трав. 2019 о 16:27 Can Dolgun <hc.d...@gmail.com> пише:
Hi,

I have two questions. Can you help me please?

1. How I can use activation key for .net core application?
2. IsLimitedFunctionality returns true. Is it means (for example) SymbolInfo return values slower than unlimited functionality?

Correct.
 

Apologize for bad English.
Thank you.

--
You received this message because you are subscribed to the Google Groups "NJ4X Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nj4x+uns...@googlegroups.com.
To post to this group, send email to nj...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Can Dolgun

unread,
May 2, 2019, 9:50:42 AM5/2/19
to NJ4X Forum
Hi Roman,

First of all thank you for support.

I want to send Symbols inside TickHandler via WebSocket

        public void SendQuotesList()
        {
            Holder.TickHandler1 += (ticks, connection) =>
             {
                 if (Socket.State != WebSocketState.Open)
                     return;

                 List<SymbolDTO> list = new List<SymbolDTO>();

                 foreach (var tick in ticks)
                 {
                     var info = Holder.Nj4xClient.SymbolInfo(tick.Symbol);
                     var dto = new SymbolDTO(tick.Symbol, info);
                     list.Add(dto);
                 }
                 

                 var message = JsonConvert.SerializeObject(list);


                 Socket.SendAsync(buffer: new ArraySegment<byte>(
                     array: Encoding.ASCII.GetBytes(message),
                     offset: 0,
                     count: message.Length),
                     messageType: WebSocketMessageType.Text,
                     endOfMessage: true,
                     cancellationToken: CancellationToken.None);
                 
             };
        }

Holder is a instance to ConnectionHolder class:

    public class ConnectionHolder
    {
        public string ConnectionId { get; set; }
        public ClientDetails ClientDetails { get; set; }

        // Strategy properties
        public Strategy Nj4xClient { get; set; }
        public event Strategy.BulkTickHandler TickHandler1;
        // Strategy properties

        public ConnectionHolder()
        {

        }       

        public ConnectionHolder(string broker, string account, string password)
        {
            ClientDetails = new ClientDetails(broker, account, password);
            ConnectionId = Guid.NewGuid().ToString();
            ConnectToNj4xServer();
        }

        public void ConnectToNj4xServer()
        {
            Nj4xClient = new Strategy();

            Nj4xClient.SetBulkTickListener((ticks, con) =>
            {
                TickHandler1(ticks, con);
            });

            TickHandler1 = (ticks, connection) =>
            {
                //foreach (var tick in ticks)
                //{
                //    Console.WriteLine($"tick: {tick}");
                //}
            };

            try
            {
                Nj4xClient.Connect(
                "127.0.0.1",
                7788,
                new nj4x.Metatrader.Broker(ClientDetails.Broker),
                ClientDetails.Account,
                ClientDetails.Password,
                true);

            }
            catch (nj4x.Metatrader.MT4Exception ex)
            {
                throw new Exception("Connection failed");
            }

        }

        public bool IsConnected()
        {
            return Nj4xClient.IsConnectedToTerminal();
        }

    }

2 Mayıs 2019 Perşembe 16:36:05 UTC+3 tarihinde NJ4X yazdı:
Hi Can,

This is appsettings.json format which works for me, do you have similar format? - 

{
  "nj4x_activation_key": "209083599"
}

Please share your project (sample .net core app) so I can check possible configuration issues or dependencies misses.

чт, 2 трав. 2019 о 16:27 Can Dolgun <hc.d...@gmail.com> пише:
Hi,

I have two questions. Can you help me please?

1. How I can use activation key for .net core application?
2. IsLimitedFunctionality returns true. Is it means (for example) SymbolInfo return values slower than unlimited functionality?

Correct.
 

Apologize for bad English.
Thank you.

--
You received this message because you are subscribed to the Google Groups "NJ4X Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nj...@googlegroups.com.

Can Dolgun

unread,
May 2, 2019, 10:15:11 AM5/2/19
to NJ4X Forum
Roman,

Extra info: Personal terminal also works when I do not enter the activation key. I thought the function was caused by the lack of activation key to be slow.

2 Mayıs 2019 Perşembe 16:27:36 UTC+3 tarihinde Can Dolgun yazdı:

Roman Gerasimenko

unread,
May 2, 2019, 10:29:43 AM5/2/19
to NJ4X Forum
In case IsLimitedFunctionality() method returns true - you need to apply activation key, because all nj4x api methods will be slow.

This is appsettings.json format which works for me, do you apply similar format? - 

{
  "nj4x_activation_key": "209083599"
}

In order to generate correct activation key for your machine you must obtain nj4x api Personal license first.



чт, 2 трав. 2019 о 17:15 Can Dolgun <hc.d...@gmail.com> пише:
--
You received this message because you are subscribed to the Google Groups "NJ4X Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nj4x+uns...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages