diff --git a/CryptoExchange.Net/SharedApis/ResponseModels/SharedFuturesTicker.cs b/CryptoExchange.Net/SharedApis/ResponseModels/SharedFuturesTicker.cs index d569458d..4d13eeb9 100644 --- a/CryptoExchange.Net/SharedApis/ResponseModels/SharedFuturesTicker.cs +++ b/CryptoExchange.Net/SharedApis/ResponseModels/SharedFuturesTicker.cs @@ -24,7 +24,24 @@ namespace CryptoExchange.Net.SharedApis /// /// The volume in the last 24h /// - public decimal Volume { get; set; } + public SharedOrderQuantity Volumes { get; set; } + + private decimal? _volume; + /// + /// The volume in the last 24h + /// + [Obsolete("Use `Volumes` instead")] + public decimal Volume + { + get + { + if (_volume.HasValue) + return _volume.Value; + + return Volumes.QuantityInBaseAsset ?? Volumes.QuantityInContracts ?? 0; + } + set => _volume = value; + } /// /// Change percentage in the last 24h /// @@ -49,13 +66,20 @@ namespace CryptoExchange.Net.SharedApis /// /// ctor /// - public SharedFuturesTicker(SharedSymbol? sharedSymbol, string symbol, decimal? lastPrice, decimal? highPrice, decimal? lowPrice, decimal volume, decimal? changePercentage) + public SharedFuturesTicker( + SharedSymbol? sharedSymbol, + string symbol, + decimal? lastPrice, + decimal? highPrice, + decimal? lowPrice, + SharedOrderQuantity volumes, + decimal? changePercentage) :base(sharedSymbol, symbol) { LastPrice = lastPrice; HighPrice = highPrice; LowPrice = lowPrice; - Volume = volume; + Volumes = volumes; ChangePercentage = changePercentage; } } diff --git a/CryptoExchange.Net/SharedApis/ResponseModels/SharedKline.cs b/CryptoExchange.Net/SharedApis/ResponseModels/SharedKline.cs index 0af19b31..51967797 100644 --- a/CryptoExchange.Net/SharedApis/ResponseModels/SharedKline.cs +++ b/CryptoExchange.Net/SharedApis/ResponseModels/SharedKline.cs @@ -6,7 +6,7 @@ namespace CryptoExchange.Net.SharedApis /// /// Kline info /// - [DebuggerDisplay("[{OpenTime}] O: {OpenPrice} H: {HighPrice} L: {LowPrice} C: {ClosePrice} V: {Volume}")] + [DebuggerDisplay("[{OpenTime}] O: {OpenPrice} H: {HighPrice} L: {LowPrice} C: {ClosePrice} V: {Volumes}")] public record SharedKline : SharedSymbolModel { /// @@ -29,15 +29,40 @@ namespace CryptoExchange.Net.SharedApis /// Open price /// public decimal OpenPrice { get; set; } + + private decimal? _volume; /// /// Volume in the base asset /// - public decimal Volume { get; set; } + [Obsolete("Use `Volumes` instead")] + public decimal Volume + { + get + { + if (_volume.HasValue) + return _volume.Value; + + return Volumes.QuantityInBaseAsset ?? Volumes.QuantityInContracts ?? 0; + } + set => _volume = value; + } + /// + /// The volume in the last 24h + /// + public SharedOrderQuantity Volumes { get; set; } /// /// ctor /// - public SharedKline(SharedSymbol? sharedSymbol, string symbol, DateTime openTime, decimal closePrice, decimal highPrice, decimal lowPrice, decimal openPrice, decimal volume) + public SharedKline( + SharedSymbol? sharedSymbol, + string symbol, + DateTime openTime, + decimal closePrice, + decimal highPrice, + decimal lowPrice, + decimal openPrice, + SharedOrderQuantity volumes) : base(sharedSymbol, symbol) { OpenTime = openTime; @@ -45,7 +70,7 @@ namespace CryptoExchange.Net.SharedApis HighPrice = highPrice; LowPrice = lowPrice; OpenPrice = openPrice; - Volume = volume; + Volumes = volumes; } } } diff --git a/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotTicker.cs b/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotTicker.cs index 35ab1dee..51fda8c0 100644 --- a/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotTicker.cs +++ b/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotTicker.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; namespace CryptoExchange.Net.SharedApis { @@ -21,13 +22,31 @@ namespace CryptoExchange.Net.SharedApis /// public decimal? LowPrice { get; set; } /// + /// The volume in the last 24h + /// + public SharedOrderQuantity Volumes { get; set; } + + private decimal? _volume; + /// /// Trade volume in base asset in the last 24h /// - public decimal Volume { get; set; } + [Obsolete("Use `Volumes` instead")] + public decimal Volume + { + get + { + if (_volume.HasValue) + return _volume.Value; + + return Volumes.QuantityInBaseAsset ?? Volumes.QuantityInContracts ?? 0; + } + set => _volume = value; + } /// /// Trade volume in quote asset in the last 24h /// - public decimal? QuoteVolume { get; set; } + [Obsolete("Use `Volumes` instead")] + public decimal? QuoteVolume => Volumes?.QuantityInQuoteAsset; /// /// Change percentage in the last 24h /// @@ -36,13 +55,20 @@ namespace CryptoExchange.Net.SharedApis /// /// ctor /// - public SharedSpotTicker(SharedSymbol? sharedSymbol, string symbol, decimal? lastPrice, decimal? highPrice, decimal? lowPrice, decimal volume, decimal? changePercentage) + public SharedSpotTicker( + SharedSymbol? sharedSymbol, + string symbol, + decimal? lastPrice, + decimal? highPrice, + decimal? lowPrice, + SharedOrderQuantity volumes, + decimal? changePercentage) : base(sharedSymbol, symbol) { LastPrice = lastPrice; HighPrice = highPrice; LowPrice = lowPrice; - Volume = volume; + Volumes = volumes; ChangePercentage = changePercentage; } } diff --git a/CryptoExchange.Net/SharedApis/SharedQuantity.cs b/CryptoExchange.Net/SharedApis/SharedQuantity.cs index 67a1660c..13a0dd7c 100644 --- a/CryptoExchange.Net/SharedApis/SharedQuantity.cs +++ b/CryptoExchange.Net/SharedApis/SharedQuantity.cs @@ -142,6 +142,11 @@ namespace CryptoExchange.Net.SharedApis [JsonConverter(typeof(SharedOrderQuantityConverter))] public record SharedOrderQuantity : SharedQuantityReference { + /// + /// The average price based on the base and quote asset quantities + /// + public decimal? AveragePrice => QuantityInBaseAsset == 0 ? null : QuantityInQuoteAsset / QuantityInBaseAsset; + /// /// ctor ///