websocket 版OKEX跨期对冲策略(教学)
8
Follow
1364
Followers
Source
JavaScript
function Hedge (isOpen, retSetA, retSetB) {
exchanges[0].SetDirection(isOpen ? "sell" : "closesell")
exchanges[1].SetDirection(isOpen ? "buy" : "closebuy");
(function (routineA, routineB) {
Log(routineA.wait(), routineB.wait(), retSetA, retSetB)
})(exchanges[0].Go(isOpen ? "Sell" : "Buy", -1, _ContractNum), exchanges[1].Go(isOpen ? "Buy" : "Sell", -1, _ContractNum))
}
function main () {
var param = {"op": "subscribe", "args": ["futures/ticker:" + _Instrument_id_A, "futures/ticker:" + _Instrument_id_B]}
var client = Dial("wss://real.okex.com:8443/ws/v3|compress=gzip_raw&mode=recv&reconnect=true&payload=" + JSON.stringify(param))
client.write(JSON.stringify(param))Strategy parameters
Related strategies
Comment
All comments (4)
- 1




