public static Enums.OrderStatus ToCoreEquivalent(this BinanceNet.Objects.OrderStatus input) { switch (input) { case BinanceNet.Objects.OrderStatus.Canceled: return(Enums.OrderStatus.Canceled); case BinanceNet.Objects.OrderStatus.Expired: return(Enums.OrderStatus.Expired); case BinanceNet.Objects.OrderStatus.Filled: return(Enums.OrderStatus.Filled); case BinanceNet.Objects.OrderStatus.New: return(Enums.OrderStatus.New); case BinanceNet.Objects.OrderStatus.PartiallyFilled: return(Enums.OrderStatus.PartiallyFilled); case BinanceNet.Objects.OrderStatus.PendingCancel: return(Enums.OrderStatus.PendingCancel); case BinanceNet.Objects.OrderStatus.Rejected: return(Enums.OrderStatus.Rejected); } throw new ArgumentException($"{input} is an unknown OrderStatus"); }
/*public enum ExchangeAPIOrderResult * { * Unknown, * Filled, * FilledPartially, * Pending, * Error, * Canceled, * PendingCancel * }*/ /*private ES.ExchangeAPIOrderResult MapToResult(Binance.Net.Objects.OrderStatus status) * { * var d = new Dictionary<OrderStatus, ES.ExchangeAPIOrderResult>() { * { OrderStatus.New, ES.ExchangeAPIOrderResult.Pending }, * { OrderStatus.PartiallyFilled, ES.ExchangeAPIOrderResult.FilledPartially }, * { OrderStatus.Filled, ES.ExchangeAPIOrderResult.Filled }, * { OrderStatus.Canceled, ES.ExchangeAPIOrderResult.Canceled }, * { OrderStatus.PendingCancel, ES.ExchangeAPIOrderResult.PendingCancel }, * { OrderStatus.Rejected, ES.ExchangeAPIOrderResult.Error }, * { OrderStatus.Expired, ES.ExchangeAPIOrderResult.Canceled } // Expired becomes Canceled * }; * return d[status]; * }*/ private OrderResult MapToResult(Binance.Net.Objects.OrderStatus status) { var d = new Dictionary <OrderStatus, OrderResult>() { { OrderStatus.New, OrderResult.Pending }, { OrderStatus.PartiallyFilled, OrderResult.FilledPartially }, { OrderStatus.Filled, OrderResult.Filled }, { OrderStatus.Canceled, OrderResult.Canceled }, { OrderStatus.PendingCancel, OrderResult.PendingCancel }, { OrderStatus.Rejected, OrderResult.Error }, { OrderStatus.Expired, OrderResult.Canceled } // Expired becomes Canceled }; return(d[status]); }
private Domain.Model.Markets.OrderStatus GetStatusFromBiannceNet(Binance.Net.Objects.OrderStatus orderStatus) { Domain.Model.Markets.OrderStatus result = null; switch (orderStatus) { case Binance.Net.Objects.OrderStatus.New: result = Domain.Model.Markets.OrderStatus.New; break; case Binance.Net.Objects.OrderStatus.PartiallyFilled: result = Domain.Model.Markets.OrderStatus.PartiallyFilled; break; case Binance.Net.Objects.OrderStatus.Filled: result = Domain.Model.Markets.OrderStatus.Filled; break; case Binance.Net.Objects.OrderStatus.Canceled: result = Domain.Model.Markets.OrderStatus.Canceled; break; case Binance.Net.Objects.OrderStatus.PendingCancel: result = Domain.Model.Markets.OrderStatus.Canceled; break; case Binance.Net.Objects.OrderStatus.Rejected: result = Domain.Model.Markets.OrderStatus.Rejected; break; case Binance.Net.Objects.OrderStatus.Expired: result = Domain.Model.Markets.OrderStatus.Expired; break; } return(result); }