Type/to search
Welcome to FMZ Quant Trading Platform
Programming Languages
JavaScript
TypeScript
Python
C++
MyLanguage
PINE Language
Blockly Visual Programming
Workflow
Key Security
Live Trading
Strategy Library
Docker
Deploy Docker
One-Click Docker Rental
Manual Deployment of Bot
Docker Operation Precautions
Global IP Address Specification
Command Line Parameters for Bot Program
Live Trading Data Migration
Docker Monitor
Exchange
Strategy Editor
Backtesting System
Strategy Entry Functions
Strategy Framework and API Functions
Template Library
Strategy Parameters
Interactive Controls
Options Trading
C++ Strategy Writing Guide
JavaScript Strategy Writing Guide
Web3
Built-in Libraries
Extended API Interface
MCP Service
Trading Terminal
Data Explorer
Alpha Factor Analysis Tool
General Protocol
Debugging Tool
Remote Editing
Import and Export of Complete Strategies
Multi-language Support
Live Trading and Strategy Grouping
Live Trading Display
Strategy Sharing and Renting
Live Trading Message Push
Common Causes of Live Trading Errors and Abnormal Exits
Exchange-Specific Notes

FMZ Quant Trading Platform has open-sourced local backtesting engines for JavaScript and Python languages, supporting custom underlying K-line periods during backtesting.

Using Python as an example, here's a brief guide on how to use the local backtesting engine:

python
'''backtest start: 2022-02-19 00:00:00 end: 2022-03-22 12:00:00 period: 15m exchanges: [{"eid":"Binance","currency":"BTC_USDT","balance":10000,"stocks":0}] ''' # Part 1 ----------------------------------- # Initialize the backtesting engine, backtest contains the engine configuration # which is consistent with the FMZ platform's online backtesting system configuration # Read the configuration string above via __doc__ and initialize the backtesting environment from fmz import * task = VCtx(__doc__) # initialize backtest engine from __doc__ # End ----------------------------------- # Part 2 ----------------------------------- # Below is an example of strategy code to be tested (complete strategy code can be copied from FMZ platform) # Note: When copying strategy code only, it does not include parameter design, interaction design, and other configurations def onTick(): ticker = _C(exchange.GetTicker) LogStatus(_D(), ticker.Last) def main(): exchange.SetCurrency("ETH_USDT") # exchange.SetContractType("swap") # If testing futures exchange objects, you need to set the contract, for example, set to perpetual contract here Log(exchange.GetAccount()) while True: onTick() Sleep(1000) # End ----------------------------------- # Part 3 ----------------------------------- # Execute backtesting and catch the termination signal, EOF exception will be triggered when backtesting ends # After catching the exception, you can output backtesting result data or display backtesting charts try: main() except: print("Strategy testing completed.") print(task.Join(False)) # print backtest result # task.Show() # or show backtest chart # End -----------------------------------