0bps

Strategy vault / Tools & templates

BitMEX Advanced API Features Futures Bulk Order and One Click Cancel JavaScript

JavaScript strategy by FawkesPan.

Author
FawkesPan
Complexity
Starter · 50 lines
Parameters
0

The original spec has no written description. Read the source below.

Source JavaScript

/*

 BitMEX Advanced API Interface for FMZ.com.

 Copyright 2018 FawkesPan
 Contact : [email protected] / Telegram@FawkesPan

 GNU General Public License v3.0

*/

function main() {
    Log(exchange.GetAccount());
}
var bulk = []
// Add Bulk Buy Orders
function BulkBuy(symbol,qty,price,type,exec) {
    Log("NewBulkOrder Open Long "+ symbol + " " + price + "   " + qty)
    var order = {};
    order.symbol = symbol;
    order.side = "Buy";
    order.orderQty = qty;
    order.price = price;
    order.ordType = type;
    order.execInst = exec;
    bulk[Object.keys(bulk).length] = order;
}
// Add Bulk Sell Orders
function BulkSell(symbol,qty,price,type,exec) {
    Log("NewBulkOrder Open Short "+ symbol + " " + price + "   " + qty)
    var order = {};
    order.symbol = symbol;
    order.side = "Sell";
    order.orderQty = qty;
    order.price = price;
    order.ordType = type;
    order.execInst = exec;
    bulk[Object.keys(bulk).length] = order;
}
//Execute Bulk Orders
function BulkPost() {
    Log("is executingBulkOrders Total " + Object.keys(bulk).length + " Orders");
    var param = "orders=" + JSON.stringify(bulk);
    bulk = [];
    exchange.IO("api", "POST", "/api/v1/order/bulk", param);
}
//Cancel All Orders
function CancelPendingOrders() {
    exchange.IO("api","DELETE","/api/v1/order/all","symbol="+exchange.GetCurrency());
}

Published by FawkesPan on the FMZ strategy square · last modified 2018-08-30. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a tested, production-ready module from strategies/BitMEX-Advanced-API-Features-Futures-Bulk-Order-and-One-Click-Cancel-JavaScript.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open