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

Export functions are the interface functions of template libraries, which can be called by strategies that reference the template library.

Examples

  • Different programming languages have different formats for writing template libraries. The following are example codes for declaring and implementing export functions in template libraries:

    javascript
    /* -- 策略引用该模板以后直接用 $.Test() 调用此方法 -- main 函数在策略中不会触发, 只做为模板调试的入口 */ $.Test = function() { Log('Test') } function main() { $.Test() }
    python
    def Test(): Log("template call") # 导出Test函数, 主策略可以通过ext.Test()调用 ext.Test = Test
    rust
    // after referencing this template, a strategy calls it as ext::Test() // functions called by the strategy must be declared pub pub fn Test() { Log!("template call"); }
  • Strategies written in Blockly visual mode can implement library functions through JavaScript language template libraries. Please use the following format.

    javascript
    /*blockly { "type": "ext_testA", "message0": "testA|testA", "template": "function(){return 99;}()", "order": "ORDER_ATOMIC", "output": "Number" },{ "type": "ext_MA", "message0": "MA 周期 %1| MA Period %1", "args0": [{ "type": "input_value", "check": "Number" }], "template": "(function(){var r = exchange.GetRecords(); return (!r || r.length < %1) ? false : TA.MA(r, %1); })()", "order": "ORDER_ATOMIC", "output": null, "colour": 85 } */