public void RemoveRTData(RTDataRec RecIn) { RTDataRec Rec = GetRTDataRec(RecIn.Symbol, RecIn.ClusterName, false); if (Rec != null) { OnUnSubscribedSymbolEvent?.Invoke(Rec); RTDataDict.Remove(Rec.Symbol); } }
internal void OnCryptoQuote(CryptoQuote quote) { RTDataRec Rec = GetRTDataRec(quote.pair, PGClusterNames.Crypto); Rec.AskTick = quote.ap == 0 ? TickType.FlatTick : Rec.Ask > quote.ap ? TickType.DownTick : TickType.UpTick; Rec.Ask = quote.ap; Rec.BidTick = quote.bp == 0 ? TickType.FlatTick : Rec.Bid > quote.bp ? TickType.DownTick : TickType.UpTick; Rec.Bid = quote.bp; Rec.Spread = (Rec.Ask - Rec.Bid).ToString("0.00000"); }
internal void OnForexQuote(ForexQuote quote) { RTDataRec Rec = GetRTDataRec(quote.p, PGClusterNames.Forex); Rec.AskTick = quote.a == 0 ? TickType.FlatTick : Rec.Ask > quote.a ? TickType.DownTick : TickType.UpTick; Rec.Ask = quote.a; Rec.BidTick = quote.b == 0 ? TickType.FlatTick : Rec.Bid > quote.b ? TickType.DownTick : TickType.UpTick; Rec.Bid = quote.b; Rec.Spread = (Rec.Ask - Rec.Bid).ToString("0.00000"); }
internal void OnEquitiesQuote(Quote quote) { RTDataRec Rec = GetRTDataRec(quote.sym, PGClusterNames.Equities); Rec.AskTick = quote.ap == 0 ? TickType.FlatTick : Rec.Ask > quote.ap ? TickType.DownTick : TickType.UpTick; Rec.Ask = quote.ap; Rec.BidTick = quote.bp == 0 ? TickType.FlatTick : Rec.Bid > quote.bp ? TickType.DownTick : TickType.UpTick; Rec.Bid = quote.bp; Rec.Spread = (Rec.Ask - Rec.Bid).ToString("0.00"); }
internal RTDataRec GetRTDataRec(string Symbol, string ClusterName, bool Create = true) { RTDataRec Rec; if (!RTDataDict.TryGetValue(Symbol, out Rec) && Create) { Rec = new RTDataRec(Symbol, ClusterName); RTDataDict[Symbol] = Rec; OnSubscribedSymbolEvent?.Invoke(Rec); Rec.RequestLast = true; } return(Rec); }
internal void OnEquitiesTrade(Trade trade) { RTDataRec Rec = GetRTDataRec(trade.sym, PGClusterNames.Equities); Rec.PriceTick = trade.p == 0 ? TickType.FlatTick : Rec.Price > trade.p ? TickType.DownTick : TickType.UpTick; Rec.Price = trade.p; Rec.LastSize = trade.s; string Change = (Math.Max(Rec.PreviousClose, trade.p) - Math.Min(Rec.PreviousClose, trade.p)). ToString("F2"); Rec.Change = double.Parse(Change); Rec.ChangeTick = Rec.Change == 0 ? TickType.FlatTick : Rec.Change < 0 ? TickType.DownTick : TickType.UpTick; }
internal void OnCryptoTrade(CryptoTrade trade) { RTDataRec Rec = GetRTDataRec(trade.pair, PGClusterNames.Crypto); Rec.PriceTick = trade.p == 0 ? TickType.FlatTick : Rec.Price > trade.p ? TickType.DownTick : TickType.UpTick; Rec.Price = trade.p; Rec.CryptoSize = trade.s; string Change = (Math.Max(Rec.PreviousClose, trade.p) - Math.Min(Rec.PreviousClose, trade.p)). ToString("0:00"); Rec.Change = double.Parse(Change); Rec.ChangeTick = Rec.Change == 0 ? TickType.FlatTick : Rec.Change < 0 ? TickType.DownTick : TickType.UpTick; }
internal void OnSubscribe(string ClusterName, Dictionary <string, SubscribeSymbolRec> SubscribedSymbols) { var SubscribedSymbolsCopy = new Dictionary <string, SubscribeSymbolRec>(SubscribedSymbols); foreach (var kvPair in SubscribedSymbolsCopy) { string Symbol = kvPair.Key; SubscribeSymbolRec SubscribeRec = kvPair.Value; if (SubscribeRec.IsNew) { RTDataRec Rec = GetRTDataRec(Symbol, ClusterName); OnSubscribedSymbolEvent?.Invoke(Rec); } } }
public void OnPreviousClose(string ClusterName, PreviousClose previousClose) { RTDataRec Rec = GetRTDataRec(previousClose.ticker, ClusterName); Rec.PreviousClose = previousClose.results.First().c; }
internal void OnForexAgg(ForexAggregate forexAgg) { RTDataRec Rec = GetRTDataRec(forexAgg.pair, PGClusterNames.Crypto); Rec.LastSize = forexAgg.v; }