void stiQuote_OnSTIQuoteSnap(ref structSTIQuoteSnap q) { TickImpl k = new TickImpl(); k.symbol = q.bstrSymbol; k.bid = (decimal)q.fBidPrice; k.ask = (decimal)q.fAskPrice; k.bs = q.nBidSize / 100; k.os = q.nAskSize / 100; if (q.bstrExch != "*") { k.ex = q.bstrExch; } if (q.bstrBidExch != "*") { k.be = q.bstrBidExch; } if (q.bstrAskExch != "*") { k.oe = q.bstrAskExch; } int now = Convert.ToInt32(q.bstrUpdateTime); k.date = Util.ToTLDate(DateTime.Now); k.time = now; k.trade = (decimal)q.fLastPrice; k.size = q.nLastSize; tl.newTick(k); }
void stiQuote_OnSTIQuoteSnap(ref structSTIQuoteSnap q) { if (UseXmlMode) { return; } dosnap(ref q); }
private void SessionOnStiQuoteSnap(ref structSTIQuoteSnap structQuoteSnap) { var l1CngMsg = new Level1ChangeMessage { SecurityId = new SecurityId { SecurityCode = structQuoteSnap.bstrSymbol, BoardCode = structQuoteSnap.bstrExch }, ServerTime = structQuoteSnap.bstrUpdateTime.StrToTime(), }; l1CngMsg.TryAdd(Level1Fields.BestAskPrice, (decimal)structQuoteSnap.fAskPrice); l1CngMsg.TryAdd(Level1Fields.BestBidPrice, (decimal)structQuoteSnap.fAskPrice); l1CngMsg.TryAdd(Level1Fields.BestAskVolume, (decimal)structQuoteSnap.nAskSize); l1CngMsg.TryAdd(Level1Fields.BestBidVolume, (decimal)structQuoteSnap.nBidSize); l1CngMsg.TryAdd(Level1Fields.OpenPrice, (decimal)structQuoteSnap.fOpenPrice); l1CngMsg.TryAdd(Level1Fields.HighPrice, (decimal)structQuoteSnap.fHighPrice); l1CngMsg.TryAdd(Level1Fields.LowPrice, (decimal)structQuoteSnap.fLowPrice); l1CngMsg.TryAdd(Level1Fields.LastTradePrice, (decimal)structQuoteSnap.fLastPrice); l1CngMsg.TryAdd(Level1Fields.LastTradeVolume, (decimal)structQuoteSnap.nLastSize); l1CngMsg.TryAdd(Level1Fields.OpenInterest, (decimal)structQuoteSnap.nOpenInterest); l1CngMsg.TryAdd(Level1Fields.Volume, (decimal)structQuoteSnap.nCumVolume); l1CngMsg.TryAdd(Level1Fields.VWAP, (decimal)structQuoteSnap.fVwap); l1CngMsg.TryAdd(Level1Fields.ClosePrice, (decimal)structQuoteSnap.fClosePrice); // цена закрытия прошлого дня. SendOutMessage(l1CngMsg); if (_subscribedSecuritiesToTrade.Cache.Contains(structQuoteSnap.bstrSymbol) && structQuoteSnap.fLastPrice != 0) { var tickMsg = new ExecutionMessage { ExecutionType = ExecutionTypes.Tick, SecurityId = new SecurityId { SecurityCode = structQuoteSnap.bstrSymbol, BoardCode = structQuoteSnap.bstrExch }, //TradeId = structQuoteSnap., TradePrice = (decimal)structQuoteSnap.fLastPrice, Volume = structQuoteSnap.nLastSize, //OriginSide = action.ToSide(), ServerTime = structQuoteSnap.bstrUpdateTime.StrToTime() }; SendOutMessage(tickMsg); } }
void stiQuote_OnSTIQuoteSnapXML(ref string bstrQuote) { try { XmlSerializer xs = new XmlSerializer(typeof(SterlingLib.structSTIQuoteSnap)); structSTIQuoteSnap q = (structSTIQuoteSnap)xs.Deserialize(new System.IO.StringReader(bstrQuote)); dosnap(ref q); } catch (Exception ex) { debug("Error deserializing quote: " + bstrQuote); debug(ex.Message + ex.StackTrace); } }
private void SessionOnStiQuoteSnap(ref structSTIQuoteSnap structQuoteSnap) { var l1CngMsg = new Level1ChangeMessage { SecurityId = new SecurityId { SecurityCode = structQuoteSnap.bstrSymbol, BoardCode = structQuoteSnap.bstrExch }, ServerTime = structQuoteSnap.bstrUpdateTime.StrToTime(), }; if (structQuoteSnap.bAskPrice != 0) l1CngMsg.TryAdd(Level1Fields.BestAskPrice, (decimal)structQuoteSnap.fAskPrice); if (structQuoteSnap.bBidPrice != 0) l1CngMsg.TryAdd(Level1Fields.BestBidPrice, (decimal)structQuoteSnap.fBidPrice); l1CngMsg.TryAdd(Level1Fields.BestAskVolume, (decimal)structQuoteSnap.nAskSize); l1CngMsg.TryAdd(Level1Fields.BestBidVolume, (decimal)structQuoteSnap.nBidSize); if (structQuoteSnap.bOpenPrice != 0) l1CngMsg.TryAdd(Level1Fields.OpenPrice, (decimal)structQuoteSnap.fOpenPrice); if (structQuoteSnap.bHighPrice != 0) l1CngMsg.TryAdd(Level1Fields.HighPrice, (decimal)structQuoteSnap.fHighPrice); if (structQuoteSnap.bLowPrice != 0) l1CngMsg.TryAdd(Level1Fields.LowPrice, (decimal)structQuoteSnap.fLowPrice); if (structQuoteSnap.bLastPrice != 0) l1CngMsg.TryAdd(Level1Fields.LastTradePrice, (decimal)structQuoteSnap.fLastPrice); l1CngMsg.TryAdd(Level1Fields.LastTradeVolume, (decimal)structQuoteSnap.nLastSize); l1CngMsg.TryAdd(Level1Fields.OpenInterest, (decimal)structQuoteSnap.nOpenInterest); l1CngMsg.TryAdd(Level1Fields.Volume, (decimal)structQuoteSnap.nCumVolume); l1CngMsg.TryAdd(Level1Fields.VWAP, (decimal)structQuoteSnap.fVwap); l1CngMsg.TryAdd(Level1Fields.ClosePrice, (decimal)structQuoteSnap.fClosePrice); // öåíà çàêðûòèÿ ïðîøëîãî äíÿ. SendOutMessage(l1CngMsg); if (_subscribedSecuritiesToTrade.Cache.Contains(structQuoteSnap.bstrSymbol) && structQuoteSnap.fLastPrice != 0) { var tickMsg= new ExecutionMessage { ExecutionType = ExecutionTypes.Tick, SecurityId = new SecurityId{SecurityCode = structQuoteSnap.bstrSymbol,BoardCode = structQuoteSnap.bstrExch}, //TradeId = structQuoteSnap., TradePrice = (decimal)structQuoteSnap.fLastPrice, TradeVolume = structQuoteSnap.nLastSize, //OriginSide = action.ToSide(), ServerTime = structQuoteSnap.bstrUpdateTime.StrToTime() }; SendOutMessage(tickMsg); } }
void dosnap(ref structSTIQuoteSnap q) { TickImpl k = new TickImpl(); k.symbol = q.bstrSymbol; k.bid = (decimal)q.fBidPrice; k.ask = (decimal)q.fAskPrice; k.bs = q.nBidSize / 100; k.os = q.nAskSize / 100; k.ex = GetExPretty(q.bstrExch); k.be = GetExPretty(q.bstrBidExch); k.oe = GetExPretty(q.bstrAskExch); int now = Convert.ToInt32(q.bstrUpdateTime); k.date = Util.ToTLDate(DateTime.Now); k.time = now; k.trade = (decimal)q.fLastPrice; k.size = q.nLastSize; tl.newTick(k); }
void stiQuote_OnSTIQuoteSnap(ref structSTIQuoteSnap q) { if (UseXmlMode) return; dosnap(ref q); }