public void VerifySymbolDataRec(string Symbol) { lock ( SymbolDataRecs ) { if (!SymbolDataRecs.Keys.Contains(Symbol)) { SymbolDataRecs[Symbol] = new SymbolDataRec(Symbol); } } }
private void UpdateFromSymbolData(string Type, SymbolDataRec SymbolData) { string Text = string.Format("{0}: Symbol: {1}, Price: {2}, Size: {3}, " + "Bid: {4}, Ask: {5}, " + "BidSize: {6}, AskSize: {7} " + "Time: {8} EST", Type, SymbolData.Symbol, SymbolData.LastPrice, SymbolData.LastSize, SymbolData.Bid, SymbolData.Ask, SymbolData.BidSize, SymbolData.AskSize, SymbolData.TimeStamp); AppendText(Text); }
public SymbolDataRec OnLastTrade(LastTrade LastTradeRef) { if (IsSimulationMode) { VerifySymbolDataRec(LastTradeRef.symbol); } SymbolDataRec SymbolData = GetSymbolDataRec(LastTradeRef.symbol); if (SymbolData != null) { SymbolData.LastPrice = LastTradeRef.last.price; SymbolData.LastSize = LastTradeRef.last.size; SymbolData.TimeStamp = DateTimeFromUnixTimestampMillis(LastTradeRef.last.timestamp); } return(SymbolData); }
public SymbolDataRec OnTrade(Trade TradeRef) { if (IsSimulationMode) { VerifySymbolDataRec(TradeRef.sym); } SymbolDataRec SymbolData = GetSymbolDataRec(TradeRef.sym); if (SymbolData != null) { SymbolData.LastPrice = TradeRef.p; SymbolData.LastSize = TradeRef.s; SymbolData.TimeStamp = DateTimeFromUnixTimestampMillis(TradeRef.t); } return(SymbolData); }
public SymbolDataRec OnLastQuote(LastQuote LastQuoteRef) { if (IsSimulationMode) { VerifySymbolDataRec(LastQuoteRef.symbol); } SymbolDataRec SymbolData = GetSymbolDataRec(LastQuoteRef.symbol); if (SymbolData != null) { SymbolData.Bid = LastQuoteRef.last.bidprice; SymbolData.Ask = LastQuoteRef.last.askprice; SymbolData.AskSize = LastQuoteRef.last.asksize; SymbolData.BidSize = LastQuoteRef.last.bidsize; SymbolData.TimeStamp = DateTimeFromUnixTimestampMillis(LastQuoteRef.last.timestamp); } return(SymbolData); }
public SymbolDataRec OnQuote(Quote QuoteRef) { if (IsSimulationMode) { VerifySymbolDataRec(QuoteRef.sym); } SymbolDataRec SymbolData = GetSymbolDataRec(QuoteRef.sym); if (SymbolData != null) { SymbolData.Bid = QuoteRef.bp; SymbolData.Ask = QuoteRef.ap; SymbolData.BidSize = QuoteRef.bs; SymbolData.AskSize = QuoteRef.ask; SymbolData.TimeStamp = DateTimeFromUnixTimestampMillis(QuoteRef.t); } return(SymbolData); }
private void OnLastQuote(LastQuote LastQuoteRef) { SymbolDataRec SymbolData = SymDataHandler.OnLastQuote(LastQuoteRef); UpdateFromSymbolData("==> LastQuote", SymbolData); }
// this handler is attached to PGWebRef.OnQuoteEvent // which is fired for realtime data private void OnQuote(Quote QuoteRef) { SymbolDataRec SymbolData = SymDataHandler.OnQuote(QuoteRef); UpdateFromSymbolData("***> Quote", SymbolData); }
// this handler is attached to PGWebRef.OnTradeEvent // which is fired for realtime data private void OnTrade(Trade TradeRef) { SymbolDataRec SymbolData = SymDataHandler.OnTrade(TradeRef); UpdateFromSymbolData("Trade", SymbolData); }