Let's say you want to make a spread on BTC in an OKEX futures, contract type is this_week and quarter, and you want to use the websocket market model. Now you can only add one exchange object to exchange, and you must call SetContractType once before each GetTicker, exchange.Go call.
The example code and questions for the websocket are as follows:
exchange.IO("websocket"); exchange.SetContractType(“this_week”); var tickerA = exchange.GetTicker(); exchange.SetContractType(“quarter”); var tickerB = exchange.GetTicker();
Question: Is the websocket reconnected every time exchange.SetContractType (()) is called?
Go function example code and problems are as follows:
exchange.SetContractType(“this_week”); var orderA = exchange.Go(“Sell”,tickerA.Last, 1); exchange.SetContractType(“quarter”); var orderB = exchange.Go(“Buy”,tickerB.Last, 1);
Question: Is it possible, because of the asynchrony, that the actual contract type used when order A is executed is quarter?
Other questions:
Inventors quantify - small dreamsOKEX futures do not support such a mode of switching. You can create a websocket connection directly using the Dial function.