mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
ftx: fix ioc convert
This commit is contained in:
parent
f6ebeeafc5
commit
17034b2467
|
@ -42,13 +42,19 @@ func toGlobalOrder(r order) (types.Order, error) {
|
|||
if r.Ioc {
|
||||
timeInForce = types.TimeInForceIOC
|
||||
}
|
||||
|
||||
// order type definition: https://github.com/ftexchange/ftx/blob/master/rest/client.py#L122
|
||||
orderType := types.OrderType(TrimUpperString(r.Type))
|
||||
if orderType == types.OrderTypeLimit && r.PostOnly {
|
||||
orderType = types.OrderTypeLimitMaker
|
||||
}
|
||||
|
||||
o := types.Order{
|
||||
SubmitOrder: types.SubmitOrder{
|
||||
ClientOrderID: r.ClientId,
|
||||
Symbol: toGlobalSymbol(r.Market),
|
||||
Side: types.SideType(TrimUpperString(r.Side)),
|
||||
// order type definition: https://github.com/ftexchange/ftx/blob/master/rest/client.py#L122
|
||||
Type: types.OrderType(TrimUpperString(r.Type)),
|
||||
Type: orderType,
|
||||
Quantity: r.Size,
|
||||
Price: r.Price,
|
||||
TimeInForce: timeInForce,
|
||||
|
|
|
@ -102,27 +102,20 @@ func Test_toGlobalSymbol(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_toLocalOrderTypeWithLimitMaker(t *testing.T) {
|
||||
|
||||
orderType, err := toLocalOrderType(types.OrderTypeLimitMaker)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, orderType, OrderTypeLimit)
|
||||
assert.Equal(t, postOnly, true)
|
||||
}
|
||||
|
||||
func Test_toLocalOrderTypeWithLimit(t *testing.T) {
|
||||
|
||||
orderType, err := toLocalOrderType(types.OrderTypeLimit)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, orderType, OrderTypeLimit)
|
||||
assert.Equal(t, postOnly, false)
|
||||
}
|
||||
|
||||
func Test_toLocalOrderTypeWithMarket(t *testing.T) {
|
||||
orderType, err := toLocalOrderType(types.OrderTypeMarket)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, orderType, OrderTypeMarket)
|
||||
assert.Equal(t, postOnly, false)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user