client.CreateOrder does not have a function parameter to allow setting TimeInForce resulting in using the default GTE value every time. The only thought I had was to make use of the Option functions to manually overwrite the message as follows:
// gymnastics to be able to set TimeInForce value to IOC (Immediate or Cancel)
// https://docs.binance.org/trading-spec.html
m := msg.CreateOrderMsg{
Sender: addr,
ID: "",
Symbol: sym,
OrderType: msg.OrderType.LIMIT,
Side: s,
Price: price,
Quantity: quantity,
TimeInForce: msg.TimeInForce.IOC,
}
withMsg := func(txMsg *tx.StdSignMsg) *tx.StdSignMsg {
txMsg.Msgs = []msg.Msg{m}
return txMsg
}
createOrderResult, err := client.CreateOrder(base, quote, s, price, quantity, true, withMsg)
if err != nil {
panic(err)
}
It would be a bit difficult to add without breaking the CreateOrder API as it stands. Can you think of any reasonable way to go about adding this functionality? Or please let me know if I am overlooking something and there is another way to accomplish this. Thank you!
client.CreateOrder
does not have a function parameter to allow setting TimeInForce resulting in using the defaultGTE
value every time. The only thought I had was to make use of theOption
functions to manually overwrite the message as follows:However, after looking more closely, the msg is overwritten with the order message created by
CreateOrder
regardless at: https://github.com/binance-chain/go-sdk/blob/8f0e838a5402c99cc08057a04eaece6dfd99181f/client/transaction/transaction.go#L101 resulting in no possibility to use the IOC TimeInForce as far as I can tell.It would be a bit difficult to add without breaking the
CreateOrder
API as it stands. Can you think of any reasonable way to go about adding this functionality? Or please let me know if I am overlooking something and there is another way to accomplish this. Thank you!