2
Follow
2
Followers
假设要在OKEX期货中做BTC的跨期套利,合约类型为this_week和quarter,并且想用websocket行情模式。
现在是只能添加一个交易所对象exchange,每次GetTicker、exchange.Go前,都要调用一次SetContractType。
websocket示例代码和问题如下:
exchange.IO("websocket");
exchange.SetContractType("this_week");
var tickerA = exchange.GetTicker();
exchange.SetContractType("quarter");
var tickerB = exchange.GetTicker();
问题:每次调用exchange.SetContractType()时,是否会重新连接websocket?
Go函数示例代码和问题如下:
exchange.SetContractType("this_week");
var orderA = exchange.Go("Sell",tickerA.Last, 1);
exchange.SetContractType("quarter");
var orderB = exchange.Go("Buy",tickerB.Last, 1);
问题:因为异步的原因,有没有可能在orderA执行时,实际使用合约类型是quarter?
其他问题:
- 如果上面的问题确实存在的话,有没有什么办法避免呢?
- 同一个交易所的同一个交易对,可否创建两个exchange对象,并且互相之间不影响?比如两个exchange对象都有自己的websocket连接,互不影响。
Related Recommendations
Elementary Tutorial for FMZ Quant platform Strategy WritingGet Started with FMZ Quant PlatformSECURITY BUGI keep getting error: Exchange_GetAccount: Invalid ContractTypeWe have an incredibly profitable market making algorithm for sideways markets on Bitmex - but need expert to help eliminate wait times during downward volatility in the marketError with deribitLimitations of the backtesting engineHow to install ta-lib on linux docker?5.5 Trading strategy optimization5.4 Why do we need an off-sample test
Comment
All comments (1)
- 1
