資源の読み込みに... 荷物...

exchange.CancelOrder

FMZ平台的订单{@struct/Order Order}结构的属性```Id```由交易所品种代码和交易所原始订单Id组成,以英文逗号间隔。例如OKX交易所的现货交易对```ETH_USDT```订单的属性```Id```格式为:```ETH-USDT,1547130415509278720```。
调用```exchange.CancelOrder()```函数撤销订单时传入的参数```orderId```与订单{@struct/Order Order}结构的```Id```属性一致。


```exchange.CancelOrder()```函数返回真值,例如```true```表示取消订单请求发送成功, 返回假值,例如```false```表示取消订单请求发送失败。返回值只是代表发送请求成功或失败,判断交易所是否取消订单, 可以调用```exchange.GetOrders()```判断。
bool

exchange.CancelOrder(orderId)
exchange.CancelOrder(orderId, ...args)

```orderId```参数用于指定所要取消的订单。
orderId
true
string
扩展参数,可以输出附带信息到这条撤单日志中,```arg```参数可以传多个。
arg
false
string、number、bool、object、array、空值等系统支持的任意类型

```javascript
function main(){
    var id = exchange.Sell(99999, 1)
    exchange.CancelOrder(id)
}
def main():
    id = exchange.Sell(99999, 1)
    exchange.CancelOrder(id)
void main() {
    auto id = exchange.Sell(99999, 1);
    exchange.CancelOrder(id);
}

オーダーを取り消した.

function main() {
    if (exchange.GetName().includes("Futures_")) {
        Log("设置合约为:永续合约,设置交易方向为:开多仓。")
        exchange.SetContractType("swap")
        exchange.SetDirection("buy")
    }
    
    var ticker = exchange.GetTicker()
    exchange.Buy(ticker.Last * 0.5, 0.1)
    
    var orders = exchange.GetOrders()
    for (var i = 0 ; i < orders.length ; i++) {
        exchange.CancelOrder(orders[i].Id, "撤销的订单:", orders[i])
        Sleep(500)
    }
}
def main():
    if exchange.GetName().find("Futures_") != -1:
        Log("设置合约为:永续合约,设置交易方向为:开多仓。")
        exchange.SetContractType("swap")
        exchange.SetDirection("buy")
    
    ticker = exchange.GetTicker()
    exchange.Buy(ticker["Last"] * 0.5, 0.1)            

    orders = exchange.GetOrders()
    for i in range(len(orders)):
        exchange.CancelOrder(orders[i]["Id"], "撤销的订单:", orders[i])
        Sleep(500)
void main() {
    if (exchange.GetName().find("Futures_") != std::string::npos) {
        Log("设置合约为:永续合约,设置交易方向为:开多仓。");
        exchange.SetContractType("swap");
        exchange.SetDirection("buy");
    }            

    auto ticker = exchange.GetTicker();
    exchange.Buy(ticker.Last * 0.5, 0.1);            

    auto orders = exchange.GetOrders();
    for (int i = 0 ; i < orders.size() ; i++) {
        exchange.CancelOrder(orders[i].Id, "撤销的订单:", orders[i]);
        Sleep(500);
    }
}

FMZのAPI関数は,ログ出力関数を生成することができます.Log()exchange.Buy()exchange.CancelOrder()必要なパラメータの後に,いくつかの付属した出力パラメータを入力できます. 例えば:exchange.CancelOrder(orders[i].Id, orders[i])解消して,orders[i].Idこの命令の出力には,この命令の出力情報が含まれています.orders[i]この構造は,

古いバージョンのホストを使用すると,exchange.CancelOrder()関数のパラメータorderId既存の文書に記述されている可能性orderId違いがある.

{@fun/Trade/exchange.Buy exchange.Buy}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.Buy exchange.Buy}, {@fun/Trade/exchange.Buy}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetOrders}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetOrders}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetOrders}, {@fun/Trade/exchange.GetOrders}, {@fun/Trade/exchange.

exchange.CreateOrder exchange.GetOrder