diff --git a/Intrinio.Realtime/CandleStick.cs b/Intrinio.Realtime/CandleStick.cs index b8c23e5..7a6d681 100644 --- a/Intrinio.Realtime/CandleStick.cs +++ b/Intrinio.Realtime/CandleStick.cs @@ -10,11 +10,11 @@ public abstract class CandleStick private readonly double _closeTimestamp; private readonly IntervalType _interval; - public UInt32 Volume { get; set; } - public double High { get; set; } - public double Low { get; set; } - public double Close { get; set; } - public double Open { get; set; } + public UInt32 Volume { get; private set; } + public double High { get; private set; } + public double Low { get; private set; } + public double Close { get; private set; } + public double Open { get; private set; } public double OpenTimestamp { get { return _openTimestamp; } @@ -23,11 +23,13 @@ public double CloseTimestamp { get { return _closeTimestamp; } } - public double FirstTimestamp { get; set; } - public double LastTimestamp { get; set; } - public bool Complete { get; set; } - public double Average { get; set; } - public double Change { get; set; } + public double FirstTimestamp { get; private set; } + public double LastTimestamp { get; private set; } + public bool Complete { get; private set; } + public double Average { get; private set; } + public double Change { get; private set; } + + public UInt32 TradeCount { get; private set; } public IntervalType Interval { get { return _interval; } @@ -48,9 +50,10 @@ public CandleStick(UInt32 volume, double price, double openTimestamp, double clo Average = price; Change = 0.0; _interval = interval; + TradeCount = 1U; } - public CandleStick(UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) + public CandleStick(UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval, UInt32 tradeCount) { Volume = volume; High = high; @@ -65,6 +68,7 @@ public CandleStick(UInt32 volume, double high, double low, double closePrice, do Average = average; Change = change; _interval = interval; + TradeCount = tradeCount; } public void Merge(CandleStick candle) @@ -78,6 +82,7 @@ public void Merge(CandleStick candle) FirstTimestamp = candle.FirstTimestamp < FirstTimestamp ? candle.FirstTimestamp : FirstTimestamp; LastTimestamp = candle.LastTimestamp > LastTimestamp ? candle.LastTimestamp : LastTimestamp; Change = (Close - Open) / Open; + TradeCount += candle.TradeCount; } public void Update(UInt32 volume, double price, double time) @@ -91,6 +96,7 @@ public void Update(UInt32 volume, double price, double time) FirstTimestamp = time < FirstTimestamp ? time : FirstTimestamp; LastTimestamp = time > LastTimestamp ? time : LastTimestamp; Change = (Close - Open) / Open; + ++TradeCount; } public void MarkComplete() diff --git a/Intrinio.Realtime/Equities/QuoteCandleStick.cs b/Intrinio.Realtime/Equities/QuoteCandleStick.cs index 856e71a..035c172 100644 --- a/Intrinio.Realtime/Equities/QuoteCandleStick.cs +++ b/Intrinio.Realtime/Equities/QuoteCandleStick.cs @@ -23,8 +23,8 @@ public QuoteCandleStick(string symbol, UInt32 volume, double price, QuoteType qu _quoteType = quoteType; } - public QuoteCandleStick(string symbol, UInt32 volume, double high, double low, double closePrice, double openPrice, QuoteType quoteType, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) - : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval) + public QuoteCandleStick(string symbol, UInt32 volume, double high, double low, double closePrice, double openPrice, QuoteType quoteType, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval, UInt32 tradeCount) + : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval, tradeCount) { _symbol = symbol; _quoteType = quoteType; diff --git a/Intrinio.Realtime/Equities/TradeCandleStick.cs b/Intrinio.Realtime/Equities/TradeCandleStick.cs index ecc89b7..1982e56 100644 --- a/Intrinio.Realtime/Equities/TradeCandleStick.cs +++ b/Intrinio.Realtime/Equities/TradeCandleStick.cs @@ -17,8 +17,8 @@ public TradeCandleStick(string symbol, UInt32 volume, double price, double openT _symbol = symbol; } - public TradeCandleStick(string symbol, UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) - : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval) + public TradeCandleStick(string symbol, UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval, UInt32 tradeCount) + : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval, tradeCount) { _symbol = symbol; } diff --git a/Intrinio.Realtime/Options/QuoteCandleStick.cs b/Intrinio.Realtime/Options/QuoteCandleStick.cs index 5b5362b..b7ddec2 100644 --- a/Intrinio.Realtime/Options/QuoteCandleStick.cs +++ b/Intrinio.Realtime/Options/QuoteCandleStick.cs @@ -24,8 +24,8 @@ public QuoteCandleStick(string contract, UInt32 volume, double price, QuoteType _quoteType = quoteType; } - public QuoteCandleStick(string contract, UInt32 volume, double high, double low, double closePrice, double openPrice, QuoteType quoteType, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) - : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval) + public QuoteCandleStick(string contract, UInt32 volume, double high, double low, double closePrice, double openPrice, QuoteType quoteType, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval, UInt32 tradeCount) + : base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval, tradeCount) { _contract = contract; _quoteType = quoteType; diff --git a/Intrinio.Realtime/Options/TradeCandleStick.cs b/Intrinio.Realtime/Options/TradeCandleStick.cs index 9f8fc5d..deda02e 100644 --- a/Intrinio.Realtime/Options/TradeCandleStick.cs +++ b/Intrinio.Realtime/Options/TradeCandleStick.cs @@ -19,8 +19,8 @@ public TradeCandleStick(string contract, UInt32 volume, double price, double ope _contract = contract; } - public TradeCandleStick(string contract, UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) - :base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval) + public TradeCandleStick(string contract, UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval, UInt32 tradeCount) + :base(volume, high, low, closePrice, openPrice, openTimestamp, closeTimestamp, firstTimestamp, lastTimestamp, complete, average, change, interval, tradeCount) { _contract = contract; } diff --git a/Intrinio.Realtime/WebSocketClient.cs b/Intrinio.Realtime/WebSocketClient.cs index 8b7aa71..6c17f82 100644 --- a/Intrinio.Realtime/WebSocketClient.cs +++ b/Intrinio.Realtime/WebSocketClient.cs @@ -1,7 +1,5 @@ using System.Linq; -using System.Net; using System.Net.WebSockets; -using Intrinio.Realtime.Composite; namespace Intrinio.Realtime; @@ -38,7 +36,7 @@ public abstract class WebSocketClient private readonly Func _tryReconnect; private readonly HttpClient _httpClient = new (); private const string ClientInfoHeaderKey = "Client-Information"; - private const string ClientInfoHeaderValue = "IntrinioDotNetSDKv12.2"; + private const string ClientInfoHeaderValue = "IntrinioDotNetSDKv12.3"; private readonly ThreadPriority _mainThreadPriority; private readonly Thread[] _threads; private Thread? _receiveThread; diff --git a/IntrinioRealTimeClient.nuspec b/IntrinioRealTimeClient.nuspec index b97e13a..bcbb374 100644 --- a/IntrinioRealTimeClient.nuspec +++ b/IntrinioRealTimeClient.nuspec @@ -2,7 +2,7 @@ IntrinioRealTimeClient - 12.2.0 + 12.3.0 Intrinio SDK for Real-Time Stock and Option Prices Intrinio Intrinio @@ -10,7 +10,7 @@ https://licenses.nuget.org/MIT https://github.com/intrinio/intrinio-realtime-csharp-sdk Intrinio provides real-time stock and option prices via a two-way WebSocket connection. - Version 12.2.0 release. + Version 12.3.0 release. Copyright 2024 Intrinio fintech stocks options prices websocket real-time market finance