mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-11 16:32:57 +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
|
/// Order price
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? OrderPrice { get; set; }
|
public decimal? OrderPrice { get; set; }
|
||||||
|
private decimal? _averagePrice;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Average price
|
/// Average fill price
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Client order id
|
/// Client order id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -46,10 +46,18 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Order price
|
/// Order price
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? OrderPrice { get; set; }
|
public decimal? OrderPrice { get; set; }
|
||||||
|
private decimal? _averagePrice;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Average fill price
|
/// Average fill price
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Client order id
|
/// Client order id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user