Sumber dimuat naik... memuat...

o(_) o

Penulis:Eleutheromania, Dicipta: 2024-08-08 16:20:45, Dikemas kini: 2024-08-10 18:47:09

            side: "sell",
            tdMode: "cross",
            ordType: "post_only",
            px: event.depth.asks[0].price.toFixed(4),
            sz: "1",
        }],
        cancelOrders: order ? [{
            instId: order.instId,
            clOrdId: order.Id
        }] : []  // 确保 order 存在,否则返回空数组
    }
}

}

Fungsi utama let instId = exchange.SetContractType ((swap).InstrumentID;

let ctx = $.NewWSS(exchange, function(ws) {
    let msg = null;
    if (exchange.GetName() === 'Futures_OKCoin') {
        msg = {
            op: "subscribe",
            args: [{
                channel: "books5",
                instId: instId,
            }, {
                channel: "trades",
                instId: instId,
            }]
        };
    } else {
        let symbol = exchange.GetCurrency().replace('_', '').toLowerCase();
        msg = {
            method: "SUBSCRIBE",
            params: [symbol + "@aggTrade", symbol + "@depth20@100ms"],
            id: 1,
        };
    }
    ws.write(JSON.stringify(msg));
    Log("subscribe", msg, "channel");
    LogStatus("Ready");
}, onTick, false);

while (true) {
    ctx.poll();
    EventLoop(1000);
}

}


Lebih lanjut

Pencipta Kuantiti - Impian KecilHello, error order tidak ditakrifkan. Saya menukar syarat if kepada true, tetapi kekurangan satu kalimat ``let order = event.orders && event.orders[0]; // Jika anda mengambil order pertama dari peristiwa, order tidak ditakrifkan. Di bawah ini adalah beberapa format tambahan untuk kod: ` ` ` Kod ` ` ` Berhati-hati dengan simbol, bukan simbol.

EleutheromaniaTerima kasih.