资源加载中... loading...

Get Started with FMZ Quant Platform

Author: Ninabadass, Created: 2022-03-18 08:57:28, Updated: 2022-03-29 16:58:32

[TOC] After studying this tutorial, you will understand the architecture and functions of FMZ Quant Trading platform, and be able to create strategies and actually run bots. The specific strategy API writing will be introduced in the subsequent tutorials: Elementary tutorial: https://www.fmz.com/bbs-topic/9091
Advanced tutorial: https://www.fmz.com/bbs-topic/9106

FMZ Quant Trading Platform

Introduction


FMZ Quant Platform (former BotVS) is a professional quantitative community, founded in 2014. Here you can learn, write, share, buy and sell quantitative strategies, online backtest and use virtual exchanges to simulate trading, and run, open, and view live bots. It supports commodity futures and Esunny Outer disc Futures, as well as almost all commonly used cryptocurrency platforms. FMZ is suitable for beginners in quantitative trading. Even if you have no foundation, you can get started quickly. The platform is powerful and flexible, and it may also meet advanced needs. Welcome to join in the telegram group on homepage.

For cryptocurrency spot platforms, almost all of them are currently supported. If there are other required platforms, they will be supported soon after they are proposed. Supported cryptocurrency futures trading platforms: OKEX, Huobi, GateIO, BitMEX, Deribit, BFX; supported leverage platforms: OKEX, Huobi, Binance, FCoin, ZB, Bibox; supported perpetual contract platforms: BitMEX, Deribit, GateIO, OKEX, BFX, Bibox; it also supports Deribit cryptocurrency options trading; simulation platforms: exchanges test websites, such as BitMEX and FMZ official spot simulation trading platform “Wex.app”.

FMZ Quant platform supports the use of complete high-level languages such as Javascript, Python and C++, as well as visualization languages and Mylanguage (compatible with Webstock) to implement strategies.

The platform is charged by hour; each real bot charges 0.05 US dollars per hour; less than one hour is regarded as one hour; restart after suspension without repeated charges, FMZ single bot can operate multiple platforms, multiple accounts, and multiple trading pairs.

The server running the real bot needs to be prepared by yourself, or you can rent the server prepared by FMZ Quant platform (the price is comparatively high). A current mainstream overseas server is about 30 yuan per month. Only trading commodity futures can rent domestic servers.

Note: The cryptocurrency part of FMZ has been separated. The domestic website (www.fmz.cn) focuses on commodity futures business and can be recharged in RMB. The foreign website can only do cryptocurrency business and can be recharged in US dollars or USDT.

User Oriented


  • 1.A beginner in programmatic trading, but with trading experience and strategic thinking, can learn simple programming and use it for real bots. FMZ Quant provides the unified encapsulation and examples for interfaces, which will greatly save your learning time.
  • 2.Professional or semi-professional strategy researcher can write strategies proficiently, and customize relevant strategy fees, according to user requirements.
  • 3.If you have a matured strategy that needs to be sold or requires funds, you can show the bot on FMZ and rent out the strategy.
  • 4.Users who have experience in using other commodity futures programmatic platforms, such as Webstock and BT Quant, etc., are able to write Mylanguage strategies. FMZ Quant is very suitable for those users to get started, by providing more powerful functions.
  • 5.Users, who have stable operating strategy and programming experience, need the web-based management and chart functions provided by FMZ Quant, to better run their own bot.
  • 6.Users, with programming and trading experience, need to look at other public strategies and communicate in the forum to find their own strategy ideas.
  • 7.Users, without programming experience at all, are unwilling to learn, but want to buy mature strategies (which is not recommended; at least the relevant knowledge needs to be mastered).

Platform Framework


The structure of FMZ is special; unlike other trading software that needs to download the client, it basically only needs to be managed on the FMZ website, so there are so many advantages. The main function of FMZ website is to write strategies and manage the bots. The specific implementation of the bots is on the docker of users’ server or computer. The docker is responsible for communicating with the FMZ website to transmit logs, and directly run the bot to access platforms to obtain market quotes and tradings. If there is a short-term problem on the FMZ website, it will not affect the implementation of the strategy bot. Users can deploy the docker to any place to improve the trading speed, manage the bot, view logs, and modify parameters anytime and anywhere through FMZ website. For more introductions, please refer to: https://www.fmz.com/digest-topic/7542

Security of API-KEY & Strategy Source Code


API-KEY is the important private information of users. FMZ does not save the user’s KEY. The server saves the data encrypted by the browser according to the user’s password. When the real bot is created, the data is sent to the docker. For FMZ doesn’t save user’s plain text password, so the user’s API-KEY cannot be obtained, even if by FMZ. Users need to protect the plain text of the API-KEY, the FMZ website password and the server where the docker locates. FMZ Quant platform has been running for more than 4 years and has been used by tens of thousands of users without any security issues.

The source code of the strategy is saved on the FMZ server. If you want to execute the strategy locally, you can save your codes as a Python file and directly call and execute in the strategy. For the specific method, see the FAQ at the end of the top basic tutorials. In this way, your codes will be fully localized.

If you want to rent out the strategy without users seeing the source code, you need to use “js” to complete the strategy, which will be compiled into machine code executed by the tenant docker, which is very difficult to decompile. However, Python language itself does not have an encryption mechanism; FMZ has recently upgraded the encryption mechanism for selling Python strategy source code, but it cannot completely prevent the risk of strategy leakage. If you must use Python, you can help your client rent the docker to run the strategy.

Steps for Getting Started


  1. To learn a programming language, Javascript and Python are recommended, and you only need to be able to simply use them.
  2. You should be acquainted with using FMZ Quant platform, deploy your own docker, and know the relations between strategy, bot, docker and the website.
  3. Browse API doc and know more about interfaces and functions.
  4. Learn the tutorial strategies in “Strategy” section, and write strategies with simple functions by yourself, such as price push, iceberg order and so on.
  5. Create your own strategy, familiarize yourself with specific API interfaces and common error messages, and learn to ask questions and search relevant posts correctly.
  6. Use simulated bot and real bot to run strategies, and find out more questions in practice.

The most important thing is to dare to start learning, step by step, and all steps must be taken by yourself. Even if it seems very difficult at first, once you complete the first strategy, you will find that everything is so easy. If you have a certain programming foundation, you can get started and write strategies within a week. If you don’t know programming knowledge, you need an extra week to learn the most basic programming knowledge. If you use Webstock before and are familiar with Mylanguage, you only need to know how to use the platform.

If any problem, you can always post questions in the forum at https://www.fmz.com/bbs, or send a ticket at https://www.fmz.com/m/tickets, or @managers in QQ group or WeChat group (they usually answer very quickly). Pay attention that you can try searching the documents or visit the forum first to solve your problems, and you need to provide sufficient information when asking questions.

Study Resource Recommendation


  • “Cryptocurrency Quantitative Trading Course” of NetEase Cloud Classroom, officially produced by FMZ, only needs 20 yuan, with richly detailed content, from simple to deep, suitable for beginners! courselink
  • FMZ official column on Zhihu, where high-quality articles will be published, and welcome to follow us on Zhihu: https://zhuanlan.zhihu.com/botvs
  • Some detailed strategy source code analysis posts, suitable for learning strategies: https://www.fmz.com/bbs/s:tag:源码解析/1
  • Some teaching strategies, suitable for early elementary learning, writing strategies while learning the basics:https://www.fmz.com/square/s:tag:教学/1
  • Frequently asked questions summary post; if you encounter problems, you can search here first: https://www.fmz.com/bbs-topic/1427
  • FMZ official library (“Digest”), there are many classic articles and strategies to share and analyze, users are also welcome to contribute, there will be rewards after acceptance. https://www.fmz.com/digest

Run a Bot in 30 Minutes

The steps to run a bot from scratch are as follows:

  1. Add exchange API-KEY to FMZ website;
  2. Create a strategy that needs to run;
  3. Deploy a docker that runs the bot.
  4. Create a bot.

If the first three steps have been done, you only need make the fourth step. Next, take a WeChat price warning bot as an example to introduce how to run a bot from the beginning. More detailed functions of the platform will be introduced in next chapter.

1. Add Platform


First, you need to log in to the corresponding exchange website to apply for the API-KEY. The KEY is divided into two, namely “Access Key” and “Secret Key”. The Access Key may have other names, but just remember that one is Secret Key and the other is Access Key. API-KEY is used to encrypt data and verify identity. It is similar to username and password. It is very important, so you cannot leak it out. Different platforms have different application locations, just search “API” and you will find them. Note that if a platform supports both spot and futures, spot and futures need to be added separately, such as OKEX and OKEX futures, Huobi and Huobi futures, even if their API-KEY is the same. Here we take FMZ official virtual platform “Wex.app” as example.

The website address is: https://wex.app. (Note that due to network reasons, Wex simulated platform sometimes requires overseas dockers to access.) You need to register an account by email. After the registration, the virtual assets in the “wallet” should be transferred to the “coin account” on Wex virtual platform, and initially there are no trading assets. Click API Management on the user avatar in the upper right corner of the website. Click “Create” and enter the email verification code to create. Among them, you can see IP restrictions and available permissions. It is safer that IP restrictions can only allow programs under this IP address to access the account. As for permissions, don’t forget to add trading permissions, otherwise you will not be able to place an order. img

The obtained API-KEY in the demo, namely Access Key and Secret Key, which can only be seen once, so don’t forget to record and save it. img

Enter the interface of adding platform (https://www.fmz.com/m/platforms), and click ”Add platform” button. img

First, select cryptocurrency for the platform category, select WexApp for the platform name (because there are many platforms, you can directly enter the text to select), and then copy the “KEY” you just apply for. Note that a platform can be added multiple times, by using different labels to distinguish. To add a platform, you need to enter the FMZ website password, where the browser encrypts the entered KEY and uploads it. img

After adding, you can see the added platforms on the page, and you can also modify the added platforms. img

If you want to run the commodity futures CTP virtual trading, you need to add “simnow”. For detailed procedure reference: https://www.fmz.com/bbs-topic/325

2. Create and Modify Strategies


On “Strategy” page: https://www.fmz.com/m/strategies, click “Add strategy”. In order to demonstrate that we can directly copy a strategy, you can find the public strategy of “Push the price information to telegram” in the teaching strategy of “Square” (the address: https://www.fmz.com/strategy/125482), click and cope the strategy.

The figure below shows the copied strategy, in which there is a “|” in the strategy name to separate Chinese name and English name. If you want to publish a strategy with an English name, you can also use this method. Parameters are global variables that can be directly quoted in strategy codes. The strategy code is very simple. GetTicker() is used continuously to obtain the latest price in an infinite loop. When the push standard is reached, a message is pushed to WeChat (you need to bind a WeChat account on the FMZ website). Click “Create” to see this strategy in your own library. img

If the strategy is modified, you only need to save the strategy and restart the strategy bot, which will makes the modification valid.

3.Deploy Dockers


Docker page: https://www.fmz.com/m/nodes. As mentioned earlier, the user’s bot is not run by the FMZ platform, but by the user himself, so a program that executes the strategy is needed, which is called docker. Dockers can be run on Linux\Mac\Windows. Note that since almost all cryptocurrency exchanges cannot be used in China, the docker needs to run on an overseas server. Users can choose a server provider to buy a Linux server (the system can generally choose centos), and the server can choose Amazon, Google and digitalOcean, etc. If you do not have a dual currency credit card, you can also choose a service provider that supports Alipay. The server configuration generally selects the lowest, and the price is about 1 yuan per day.

Buying a server may seem difficult, but it is a necessary step in cryptocurrency quantification, and here is a detailed purchase demo. If you feel that overseas companies are troublesome, you can also choose Alibaba Cloud Hong Kong server. If you still find it troublesome, you can rent it directly from FMZ Quant platform on time just with one click. FMZ will rent a new server directly from Alibaba Cloud and other server manufacturers and automatically deploy the user’s docker, which is the simplest but relatively expensive. Refer to the detailed steps for specific Linux server deployment and upgrade: https://www.fmz.com/bbs-topic/2848

For commodity futures users, you can directly rent Alibaba Cloud servers in Shanghai or Hangzhou on a monthly basis at a price of 40 yuan per month. The price has been compressed to the lowest level (it is basically the same price as the renting price by yourself), which can save you the trouble of renting servers and management by yourself. Dockers can also upgrade with one click, which is highly recommended. img

Since the demo is a virtual exchange, it can be directly deployed on your own computer (for commodity futures, you can also use your own computer). Select the 64-bit interface version, right-click after decompression, and run the robot program with administrator privileges. Fill in the address on the website (each user is different, so check on the docker page after logging in) and the FMZ website password information into the program; click Run, if you can see 2019/08/09 12:03:30 Login OK, SID: 90706, PID: 31376 and other words, which indicates that the operation is successful. You can see the logs file in the docker directory, and the bot logs will be saved there. In the docker management interface, you can see the docker you just deployed.

img

If the bot program doesn’t need particularly high performance, a docker can run multiple bots (the minimum configuration of the server is no problem to run more than a dozen bots). Note that a server can also deploy multiple dockers, but it is generally not required. The docker communicates with the FMZ website and, return the bot status and control the bot. Due to problems with overseas servers and domestic communication, the docker will occasionally be prompted offline, but it doesn’t affect the actual operation of the bot. If a docker is completely offline, it will not be able to operate the bots run by it, so this docker needs to be deleted. If the old docker doesn’t support adding new functions, an announcement will be issued, and users can choose to update according to their needs.

4.Create and Manage Bots


After the above work is completed, a bot can be actually run. On the bot page ( https://www.fmz.com/m/robots), click “Add bot”, and the following settings will appear: img

When creating a bot, you need to set a specified strategy, a specified running docker, an platform and a trading pair to be operated, the default K-line period, and strategy parameters, etc. A bot can add trading pairs of multiple platforms, and can also control multiple trading pairs of the same platform. If the required trading pair is not found in the combo box, you can click custom to enter it manually. Except for the running strategy, other parameters all can be modified on the page of a specific bot.

After creating a bot, you can find it on the bot page, and click to enter the running bot. img

So far, we have created a bot. Is it very simple?

Detailed Explanation of Specific Platform Functions

The first is the main page of dashboard after logging in, of which the side and top are the navigation bars, which will be introduced one by one as follows. img

  • Dashboard: the operation interface for users. https://www.fmz.com/m/dashboard
  • Square: the strategy square, where users open and sell strategies, and you can click the relevant labels to select the corresponding strategies.
  • View: the interface where users make public the running bots, and view the bots with comments. https://www.fmz.com/live
  • Digest: some high-quality articles produced by FMZ official. https://www.fmz.com/digest
  • Forums: where users propose questions and communicate. https://www.fmz.com/bbs
  • Offers: a platform where users publish their needs or ghostwrite codes for others; all is handled and charged by users themselves, and FMZ official doesn’t guarantee anything.
  • API: a document to introduce the APIs needed by the strategies written by FMZ; you can search here if you have any question abut API.
  • Strategy: where all the strategies locate.
  • Platform: all the platforms added.
  • Docker: all the dockers added.
  • Bot: all the bots run, including the stopped ones.
  • Debug tool: conveniently debugging part of codes, without creating bots.
  • Trade: the trading interface of simple manual operation.
  • Research: supporting to use jupyter notebook to operate strategy research.
  • Bills: payment and consumption records.
  • Message: all types of message notifications.
  • Ticket: a ticket can also be directly sent to propose questions, in addition to proposing questions on forums.
  • Database: the saved K-line and bot-level data, for convenient browsing and saving.
  • Analyze: to simply calculate and analyze the market quotes.

Bot Management


img

  • 1.The name of the bot, click to enter the bot management page.
  • 2.The group name of the bots, which is convenient for managing a large number of bots.
  • 3.The name of the strategy that the bot runs.
  • 4.The status of the bot includes four: running, stopped, completed, and error occurred.
  • 5.The actual profit does not necessarily represent the profit data, so that the user can output it himself, which can represent any data.
  • 6.Share the bot, which can be seen by other users in the Share.
  • 7.Monitor the bot, and automatically push messages after the bot stops.
  • 8.Stop or restart the bot.
  • 9.The current account balance and the executable time of the bot.
  • 10.Manage the grouping of strategies.

Strategy Management


img

  • 1.strategy name.
  • 2.Group name.
  • 3.strategy action options, such as share, rent, sell, etc.
  • 4.Add and manage new groups; you can group different types of strategies for easy management.

Strategy Writing Interface Description


Strategy writing can be done on the FMZ website or remotely. The strategy parameters will be explained in next tutorial. img

  • 1.Click here to enter “Backtest”; the detailed instruction about backtest will be shown in the elementary tutorial of strategy writing.
  • 2.The choice of strategy language, which cannot be switched after creating the strategy.
  • 3.Strategy name.
  • 4.“Note” is the record for strategy writing, only seen by user himself; “Description” is the strategy description, which can be seen by others on the strategy page, when the strategy is shared to public; manual
  • 5.Strategy type, including common strategy and template; about template, you can refer to API doc at: https://www.fmz.com/api#模板类库
  • 6.Save: a shortcut can be enabled by “Ctrl+S” during editing.
  • 7.Save Settings: the function will save the backtest parameters in front of the code, and when you restart the strategy, the backtest settings are still not changed.
  • 8.Download: download the code to the local disk.
  • 9.Import & Export: as the names suggest, they means importing and exporting the strategy, including strategy parameters and settings.
  • 10.Theme: different code backgrounds and color styles.
  • 11.JS Format: sort the code automatically.
  • 12.Open Vim Mode: Vim is a common editor without interface, with powerful function. Full screen plus Vim equals a dedicated master.
  • 13.Remote Edit: the function includes the commonly used code editing plugin, which enables local strategy writing and automatic synchronization to FMZ. Specific instruction: https://www.fmz.com/api#远程编辑
  • 14.To choose the template you want to use, you need to copy the template in the strategy square.
  • 15.Strategy Parameters: the parameters will be introduced in details in next tutorial.

Share or Sell Your Own Strategies


img

In the combo box of “Action”, you can see “Public” option, which includes internal share and public share, and the internal share process is shown as follows:

At last, a copy link will be generated, and others can just open the link and enter the copy code, to obtain the strategy source code and parameters.

img

If you choose to share to public, your strategy will be displayed in the “Square”, and all the users can see it.

There are three ways of “Sale”, including “Internal Sale”, software registration and “Public Sale”. The difference from pubic strategies is others cannot obtain the strategy source code by the copy link, and they can only run the bot by the strategy.

Internal sale is the most common way. If there are strategies that you want to share to others solely (which doesn’t have to be charged), you can choose internal sale, and fill out the validity period and concurrent amount. If the public sold strategies are shown in the charged strategies, the bots of the strategies shall be verified and open to public for a while.

Trade


“Trade” is a web version of trading page, where you can add all platforms manually by yourself. img

  • 1.For the docker who executes the instruction, account information, orders, etc. must be sent to the docker for execution.
  • 2.Select the platform and trading pair.
  • 3.Part of the market is pushed by the FMZ website. At this time, the high-speed channel is prompted. For data that has not been pushed, you can choose to refresh manually or periodically.
  • 4.Market K-line.
  • 5.Account information; refresh regularly or manually.
  • 6.Manual order page.

Account Management and Payment


Through the navigation bar on the left, enter the payment page, and the specific instructions are as follows: img

Click the account avatar in the upper right corner of the website to enter the account settings, and manage your own FMZ account on this page. Here is a brief introduction about it.

  • Message: the summary of all messages, including notify messages and ticket messages.
  • Google twofactor: it’s better to enable the second verification of Google, to improve the security.
  • Threshold Alert: When the available balance of the account is less than this value, you will receive mail and WeChat notification. Set 0 means disable this function; if there is no recharge or change this setting, it will be notified only once within 24 hours.
  • Push Settings: here you can bind WeChat, Telegram and email, etc., to receive the push messages from bots.
  • ApiKey: FMZ has its own API; basically, almost all operations of bots can be finished through API, which provides diversified extensions.
  • Sub-Account: it’s a function to create sub-account with limited permissions, which is used to modify the shared account for strategy.
  • Affiliate: Invite friends to sign up FMZ platform and you can get points when you recharge, the format of the affiliating link as follows: https://www.fmz.com/sign-up/1247886. Specific instruction: https://www.fmz.com/bbs-topic/3828.

More