/// <summary> /// Get positions by criteria /// </summary> /// <param name="inputs"></param> /// <returns></returns> protected async Task <IndexCollection <ITransactionPositionModel> > GetGenericPositions(dynamic inputs) { var positions = new IndexCollection <ITransactionPositionModel>(); var response = await GetResponse <InputDealListModel>($"/v3/accounts/{ Account.Id }/trades"); foreach (var inputOrder in response.Deals) { var positionModel = new TransactionPositionModel { Id = $"{ inputOrder.Id }", Size = inputOrder.Size, Price = inputOrder.Price, OpenPrice = inputOrder.Price, Type = OrderTypeMap.Input(inputOrder.Type), Status = DealStatusMap.Input(inputOrder.Status), TimeSpan = OrderTimeSpanMap.Input(inputOrder.TimeSpan), Time = inputOrder.OpenTime ?? inputOrder.CreationTime, DealTime = inputOrder.OpenTime }; positions.Add(positionModel); } return(positions); }
/// <summary> /// Get orders by criteria /// </summary> /// <param name="inputs"></param> /// <returns></returns> protected async Task <IndexCollection <ITransactionOrderModel> > GetGenericOrders(dynamic inputs) { var orders = new IndexCollection <ITransactionOrderModel>(); var response = await GetResponse <InputOrderListModel>($"/v3/accounts/{ Account.Id }/orders"); foreach (var inputOrder in response.Orders) { var orderModel = new TransactionOrderModel { Id = $"{ inputOrder.Id }", Size = inputOrder.Size, Price = inputOrder.Price, Time = inputOrder.CreationTime, Type = OrderTypeMap.Input(inputOrder.Type), Status = OrderStatusMap.Input(inputOrder.Status), TimeSpan = OrderTimeSpanMap.Input(inputOrder.TimeSpan), DealTime = inputOrder.FillTime ?? inputOrder.CancellationTime ?? inputOrder.TriggerTime }; orders.Add(orderModel); } return(orders); }