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:
Ryan O'Hara-Reid
2022-05-06 12:27:21 +10:00
committed by GitHub
parent d735effc8e
commit cdcc9630de
60 changed files with 1375 additions and 802 deletions

View File

@@ -452,10 +452,20 @@ func ExchangeOrderSubmit(args ...objects.Object) (objects.Object, error) {
return nil, err
}
side, err := order.StringToOrderSide(orderSide)
if err != nil {
return nil, err
}
oType, err := order.StringToOrderType(orderType)
if err != nil {
return nil, err
}
tempSubmit := &order.Submit{
Pair: pair,
Type: order.Type(orderType),
Side: order.Side(orderSide),
Type: oType,
Side: side,
Price: orderPrice,
Amount: orderAmount,
ClientID: orderClientID,

View File

@@ -124,10 +124,10 @@ func (w Wrapper) QueryOrder(ctx context.Context, exch, _ string, _ currency.Pair
AccountID: "hello",
ID: "1",
Pair: pair,
Side: "ask",
Type: "limit",
Side: order.Ask,
Type: order.Limit,
Date: time.Now(),
Status: "cancelled",
Status: order.Cancelled,
Price: 1,
Amount: 2,
ExecutedAmount: 1,
@@ -139,8 +139,8 @@ func (w Wrapper) QueryOrder(ctx context.Context, exch, _ string, _ currency.Pair
Price: 1,
Amount: 2,
Exchange: exch,
Type: "limit",
Side: "ask",
Type: order.Limit,
Side: order.Ask,
Fee: 0,
Description: "",
},