コード例 #1
0
 public void StartTicks(string instrumentToken)
 {
     _ticker.Connect();
     uint[] tokens = new uint[] { 260105 };
     _ticker.Subscribe(tokens);
     _ticker.SetMode(tokens, "full");
 }
コード例 #2
0
        private void InitTicker()
        {
            ticker.OnTick        += OnTick;
            ticker.OnReconnect   += OnReconnect;
            ticker.OnNoReconnect += OnNoReconnect;
            ticker.OnError       += OnError;
            ticker.OnClose       += OnClose;
            ticker.OnConnect     += OnConnect;
            ticker.OnOrderUpdate += OnOrderUpdate;

            ticker.EnableReconnect(Interval: 5, Retries: 50);
            ticker.Connect();

            SubscribeToInstruments();
        }
コード例 #3
0
        private static void initTicker()
        {
            ticker = new Ticker(MyAPIKey, MyUserId, MyPublicToken);

            ticker.OnTick        += onTick;
            ticker.OnReconnect   += onReconnect;
            ticker.OnNoReconnect += oNoReconnect;
            ticker.OnError       += onError;
            ticker.OnClose       += onClose;
            ticker.OnConnect     += onConnect;

            ticker.EnableReconnect(Interval: 5, Retries: 50);
            ticker.Connect();

            // Subscribing to NIFTY50 and setting mode to LTP
            ticker.Subscribe(Tokens: new string[] { "256265" });
            ticker.SetMode(Tokens: new string[] { "256265" }, Mode: "ltp");
        }
コード例 #4
0
        private static void initTicker()
        {
            ticker = new Ticker(MyAPIKey, MyAccessToken);

            ticker.OnTick        += OnTick;
            ticker.OnReconnect   += OnReconnect;
            ticker.OnNoReconnect += OnNoReconnect;
            ticker.OnError       += OnError;
            ticker.OnClose       += OnClose;
            ticker.OnConnect     += OnConnect;
            ticker.OnOrderUpdate += OnOrderUpdate;

            ticker.EnableReconnect(Interval: 5, Retries: 50);
            ticker.Connect();

            // Subscribing to Banknifty and setting mode to full
            ticker.Subscribe(Tokens: new UInt32[] { 260105 });
            ticker.SetMode(Tokens: new UInt32[] { 260105 }, Mode: Constants.MODE_FULL);
        }
コード例 #5
0
        public Ticker InitializeTicker(string accessToken)
        {
            var ticker = new Ticker(_apiKey, accessToken);

            Message = _logger.WriteMessage(ConnectConstants.TICKER_INITIALIZED);

            ticker.OnTick        += OnTick;
            ticker.OnConnect     += OnConnect;
            ticker.OnReconnect   += OnReconnect;
            ticker.OnNoReconnect += OnNoReconnect;
            ticker.OnError       += OnError;
            ticker.OnClose       += OnClose;
            ticker.OnOrderUpdate += OnOrderUpdate;

            ticker.EnableReconnect(Interval: 5, Retries: 50);
            ticker.Connect();

            // Subscribing to NIFTY50 and setting mode to LTP
            ticker.Subscribe(Tokens: new UInt32[] { 256265 });
            ticker.SetMode(Tokens: new UInt32[] { 256265 }, Mode: Constants.MODE_LTP);

            return(ticker);
        }
コード例 #6
0
        public void WebSocket()
        {
            try
            {
                ticker = new Ticker(tradeUser.ApiKey, tradeUser.AccessToken);
                // Add handlers to events
                ticker.OnTick += onTicker;

                // Engage reconnection mechanism and connect to ticker
                ticker.EnableReconnect(Interval: 5, Retries: 50);
                ticker.Connect();

                // Subscribing to NIFTY50 and setting mode to LTP
                ticker.Subscribe(Tokens: new UInt32[] { 2113328 });
                ticker.SetMode(Tokens: new UInt32[] { 2113328 }, Mode: Constants.MODE_LTP);

                //var ws = new WebSocket('');  //("wss://ws.kite.trade?api_key=xxx&access_token=xxxx");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }