using System;
using System.Diagnostics;
namespace CryptoExchange.Net.SharedApis
{
///
/// Futures order info
///
[DebuggerDisplay("{DebugView,nq}")]
public record SharedFuturesOrder : SharedSymbolModel
{
private string DebugView =>
$"[{CreateTime}] {OrderId} {(PositionSide != null ? $"{PositionSide} " : "")}{Symbol} - " +
$"{OrderType} {Side} {OrderQuantity}{(OrderPrice != null ? " @ " + OrderPrice : "")}, " +
$"{Status}{(QuantityFilled != null && Status != SharedOrderStatus.Canceled ? $" {QuantityFilled}" : "")}{(AveragePrice != null ? " @ " + AveragePrice : "")}";
///
/// Id of the order
///
public string OrderId { get; set; }
///
/// Type of the order
///
public SharedOrderType OrderType { get; set; }
///
/// Side of the order
///
public SharedOrderSide Side { get; set; }
///
/// Status of the order
///
public SharedOrderStatus Status { get; set; }
///
/// Time in force for the order
///
public SharedTimeInForce? TimeInForce { get; set; }
///
/// Position side
///
public SharedPositionSide? PositionSide { get; set; }
///
/// Reduce only
///
public bool? ReduceOnly { get; set; }
///
/// Order quantity
///
public SharedOrderQuantity? OrderQuantity { get; set; }
///
/// Filled quantity
///
public SharedOrderQuantity? QuantityFilled { get; set; }
///
/// Order price
///
public decimal? OrderPrice { get; set; }
///
/// Average price
///
public decimal? AveragePrice { get; set; }
///
/// Client order id
///
public string? ClientOrderId { get; set; }
///
/// Asset the fee is in
///
public string? FeeAsset { get; set; }
///
/// Fee paid
///
public decimal? Fee { get; set; }
///
/// Leverage
///
public decimal? Leverage { get; set; }
///
/// Timestamp the order was created
///
public DateTime? CreateTime { get; set; }
///
/// Last update timestamp
///
public DateTime? UpdateTime { get; set; }
///
/// Last trade info, only available for websocket order updates if the API provides this data in the update
///
public SharedUserTrade? LastTrade { get; set; }
///
/// Trigger price for a trigger order
///
public decimal? TriggerPrice { get; set; }
///
/// Whether or not the is order is a trigger order
///
public bool? IsTriggerOrder { get; set; }
///
/// Take profit price
///
public decimal? TakeProfitPrice { get; set; }
///
/// Stop loss price
///
public decimal? StopLossPrice { get; set; }
///
/// Whether this order is to close an existing position. If this is the case quantities might not be specified
///
public bool? IsCloseOrder { get; set; }
///
/// ctor
///
public SharedFuturesOrder(
SharedSymbol? sharedSymbol,
string symbol,
string orderId,
SharedOrderType orderType,
SharedOrderSide orderSide,
SharedOrderStatus orderStatus,
DateTime? createTime)
: base(sharedSymbol, symbol)
{
OrderId = orderId;
OrderType = orderType;
Side = orderSide;
Status = orderStatus;
CreateTime = createTime;
}
}
}