0bps

Strategy vault / Tools & templates

Trading Terminal Plugin Example

For demonstrating trading terminal plugin embedding function. https://www.fmz.com/api %E4%BA%A4%E6%98%93%E6%8F%92%E4%BB%B6

Author
发明者量化-小小梦
Complexity
Starter · 31 lines
Parameters
3

For demonstrating trading terminal plugin embedding function. https://www.fmz.com/api#%E4%BA%A4%E6%98%93%E6%8F%92%E4%BB%B6

Parameters

NameDefaultWhat it controls
TransactionTimesNumber of tradesNumber of trades
AmountNumber of coins per tradenumber of coins per trade
SideTrading directionTrading direction

Source JavaScript

function main() {
    var initAcc = _C(exchange.GetAccount)
    var tbl = {
        "type" : "table", 
        "title" : "Table",
        "cols" : ["Project', 'Content"],
        "rows" : [],     
    }
    
    for (var i = 0 ; i < TransactionTimes ; i++) {
        var info = null
        if (Side == 0) {
            info = $.Buy(Amount)
        } else if (Side == 1) {
            info = $.Sell(Amount)
        } else {
            throw "side error!"
        }
        
        tbl.rows.push([i + "Order number, transaction status:", JSON.stringify(info)])    
        Sleep(300)
    }
    
    var nowAcc = _C(exchange.GetAccount)
    Log("balance:", nowAcc.Balance)
    delete initAcc.Info
    delete nowAcc.Info
    tbl.rows.push(["Initial account:", JSON.stringify(initAcc)])
    tbl.rows.push(["Post-execution account:", JSON.stringify(nowAcc)])    
    return tbl
}

Published by 发明者量化-小小梦 on the FMZ strategy square · last modified 2025-04-08. 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/Trading-Terminal-Plugin-Example.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