Exemplo n.º 1
0
        /// <summary>
        /// Create a Market Data web socket to receive real-time market data.
        /// </summary>
        /// <param name="instruments">Instruments to watch.</param>
        /// <param name="entries">Market data entries to watch.</param>
        /// <param name="level"></param>
        /// <param name="depth">Depth of the book.</param>
        /// <param name="cancellationToken">Custom cancellation token to end the socket task.</param>
        /// <returns>The market data web socket.</returns>
        public MarketDataWebSocket CreateMarketDataSocket(IEnumerable <Instrument> instruments,
                                                          IEnumerable <Entry> entries,
                                                          uint level, uint depth,
                                                          CancellationToken cancellationToken
                                                          )
        {
            var marketDataToRequest = new MarketDataInfo()
            {
                Depth    = depth,
                Entries  = entries.ToArray(),
                Level    = level,
                Products = instruments.ToArray()
            };

            return(new MarketDataWebSocket(this, marketDataToRequest, cancellationToken));
        }
Exemplo n.º 2
0
            public void ApplyTo(ref MarketDataInfo other)
            {
                if (BidOrZero != 0)
                {
                    other.BidOrZero = BidOrZero;
                }

                if (AskOrZero != 0)
                {
                    other.AskOrZero = AskOrZero;
                }

                if (LastOrZero != 0)
                {
                    other.LastOrZero = LastOrZero;
                }

                other.UpdateCount += UpdateCount;
            }
Exemplo n.º 3
0
        /// <summary>
        /// Create a Market Data web socket to receive real-time market data.
        /// </summary>
        /// <param name="instruments">Instruments to watch.</param>
        /// <param name="entries">Market data entries to watch.</param>
        /// <param name="level"></param>
        /// <param name="depth">Depth of the book.</param>
        /// <param name="cancellationToken">Custom cancellation token to end the socket task.</param>
        /// <returns>The market data web socket.</returns>
        public MarketDataWebSocket CreateMarketDataSocket(IEnumerable <Instrument> instruments,
                                                          IEnumerable <Entry> entries,
                                                          uint level, uint depth,
                                                          CancellationToken cancellationToken
                                                          )
        {
            var wsScheme = (_baseUri.Scheme == "https" ? "wss" : "ws");
            var url      = new UriBuilder(_baseUri)
            {
                Scheme = wsScheme
            };

            var marketDataToRequest = new MarketDataInfo()
            {
                Depth    = depth,
                Entries  = entries.ToArray(),
                Level    = level,
                Products = instruments.ToArray()
            };

            return(new MarketDataWebSocket(marketDataToRequest, url.Uri, AccessToken, cancellationToken));
        }
Exemplo n.º 4
0
 public void SetMarketData(MarketDataInfo marketData)
 {
     EventType = XEventType.MarketData;
     EventData = marketData;
 }