public void FilterByInstrument(InstrumentKey instrumentKey) { TradeSubscriptionInstrumentFilter filter = new TradeSubscriptionInstrumentFilter(m_TTService.session, instrumentKey, false, instrumentKey.ToString()); this.m_TradeFilter = filter; m_TradeFilterArg = instrumentKey.ToString(); if (Log != null) { Log.NewEntry(LogLevel.Minor, "FillListener.FilterByInstrument: Filtering by instrumentKey {0}", instrumentKey); } }
public void SubscribeToInstrument(InstrumentKey key) { if (_dispatcher.InvokeRequired()) { _dispatcher.BeginInvoke(() => { SubscribeToInstrument(key); }); return; } InstrumentLookupSubscription req = new InstrumentLookupSubscription(_apiSession, Dispatcher.Current, key); req.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(instrumentLookupRequest_Update); req.Start(); Console.WriteLine("SUBSCRIBETOINSTRUMENT REQUEST: " + key.ToString()); }
// // // // // #endregion//Public Methods #region IStringifiable public string GetAttributes() { return(string.Format("Name={0} Key={1}", InstrumentName.Serialize(this.Name), Key.ToString())); }
} //ProcessHubRequestInstruments() // // // // ************************************************************************* // **** Process Hub Request Instruments() **** // ************************************************************************* private void ProcessHubRequestInstrumentPrice(Misty.Lib.MarketHubs.MarketHubRequest request) { if (request.Data == null || request.Data.Count < 1) { return; } foreach (object dataObj in request.Data) { Type dataType = dataObj.GetType(); if (dataType == typeof(InstrumentName)) { InstrumentName instr = (InstrumentName)dataObj; InstrumentDetails details; lock (m_InstrumentLock) { if (m_InstrumentDetails.TryGetValue(instr, out details)) { // found desired instrument. if (m_InstrumentMarkets.ContainsKey(instr)) { // We have already subscribed to this instrument. Log.NewEntry(LogLevel.Minor, "ProcessHubRequestInstrumentPrice: We already have a subscription to {0}. Ignore request {1}.", instr.SeriesName, request.ToString()); } else { // We do not have a subscription to this instrument. TryCreateNewBook(instr); // m_InstrumentDetails[instr].Key.MarketKey.Name); m_PriceListener.SubscribeTo(details.Key, new PriceSubscriptionSettings(PriceSubscriptionType.InsideMarket)); } } else { // The user has not previously request info about this Product family. //Log.NewEntry(LogLevel.Warning, "ProcessHubRequestInstrumentPrice: Failed to locate TT version of {0} for request {1}.", instr.SeriesName, request.ToString()); } } } else if (dataType == typeof(InstrumentKey)) { InstrumentKey instrKey = (InstrumentKey)dataObj; lock (m_InstrumentLock) { bool isFoundInstrument = false; InstrumentName instrName = new MistyProds.InstrumentName(); foreach (InstrumentName i in m_InstrumentDetails.Keys) { if (m_InstrumentDetails[i].Key.Equals(instrKey)) { instrName = i; isFoundInstrument = true; break; } } if (!isFoundInstrument) { // Unknown instrument. Log.NewEntry(LogLevel.Warning, "ProcessHubRequestInstrumentPrice: Price subscription request with unknown instrKey = {0}", instrKey.ToString()); } else { // We actually know this instrument. if (!m_InstrumentMarkets.ContainsKey(instrName)) { TryCreateNewBook(instrName); //, m_InstrumentDetails[instrName].Key.MarketKey.Name); m_PriceListener.SubscribeTo(instrKey, new PriceSubscriptionSettings(PriceSubscriptionType.InsideMarket)); } } } } else { Log.NewEntry(LogLevel.Warning, "ProcessHubRequestInstrumentPrice: Failed to recognize data object {0} for request {1}.", dataType.Name, request.ToString()); } } //next data } // ProcessHubRequestInstrumentPrice()