mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 15:11:03 +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:
@@ -376,6 +376,7 @@ func (a *Alphapoint) GetActiveOrders(ctx context.Context, req *order.GetOrdersRe
|
||||
orderDetail := order.Detail{
|
||||
Amount: resp[x].OpenOrders[y].QtyTotal,
|
||||
Exchange: a.Name,
|
||||
ExecutedAmount: resp[x].OpenOrders[y].QtyTotal - resp[x].OpenOrders[y].QtyRemaining,
|
||||
AccountID: strconv.FormatInt(int64(resp[x].OpenOrders[y].AccountID), 10),
|
||||
ID: strconv.FormatInt(int64(resp[x].OpenOrders[y].ServerOrderID), 10),
|
||||
Price: resp[x].OpenOrders[y].Price,
|
||||
@@ -423,6 +424,7 @@ func (a *Alphapoint) GetOrderHistory(ctx context.Context, req *order.GetOrdersRe
|
||||
Amount: resp[x].OpenOrders[y].QtyTotal,
|
||||
AccountID: strconv.FormatInt(int64(resp[x].OpenOrders[y].AccountID), 10),
|
||||
Exchange: a.Name,
|
||||
ExecutedAmount: resp[x].OpenOrders[y].QtyTotal - resp[x].OpenOrders[y].QtyRemaining,
|
||||
ID: strconv.FormatInt(int64(resp[x].OpenOrders[y].ServerOrderID), 10),
|
||||
Price: resp[x].OpenOrders[y].Price,
|
||||
RemainingAmount: resp[x].OpenOrders[y].QtyRemaining,
|
||||
|
||||
Reference in New Issue
Block a user