mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 23:16:53 +00:00
order: slight optimizations (#917)
* order: slight optimizations * orders: add benchmarks, small optimize and change order side to uin8 for comparitive optimizations. * orders: continue to convert string type -> uint * orders/backtester: interim move type to orders package, later can expand or deprecate. * orders: handle errors * orders: optimize filters and remove error returns when its clearly not needed * orders: remove log call * backtester: zero value check * orders/futures: zero value -> flag * linter: fix * linter: more fixes * linters: rides again * glorious: nits * common: Add zero value unix check for time values; also addresses glorious nits * glorious scott: nits Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -765,7 +765,10 @@ func (z *ZB) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) (
|
||||
}
|
||||
}
|
||||
|
||||
order.FilterOrdersByTimeRange(&orders, req.StartTime, req.EndTime)
|
||||
err = order.FilterOrdersByTimeRange(&orders, req.StartTime, req.EndTime)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys, "%s %v", z.Name, err)
|
||||
}
|
||||
order.FilterOrdersBySide(&orders, req.Side)
|
||||
return orders, nil
|
||||
}
|
||||
@@ -778,7 +781,7 @@ func (z *ZB) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if req.Side == order.AnySide || req.Side == "" {
|
||||
if req.Side == order.AnySide {
|
||||
return nil, errors.New("specific order side is required")
|
||||
}
|
||||
|
||||
@@ -854,7 +857,10 @@ func (z *ZB) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) (
|
||||
orders[i] = detail
|
||||
}
|
||||
|
||||
order.FilterOrdersByTimeRange(&orders, req.StartTime, req.EndTime)
|
||||
err = order.FilterOrdersByTimeRange(&orders, req.StartTime, req.EndTime)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys, "%s %v", z.Name, err)
|
||||
}
|
||||
return orders, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user