mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 07:26:48 +00:00
Exchanges: enrich order history with avg executed price, cost, and more (#792)
* Exchanges: enrich order history with avg executed price, cost, and more * Fix division by zero in order detail enrichment * Remove DateCompleted from Bithumb OrderData and fix OrderDate parsing * Fixes on order detail fields and rename EnrichOrderDetail to CalculateCostsAndAmounts * BTSE order history populate name and id * Calculate average executed price for market order or when order amount is zero * Minor fixes on infer order amounts, costs, and times * Attach InferAmountsCostsAndTimes to Order.Detail * Binance: fix order status * Always use order.StringToOrderStatus() and ensure order has at least one of executed/remaining amount set
This commit is contained in:
@@ -1016,6 +1016,7 @@ func (f *FTX) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOr
|
||||
tempResp.ID = strconv.FormatInt(orderData[y].ID, 10)
|
||||
tempResp.Amount = orderData[y].Size
|
||||
tempResp.AssetType = assetType
|
||||
tempResp.AverageExecutedPrice = orderData[y].AvgFillPrice
|
||||
tempResp.ClientOrderID = orderData[y].ClientID
|
||||
tempResp.Date = orderData[y].CreatedAt
|
||||
tempResp.Exchange = f.Name
|
||||
@@ -1080,6 +1081,7 @@ func (f *FTX) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOr
|
||||
tempResp.Side = orderVars.Side
|
||||
tempResp.Type = orderVars.OrderType
|
||||
tempResp.Fee = orderVars.Fee
|
||||
tempResp.InferCostsAndTimes()
|
||||
resp = append(resp, tempResp)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user