Exemple #1
0
        public MarketDataRequest unsubscribeIncrementalRequest(string symbol)
        {
            MarketDataRequest tickerRequest = new MarketDataRequest();

            MarketDataRequest.NoRelatedSymGroup symbolGroup = new MarketDataRequest.NoRelatedSymGroup();
            symbolGroup.SetField(new Symbol(symbol));
            tickerRequest.AddGroup(symbolGroup);

            tickerRequest.Set(new MDReqID("123"));
            tickerRequest.Set(new SubscriptionRequestType('2'));
            tickerRequest.Set(new MarketDepth(0));

            addMDType(tickerRequest, '0');
            addMDType(tickerRequest, '1');
            addMDType(tickerRequest, '2');
            addMDType(tickerRequest, '3');
            addMDType(tickerRequest, '4');
            addMDType(tickerRequest, '5');
            addMDType(tickerRequest, '6');
            addMDType(tickerRequest, '7');
            addMDType(tickerRequest, '8');
            addMDType(tickerRequest, '9');
            addMDType(tickerRequest, 'A');
            addMDType(tickerRequest, 'B');
            addMDType(tickerRequest, 'C');

            return(tickerRequest);
        }
Exemple #2
0
        /// <summary>
        /// Creates and returns a new <see cref="MarketDataRequest"/> FIX message.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="marketDepth">The market depth.</param>
        /// <param name="timeNow">The time now.</param>
        /// <returns>The FIX message.</returns>
        public static MarketDataRequest Create(string symbol, int marketDepth, ZonedDateTime timeNow)
        {
            Debug.NotEmptyOrWhiteSpace(symbol, nameof(symbol));
            Debug.NotNegativeInt32(marketDepth, nameof(marketDepth));
            Debug.NotDefault(timeNow, nameof(timeNow));

            var marketDataEntryGroup1 = new MarketDataRequest.NoMDEntryTypesGroup();

            marketDataEntryGroup1.Set(new MDEntryType(MDEntryType.BID));

            var marketDataEntryGroup2 = new MarketDataRequest.NoMDEntryTypesGroup();

            marketDataEntryGroup2.Set(new MDEntryType(MDEntryType.OFFER));

            var symbolGroup = new MarketDataRequest.NoRelatedSymGroup();

            symbolGroup.SetField(new Symbol(symbol));

            var message = new MarketDataRequest(
                new MDReqID($"MD_{timeNow.TickOfDay.ToString()}"),
                new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES),
                new MarketDepth(marketDepth));

            message.Set(new MDUpdateType(0));  // val:1 to receive shortened message
            message.AddGroup(marketDataEntryGroup1);
            message.AddGroup(marketDataEntryGroup2);
            message.Set(new NoRelatedSym(1));
            message.AddGroup(symbolGroup);

            return(message);
        }
        public MarketDataRequest unsubscribeIncrementalRequest(string symbol)
        {
            MarketDataRequest tickerRequest = new MarketDataRequest();

            MarketDataRequest.NoRelatedSymGroup symbolGroup = new MarketDataRequest.NoRelatedSymGroup();
            symbolGroup.SetField(new Symbol(symbol));
            tickerRequest.AddGroup(symbolGroup);

            tickerRequest.Set(new MDReqID("123"));
            tickerRequest.Set(new SubscriptionRequestType('2'));
            tickerRequest.Set(new MarketDepth(0));

            addMDType(tickerRequest, '0');
            addMDType(tickerRequest, '1');
            addMDType(tickerRequest, '2');
            addMDType(tickerRequest, '3');
            addMDType(tickerRequest, '4');
            addMDType(tickerRequest, '5');
            addMDType(tickerRequest, '6');
            addMDType(tickerRequest, '7');
            addMDType(tickerRequest, '8');
            addMDType(tickerRequest, '9');
            addMDType(tickerRequest, 'A');
            addMDType(tickerRequest, 'B');
            addMDType(tickerRequest, 'C');

            return tickerRequest;
        }