mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 23:16:54 +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:
@@ -856,12 +856,13 @@ func (b *Bittrex) GetOrderHistory(ctx context.Context, req *order.GetOrdersReque
|
||||
continue
|
||||
}
|
||||
|
||||
resp = append(resp, order.Detail{
|
||||
detail := order.Detail{
|
||||
Amount: orderData[i].Quantity,
|
||||
RemainingAmount: orderData[i].Quantity - orderData[i].FillQuantity,
|
||||
ExecutedAmount: orderData[i].FillQuantity,
|
||||
RemainingAmount: orderData[i].Quantity - orderData[i].FillQuantity,
|
||||
Price: orderData[i].Limit,
|
||||
Date: orderData[i].CreatedAt,
|
||||
CloseTime: orderData[i].ClosedAt,
|
||||
ID: orderData[i].ID,
|
||||
Exchange: b.Name,
|
||||
Type: orderType,
|
||||
@@ -869,7 +870,9 @@ func (b *Bittrex) GetOrderHistory(ctx context.Context, req *order.GetOrdersReque
|
||||
Status: orderStatus,
|
||||
Fee: orderData[i].Commission,
|
||||
Pair: pair,
|
||||
})
|
||||
}
|
||||
detail.InferCostsAndTimes()
|
||||
resp = append(resp, detail)
|
||||
}
|
||||
|
||||
order.FilterOrdersByType(&resp, req.Type)
|
||||
|
||||
Reference in New Issue
Block a user