0bps

Strategy vault / Tools & templates

Get the Full Currency Name of Binance USDT Contract

1,Put into FMZ debugging tool, can run directly 2,Get the full currency name and number of Binance usdt contract

Author
鑫
Complexity
Starter · 49 lines
Parameters
0

1,Put into FMZ debugging tool, can run directly 2,Get the full currency name and number of Binance usdt contract

Source JavaScript

function unique (str) {
	var arr = str.split(',');
	return Array.from(new Set(arr)).join(',')
}

function main() {
    var exchange_info = JSON.parse(HttpQuery('https://fapi.binance.com/fapi/v1/exchangeInfo'));
    var str = '';
    exchange_info.symbols.forEach(function(exitem, index) {
        if (exitem.symbol.indexOf('USDT') == -1) {return}
        if (exitem.symbol.indexOf('BTCST') !== -1) {return}
        if (exitem.symbol.indexOf('BTCDOM') !== -1) {return}
        var content = ',';
        if (index == exchange_info.symbols.length - 1) {
            content = '';
        }
        str += exitem.baseAsset + content;
    });
	Log('Total number of contract currencies:', unique(str).split(',').length)
    Log('Names of all contract currencies:',unique(str))
    // return leverageBracket;

    let leverageBracket = exchange.IO("api", "GET", "/fapi/v1/leverageBracket", "timestamp=" + new Date().getTime())
    let newList = leverageBracket.map((item) => {
        return {
            symbol: item.symbol,
            leverage: item.brackets[0].initialLeverage
        }
    })
    let selectLeverage = 25;
    newList = newList.filter((item) => {
        return item.leverage >= selectLeverage;
    })
    Log('Number of filtered coins:' , newList.length);
    let str2 = ''

    newList.forEach(function(exitem, index) {
        if (exitem.symbol.indexOf('USDT') == -1) {return}
        if (exitem.symbol.indexOf('BTCST') !== -1) {return}
        if (exitem.symbol.indexOf('BTCDOM') !== -1) {return}
        var content = ',';
        if (index == newList.length - 1) {
            content = '';
        }
        str2 += exitem.baseAsset + content;
    });
    Log('Name of filtered coins:', str);
}

Published by 鑫 on the FMZ strategy square · last modified 2023-09-26. 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/Get-the-Full-Currency-Name-of-Binance-USDT-Contract.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