1.1 Getting Started¶
FMZ is an automated trading platform for cryptocurrency traders with support for many bitcoin/eth/altcoin exchange markets. We has a complete tutorial for beginners, such as https://www.fmz.com/bbs-topic/3649 . Only need studying a couple of days, you are ready to code for your own robot.
What can FMZ do for me?
You can learn how to write your bots(strategies) from our strategies’ square which contains lots of open source code, share your strategy’s code with others, ask for professional help any time, run your strategy on any exchanges, contorl your bot on website with computer or cellphone, sell your strategies if you want, communicate with many other auto-trading lovers in our group. In a word, FMZ is a perfect platform for those who want do automated trading.
Which Cryptocurrency exchanges does FMZ support?
FMZ supports almost all exchanges that are popular, such as Binance, Bitfinex, Bitstamp, OKEX, Huobi, Poloniex,etc. you can also trade futures on OKEX and BitMEX. Check a full support list on 2.2.1 Add Exchange. You only need to write one strategy and run it on all exchanges without any changes.
What kinds of programming languages can I use to write my strategies?
What is the docker?
The docker is a program that runs on your own Internet Server, which in charge of the data request, data reception, network link, Log review etc. You can treat it like your strategy’s executor. Even if the FMZ server offline (breakdown, etc.), it will have no influence on your robot that is running. The Manager can run on variety of operating system. Such as Windows, Linux, Mac OS, Android, Raspbian, etc.
1.2 The Backtest System¶
What is backtest system? What it uses for?
When you completed a quantitative strategy, how do you know that the logic, amount and direction of profit of this strategy goes? Does it work? Apparently, we wouldn’t use the real money to test our strategies on the real market. But we could use the historical data to test it, see how it works out on the time, profit, and asset management in the past. It is winning or losing? How to use the Backtest System?
Does the number from the backtest system accurate? The results can be trusted?
FMZ divides the backtest system into real market level and simulation level. The real market level contains the whole completed historical data back testing.
The simulation level contains the k-lines data at regular intervals. Both level are based on the real market historical data. Only the real market level is more accurate and the results are more reliable.
The simulation level Backtest System explanation.
Notice that backtesting is the strategy only preform in the past. Historical data doesn’t represent the future. History may replay, it also may lead to the black swan. Please treat the backtest results reasonable and objectively.
1.3 FMZ Instruction Manual¶
If you are new to trading, you need to understand a few basic concepts:
KEY-WORD: “Futures”, “Spot”, “Stock”, “Position”, “Long”, “Short”, “Balance”, “Margin Call”, “Hedge”, “K Line”, “MACD”, “Ask / Bid”.
1.3.1 A quick look of the main page¶
After learning the most basic concepts, let’s start using FMZ to explore the quantitative world. (Building your own quantitative trading system is a very large project, you need to have considerable computer knowledge and skills, fortunately, FMZ has done this for you!)
Register your FMZ account,Log in to https://www.fmz.com.
First time to log in the website, it looks like this:
- 1.Your main control page
- 2.Manage all your bots (start,stop,delete,open,etc)
- 3.Manage all your strategies’ code
- 4.Deploy and manage your docker
- 5.Add new exchanges
- 6.Manual trading on the exchanges you added
- 7.Pay your bill
- 8.Ask any question here
- 9.FMZ’s simulated exchange
- 10.Debug tool where you can run a block of code without start a bot.
- 11.All kinds of message
- 12.Strategy square where open-source and charging strategies are listed
- 13.Live Robots where all live-running bots are listed.
- 14.Forums where you can post a post to discuss any question related.
- 15.Ask for someone to write code for you or provide this service for others.
- 16.Products for exchanges and agencies.
- 17.API documentation.
- 18.Some useful tools, check for yourself.
- 19.Your account information.
1.3.2 Deploy the docker¶
First of all, FMZ’s framework is very advanced, the user’s robot program (that is, the automated trading program) is running on the user’s own computer (of course, it can also be run on the cloud server), So, it’s very safe (don’t need worry about the FMZ website breakdown etc.), the user has direct control over the program.
Docker is a program that run your robots and communicate with FMZ website. You need to run a Docker first before start a real market robot.
It is highly recommended to use the cloud server for runing program stably, such as Amazon or Google Cloud Server.
In the Dashboard page–
Add docker button, you can link to the download page https://www.fmz.com/m/add-node.
Here are steps to deploy the dockr in a Linux server(centOS 6):
- Buy a cloud server (VPS) from Amazon or Google, the lowest and cheapest configuration is enough. you may often has a free try for a long time.
- Login your server, fellow the instruction from your server provider or Google.
- Chose the docker that statisty your system version, most of the time, it is 64Bit.
wget 'http://q.fmz.net/dist/robot_linux_amd64.tar.gz', command not found? install first
yum install wget -y.
tar -xzvf robot_linux_amd64.tar.gzto unzip.
./robot -s email@example.com:9902/xxxxxx -p yourFMZpassword, you should see something like
2018/07/05 05:04:10 Login OK, SID: 62086, PID: 7226, Name: host.localdomain, which means everything is worked.
firstname.lastname@example.org:9902/xxxxxxis unique to every users, find your own on https://www.fmz.com/m/add-node.
- Now the docker isn’t run in the background, if you close the SHH client, the docker will stop.
ctrl + Cto stop the docker.
nohup ./robot -s email@example.com:9902/xxxxxx -p yourFMZpassword &to run in the background. this step can also be done by
- Check on https://www.fmz.com/m/dashboard, if everything is OK , you can find the docker deployed.
Steps to update the docker:
If you want to keep the old docker, one server can run many dockers, just create a new folder and repeate the deploy steps.
- Stop all robots that run on the docker.
- Delete the docker from FMZ website. the docker will stop on your server too(don’t have to, you can run two dockers on one server, just create a new folder)
rm -rf robot_linux_amd64.tar.gzin your dokcer files to delete the old docker.
wget http://q.fmz.net/dist/robot_linux_amd64.tar.gzto download the lastest docker.
- Repeate the steps above.
- Change robot’s config to use the new docker, restart robots.
One docker can run many robots, however, you can deploy more than one dockers on different server for speed or request-rate-limit consideration. the docker can be specified or auto-distributed when start a robot.
There are two public dockers for testing. don’t use them to run your robot on real market.
1.3.3 Add exchanges¶
Add your exchanges at this page: https://www.fmz.com/m/add-platform.
Binance, Bitfinex, Huobi(huobipro), OKEX, Futures_OKCoin(OKEX), Futures_BitMEX, Poloniex, Bitstamp, Wexapp(FMZ Simulation Exchange),AEX, BigONE, BitFlyer, Bithumb, Bitpie, Bittrex, CoinEx, CoinPlus, Coincheck, Coinone, Futures_CTP, Futures_Deribit, Futures_Esunny, GateIO, HitBTC, KEX, Korbit, Kraken, LiveCoin, OKCoin_EN, Quoine, WEX, ZB, Zaif.
Access Key and
Secret Key is needed, you should apply on your exchange first.
Once the exchange is added, you can find it on Dashboard https://www.fmz.com/m/dashboard.
New exchange supported is keep being added. you need to update the lastest docker to support new exchange.
1.3.4 Write or copy a strategy¶
There are lots of details this docs doesn’t cover, you can explore by yourself, most of them are simple and clear. You can always post on our forum if you have any question.
Write your own strategy by clicking
You can choose different code languages and backtesting
Copy and backtest:
Now your can find this strategy on your dashboard strategies list. https://www.fmz.com/m/dashboard
Edit your code here, don’t forget to save your code:
- 1.Edit your code
- 2.Backtesting, we will cover this part on an intermediate tutorial
- 4.The title, “|” splits Chinese and English title, which one will be showed is decided by the language of FMZ website
- 5.The type of your strategy, the default is common
- 6.The category of your strategy. You can divide your strategies into different categories if you have too many
- 7.Remote editing your code from your own IDE instead of our website
- 8.A link to the API doc
- 9.Notes of the strategy(only be seen by yourself). you can record the thoughts here.
- 10.Descriptions of the strategy. Others will see the descriptions if you share or sell your strategy on Square.
- 11.Manual of the strategy, can only be seen when someone bought your strategy.
- 12.Save your code, or
Ctrl+Son edit mode.
- 13.Save the backtesting config on the code.
- 14.Download the strategy file
- 15.Export and import the strategy while keeping all the parameters
- 16.Change the font size and edit the theme
- 17.Format the code automatically
- 18.Use VIM mode to edit.
Change and add global variables here:
1.3.5 Backtest your strategy¶
Click Stragegy name to strategy page.
Go to backtest page:
Add exchange and config your strategy:
Start Backtest to start.
1.3.6 Run a robot on Wexapp¶
Wexapp is FMZ Simulation Exchange, which is basically the same as a real exchange but free of charge, you can run your robot on FMZ Simulation Exchange for testing your strategy.
First, you need to deposit assets on your simulation account on https://www.fmz.com/m/sandbox.
Add Robot or https://www.fmz.com/m/add-robot to run a robot.
Config page as below:
You can find your robot is running on dashboard Now.
Go to robot page:
You can check the robot’s status and Logs, change the configs(need to stop robot first),
1.3.7 Charges Notes¶
0.125 RMB per robot per hour(around 0.018 USD).
robot run on FMZ Simulation Exchange(Wexapp) is free.