1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-20 12:53:02 +00:00
Files
CryptoExchange.Net/CryptoExchange.Net/Trackers/Trades/TradesStats.cs
T
Jan Korf 9e86a08327 Trackers (#218)
Fix for intermittently failing rate limiting test
Added ConnectionId to RequestDefinition to correctly handle connection and path rate limiting configuration
Added ValidateMessage method to websocket Query object to filter messages even though it is matched to the query based on the  ListenIdentifier
Added KlineTracker and TradeTracker implementation
2024-10-28 10:36:19 +01:00

66 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace CryptoExchange.Net.Trackers.Trades
{
/// <summary>
/// Trades statistics
/// </summary>
public record TradesStats
{
/// <summary>
/// Number of trades
/// </summary>
public int TradeCount { get; set; }
/// <summary>
/// Timestamp of the last trade
/// </summary>
public DateTime? FirstTradeTime { get; set; }
/// <summary>
/// Timestamp of the first trade
/// </summary>
public DateTime? LastTradeTime { get; set; }
/// <summary>
/// Average trade price
/// </summary>
public decimal? AveragePrice { get; set; }
/// <summary>
/// Volume weighted average trade price
/// </summary>
public decimal? VolumeWeightedAveragePrice { get; set; }
/// <summary>
/// Volume of the trades
/// </summary>
public decimal Volume { get; set; }
/// <summary>
/// Volume of the trades in quote asset
/// </summary>
public decimal QuoteVolume { get; set; }
/// <summary>
/// The volume weighted Buy/Sell ratio. A 0.7 ratio means 70% of the trade volume was a buy.
/// </summary>
public decimal? BuySellRatio { get; set; }
/// <summary>
/// Whether the data is complete
/// </summary>
public bool Complete { get; set; }
/// <summary>
/// Compare 2 stat snapshots to eachother
/// </summary>
public TradesCompare CompareTo(TradesStats otherStats)
{
return new TradesCompare
{
TradeCountDif = new CompareValue(TradeCount, otherStats.TradeCount),
AveragePriceDif = new CompareValue(AveragePrice, otherStats.AveragePrice),
VolumeWeightedAveragePriceDif = new CompareValue(VolumeWeightedAveragePrice, otherStats.VolumeWeightedAveragePrice),
VolumeDif = new CompareValue(Volume, otherStats.Volume),
QuoteVolumeDif = new CompareValue(QuoteVolume, otherStats.QuoteVolume),
BuySellRatioDif = new CompareValue(BuySellRatio, otherStats.BuySellRatio),
};
}
}
}