private void App_Shown(object sender, EventArgs e) { int iMaxWait = 2500; //Wait for another instance to finish unloading if there was one int dwStart = Environment.TickCount; while (true) { Application.DoEvents(); if (Environment.TickCount > dwStart + iMaxWait) { break; } } if (mbt == null) { try { StubReceiver receiver = new StubReceiver(); mbt = new MbtInterface(); mbt.Start(receiver); SymbolInfo symbol = Factory.Symbol.LookupSymbol("MSFT"); StartSymbolDetail detail = new StartSymbolDetail(); detail.LastTime = new TimeStamp(DateTime.Now); mbt.StartSymbol(receiver, symbol, detail); } catch (Exception problem) { log.Notice(problem.Message, problem); } timer1.Enabled = true; } }
public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail) { if (debug) { log.Debug("StartSymbol " + symbol + ", " + detail.LastTime); } receiver.OnEvent(symbol, (int)EventType.StartRealTime, null); instrumentReaders.AddDepth(symbol); }
public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail) { log.Info("StartSymbol( " + symbol + ")"); if (this.receiver != receiver) { throw new ApplicationException("Invalid receiver. Only one receiver allowed for " + this.GetType().Name); } // This adds a new order handler. TryAddSymbol(symbol); OnStartSymbol(symbol); }
public void StartSymbol(Receiver receiver, SymbolInfo symbol, object eventDetail) { StartSymbolDetail detail = (StartSymbolDetail)eventDetail; if (!symbol.Equals(Symbol)) { throw new ApplicationException("Mismatching symbol."); } if (detail.LastTime != StartTime) { throw new ApplicationException("Mismatching start time. Expected: " + StartTime + " but was " + detail.LastTime); } }
public void Login() { Factory.Provider.StartSockets(); client.Agent.SendEvent(new EventItem(this, EventType.Connect)); var startSymbol = new StartSymbolDetail(TimeStamp.MinValue); MSFT = Factory.Symbol.LookupSymbol("MSFT"); client.Agent.SendEvent(new EventItem(this, MSFT, EventType.StartSymbol, startSymbol)); //market.Agent.SendEvent(new EventItem(this, EventType.Connect)); }
public void StartSymbol(Receiver receiver, SymbolInfo symbol, StartSymbolDetail detail) { if (debug) { log.Debug("StartSymbol " + symbol + ", " + detail.LastTime); } // Equity equity = new Equity(symbol.Symbol); // Contract contract = new Contract(symbol.Symbol,"SMART",SecurityType.Stock,"USD"); // Contract contract = new Contract(symbol.Symbol,"GLOBEX",SecurityType.Future,"USD","201006"); Contract contract = SymbolToContract(symbol); SymbolHandler handler = GetSymbolHandler(symbol, receiver); // tickerid.Add((int)symbol.BinaryIdentifier); // client.RequestMarketData((int)symbol.BinaryIdentifier, contract, null, false, false); client.RequestMarketData((int)symbol.BinaryIdentifier, contract, null, false, false); receiver.OnEvent(symbol, (int)EventType.StartRealTime, null); }