1
0
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:
Jkorf
2026-07-21 11:35:59 +02:00
parent d06f891cee
commit 007743f5a1
2 changed files with 19 additions and 3 deletions
@@ -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>