Everyone can use the FMZ Quant extended API to create a quantitative platform. The demo item shows how to build up a powerful quantitative platform by using Python and FMZ Quant extended API.
According to the DEMO item, you can refer to writing server-side codes and adding front-end pages to insert to the existing systems, such as forums, blogs, communities and others. In order to achieve flexible access to the existing user groups, the existing user groups will not experience the underlying technical support of FMZ Quant completely, so the use of the users is more concise and easy to operate.
Highly flexible strategy design
You can use Python, JavaScript and C++ to write quantitative trading strategies, feel free to customize, and realize your own trading ideas in the world of quantitative trading, without restrictions.
Powerful and effective backtest system
You do not need to collect data hard, and the local backtest engine only needs one command to easily configure; link: https://github.com/fmzquant/backtest_python
Simplified structure
You only need to write several front-end pages and one HTTP srver program, to easily construct the structure.
Name: FMZ Quant Demonstrates How to Use Its Extended API to Construct Your Own Assets Management Quantitative Platform
DEMO installation
First clone the DEMO.
git clone https://github.com/fmzquant/fmz_extend_api_demo.git
Switch to the dictionary and install pip.
pip install -r requirements.txt
Note: if “Permission denied” is prompted, you need to execute pip like “sudo pip install -r requirements.txt”, and enter the password of the operation system by request.
After installation, configure the FMZ account API KEY needed by the server program.
The using details of FMZ extended API KEY can be seen in API documentation:
Create FMZ API KEY.
Write API KEY in the app.py server program of the DEMO.
The server of the DEMO operates the command.
python app.py
Operation display:
After the server program is performed, open the local page in the browser: http://127.0.0.1:5000
Test the registration page.
The DEMO quantitative platform is now running; register the test platform account (saved in the local data); log in to configure API KEY of the platform account.
Now it is configured as follows:
The three strategies displayed on the page are only UI displays. These also require specific design to be implemented by the manager of the asset management quantitative platform. Ther it is only for demonstration purpose.
Configure a test strategy. In this DEMO, the server will detect the press of the “one-key start” button, trigger the strategy of searching for FMZ Quant account containing the “main” keyword, and use this strategy to bind the bot to run, so we need to first create a strategy called “main Test profit”.
Strategy code of main Test profit:
function main() {
while(true) {
LogProfit(Math.random()*100);
Sleep(1000);
}
}
Edit code and click save.
Note: make sure there is one docker online before operation.
Click “One click to start” button, a bot will be created automatically to run; the bot bundling with a demo strategy only can randomly export values displayed as profit values.
You can see a newly created bot is displayed on the dashboard of FMZ Quant:
The corresponding random values are also displayed on DEMO page.
The bot running on FMZ Quant identify the login account of the current DEMO platform by appID.
def robot_run(robotId, appId, exchanges):
strategyId = -1
# You can select to operate a strategy containing the string "main" from the "Strategy"library
for ele in api("GetStrategyList")['data']['result']['strategies']:
if 'main' in ele['name']:
strategyId = ele['id']
if strategyId < 0:
raise u"not found strategy"
settings = {
"name":"robot for %s" % (appId, ),
"args": [], # our custom arguments for this strategey
"appid": appId, # set a label for the bot, to relate to the user
"period": 60,
"strategy": strategyId,
"exchanges": [],
}
for e in exchanges:
settings["exchanges"].append({"eid": e.eid, "pair": get_default_stock(e.eid), "meta" :{"AccessKey": e.accessKey, "SecretKey": e.secretKey}})
if robotId > 0:
return api('RestartRobot', robotId, settings)
else:
return api('NewRobot', settings)
As you can see, “settings” in the code is the configuration information to creates the bot, and appid is used to mark the user.
# Github address update: https://github.com/fmzquant/fmz_extend_api_demo