0bps

Strategy vault / Tools & templates

Starter Template Balance of Each Platform

Check balances and coin quantities on each platform

Author
Zero
Complexity
Starter · 24 lines
Parameters
1

Check balances and coin quantities on each platform

Parameters

NameDefaultWhat it controls
DisableRatefalseDisable exchange rate conversion

Source JavaScript

function main() {
    for (var i = 0; i < exchanges.length; i++) {
        if (DisableRate) {
            exchanges[i].SetRate(1);
        }

        if (exchanges[i].GetName().indexOf('CTP') != -1) {
            while (!exchanges[i].IO("status")) {
                LogStatus("Waiting" + exchanges[i].GetLabel() + "Connect to the exchange server, Market data server: " + (exchanges[i].IO("status", 0) ? 'Normal' : 'Disconnect') + ', Trading server: ' + (exchanges[i].IO("status", 1) ? 'Normal' : 'Disconnect'));
                Sleep(1000);
            }
            LogStatus("Connection successful");
        }

        while (true) {
            var account = exchanges[i].GetAccount();
            if (account) {
                Log(exchanges[i].GetName(), exchanges[i].GetLabel(), exchanges[i].GetCurrency(), exchanges[i].GetAccount());
                break;
            }
            Sleep(3000);
        }
    }
}

Published by Zero on the FMZ strategy square · last modified 2016-07-25. 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/Starter-Template-Balance-of-Each-Platform.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