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

            UpdateFromSymbolData("==> LastQuote", SymbolData);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }