예제 #1
0
        Instrument FindInstrument(string product, string alias)
        {
            InstrumentLookup instLookup = new InstrumentLookup(tt_net_sdk.Dispatcher.Current, m_marketId, ProductType.Future, product, alias);
            ProductDataEvent einst      = instLookup.Get();

            if (einst != ProductDataEvent.Found)
            {
                Console.WriteLine("ERROR: can't fetch leg instrument");
                return(null);
            }
            return(instLookup.Instrument);
        }
예제 #2
0
        IEnumerable <Instrument> GetContracts(MarketId market, ProductType productType, string productCode)
        {
            InstrumentCatalog instruments = new InstrumentCatalog(market, productType, productCode, _dispatcher);
            ProductDataEvent  e           = instruments.Get();

            var subscriptionDetails = $"{market.ToString()} : {productType.ToString()} : {productCode}";

            if (e == ProductDataEvent.Found)
            {
                _log.Info($"Fetched instrument count for '{productCode}': {subscriptionDetails} : {instruments.InstrumentList.Count()}");
                return(instruments.InstrumentList);
            }
            else
            {
                _log.Error($"Failed to fetch intruments for: {subscriptionDetails}");
                return(Enumerable.Empty <Instrument>());
            }
        }