Strategy vault / Tools & templates
BitMEX Advanced API Features Futures Bulk Order and One Click Cancel JavaScript
JavaScript strategy by FawkesPan.
JavaScriptTools & templates
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.
/agenkit build a tested, production-ready module from strategies/BitMEX-Advanced-API-Features-Futures-Bulk-Order-and-One-Click-Cancel-JavaScript.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- Binance Account Cross Transfer Small ToolJavaScript · Tools & templates
- Get cryptocurrency current and max supplyJavaScript · Tools & templates
- Interaction TemplateJavaScript · Tools & templates
- KuCoin Fund Transfer PluginJavaScript · Tools & templates
- Moving Average Bot 30 linesJavaScript · Tools & templates · 1d
- OKEx V5 Candlestick Data Paginated Query ExampleJavaScript · Tools & templates