Beispiel #1
0
 public void VerifySymbolDataRec(string Symbol)
 {
     lock ( SymbolDataRecs )
     {
         if (!SymbolDataRecs.Keys.Contains(Symbol))
         {
             SymbolDataRecs[Symbol] = new SymbolDataRec(Symbol);
         }
     }
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        private void OnLastQuote(LastQuote LastQuoteRef)
        {
            SymbolDataRec SymbolData = SymDataHandler.OnLastQuote(LastQuoteRef);

            UpdateFromSymbolData("==> LastQuote", SymbolData);
        }
Beispiel #8
0
        // 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);
        }
Beispiel #9
0
        // 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);
        }