Type/to search
Getting Started
Welcome to FMZ Quant Trading Platform
Quick Start
Key Security
Platform Basics
Account and Billing
Live Robot Billing and Top-up
Sub-accounts
Exchange
General Protocol
Local Credential Files
Exchange-Specific Notes
Securities and Futures
Crypto
Docker
Strategy Library
Live Trading
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Integrations

The PluginRun method runs a piece of JavaScript code on a docker and returns the result. It uses the same execution mechanism as the "Debug Tool" among the development tools and trading terminal plugins (see Integrations → Trading Terminal → Plugin Principle and Development). No live trading bot is created and nothing is charged; one run lasts at most 5 minutes.

Returns

json
{ "code": 0, "data": { "result": "{\"logs\":[{\"PlatformId\":\"\",\"OrderId\":\"0\",\"LogType\":5,\"Price\":0,\"Amount\":0,\"Extra\":\"Hello FMZ\",\"Currency\":\"\",\"Instrument\":\"\",\"Direction\":\"\",\"Time\":1732267473108}],\"result\":\"\"}", "error": null } }
  • result: The result as a JSON string: logs holds the logs written with Log(), result the JSON text of the value returned by main().

Arguments

NameTypeRequiredDescription

settings

JSON object

Yes

Run configuration, for example:

json
{ "source": "function main() {Log(\"Hello FMZ\")}", "node": 123, "period": 60, "exchanges": [{"pid": 123, "pair": "SOL_USDT"}] }
  • source: the code to run. The entry point is main(), whose return value is the result.
  • strategy: when source is not given, run the account's strategy with this ID (e.g. a trading plugin).
  • node: ID of the docker that runs the code; omitted or -1 selects one automatically.
  • exchanges: exchange object configuration, same as "Live trading configuration (settings)" in Extended API Interface Details.

Remarks

exchanges can also pass the exchange configuration directly instead of referencing an exchange account on the platform, for example:

plaintext
{"eid": "Binance", "pair": "ETH_BTC", "meta": {"AccessKey": "...", "SecretKey": "..."}}

The field names of meta are given by the meta returned by GetExchangeList. Usually only one exchange object is set in exchanges (the debug tool page also supports only one); setting two causes no error, but accessing the second exchange object in the code does.