mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-11 08:22:53 +00:00
Added calculation of AveragePrice on Shared order models if data is available and AveragePrice is not set
This commit is contained in:
@@ -54,10 +54,18 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// Order price
|
||||
/// </summary>
|
||||
public decimal? OrderPrice { get; set; }
|
||||
private decimal? _averagePrice;
|
||||
/// <summary>
|
||||
/// Average price
|
||||
/// Average fill price
|
||||
/// </summary>
|
||||
public decimal? AveragePrice { get; set; }
|
||||
public decimal? AveragePrice
|
||||
{
|
||||
get => _averagePrice > 0 ? _averagePrice
|
||||
: (QuantityFilled?.QuantityInBaseAsset > 0 && QuantityFilled?.QuantityInQuoteAsset > 0
|
||||
? QuantityFilled.QuantityInQuoteAsset / QuantityFilled.QuantityInBaseAsset
|
||||
: null);
|
||||
set => _averagePrice = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// Client order id
|
||||
/// </summary>
|
||||
|
||||
@@ -46,10 +46,18 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// Order price
|
||||
/// </summary>
|
||||
public decimal? OrderPrice { get; set; }
|
||||
private decimal? _averagePrice;
|
||||
/// <summary>
|
||||
/// Average fill price
|
||||
/// </summary>
|
||||
public decimal? AveragePrice { get; set; }
|
||||
public decimal? AveragePrice
|
||||
{
|
||||
get => _averagePrice > 0 ? _averagePrice
|
||||
: (QuantityFilled?.QuantityInBaseAsset > 0 && QuantityFilled?.QuantityInQuoteAsset > 0
|
||||
? QuantityFilled.QuantityInQuoteAsset / QuantityFilled.QuantityInBaseAsset
|
||||
: null);
|
||||
set => _averagePrice = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// Client order id
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user