Пример #1
0
        private void handleAuthorization(
            JsonAuthResponse response)
        {
            if (response.Status == AuthStatus.Authorized)
            {
                var listenRequest = new JsonListenRequest
                {
                    Action = JsonAction.Listen,
                    Data   = new JsonListenRequest.JsonData()
                    {
                        Streams = new List <String>
                        {
                            "trade_updates",
                            "account_updates"
                        }
                    }
                };

                sendAsJsonString(listenRequest);
            }
            else
            {
                Connected?.Invoke(response.Status);
            }
        }
Пример #2
0
        private void subscribe(
            String channel,
            String symbol)
        {
            var listenRequest = new JsonListenRequest
            {
                Action = JsonAction.PolygonSubscribe,
                Params = $"{channel}.{symbol}"
            };

            SendAsJsonString(listenRequest);
        }
        private void handleAuthorization(
            JToken token)
        {
            var response = token.ToObject<JsonAuthResponse>();
            OnConnected(response.Status);

            if (response.Status == AuthStatus.Authorized)
            {
                var listenRequest = new JsonListenRequest
                {
                    Action = JsonAction.Listen,
                    Data = new JsonListenRequest.JsonData()
                    {
                        Streams = new List<String>
                        {
                            TradeUpdates,
                            AccountUpdates
                        }
                    }
                };

                SendAsJsonString(listenRequest);
            }
        }