High frequency trading means using machine and algorithms to trade. There are some obvious upsides like trading in your sleep and not being conditioned by emotions. On the other hand you have to know what you are doing, you are trusting a machine with your money.
What You Will Need
In this quick tutorial you will install your first trading bot. Don’t worry, you will be able to do a dry run without any money. You will need an account on bittrex.com though. Just go on the website and create your account, it won’t take long. Other than this we are using Telegram. Telegram is like WhatsApp but better: for once, it allows us to create a chatbot. We will use this as a textual interface to interact with our trade bot.
Install the Dependencies
This bot is written in Python 3.6. It will use SQLite to store data, TA-Lib for technical analysis of the market. If you are on macOS you can install everything with brew:
1 |
brew install python3 ta-lib sqlite |
Otherwise you should go to their respective web pages and follow the instructions for your operating system: TA-Lib, Python, SQLite.
High Frequency Trading Bot
We are going to use https://github.com/gcarq/freqtrade as a bot.
- On a command line clone the repository with
git clone [email protected]:gcarq/freqtrade.git
- Optional: if you want to work on the same commit at the time of writing do
git checkout 72432c1
- Go inside the directory you just cloned with
cd freqtrade
and copy the configuration file with
1cp config.json.example config.json - Open the config.json file with your favourite editor
- We are now going to insert in this file your personal bittrex account:
- You will need to instert your bittrex account data in the following snippet
1234"bittrex": {"enabled": true,"key": "key","secret": "secret",
Go in your bittrex Settings page and choose the API Keys tab - Add a new key with all the privileges except for withdraw
- Copy and paste the key and the secret in the configuration file
- You will need to instert your bittrex account data in the following snippet
- Next we need to create a Telegram bot:
- Start a conversation with the BotFather in your Telegram
- Type
/newbot
to create your new bot, you will be asked to give it a name - Take note of the token you receive, you will need it for the config file
- You will need you Telegram id, start a conversation with get id
- Type
/start
and it will tell you your chat id, take note for this too
- Back in the configuration file fill in the information you just got in the following lines
1234"telegram": {"enabled": true,"token": "token","chat_id": "chat_id" - In the configuration file you have the ability to set a dry run variable, if you set it to true the bot will simulate trades but it will actually not move any money. It’s highly suggested to set it to true.
- Once you’ve done this, in the
freqtrade
directory you can type the following commands to launch your bot.
12345python3 -m venv .envsource .env/bin/activatepip install -r requirements.txtpip install -e ../main.py
Trying Out Your High Frequency Trading Bot
Once your bot starts you should see something similar to this in your Telegram client.
The bot will pick up on buy and sell cues and will trade for you. The command /status will list the active trades. The bot will buy on a bull signal and sell after some time if there is some profit. Otherwise it won’t to anything with a stop loss at 10%. This means that the bot will always sell if you are losing too much. You can however tweak all these parameters, more information in the README file.
Support us:
- LTC Address: La5f6W1rPr5VHFGCrCmPJ3sSa2AiwKZJbU
- BTC Address: 1FG1j42MUze8jiW7JbgNaUMZxZeu7M1b4f
- Ripple Address: rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy Tag: 562614972
- ETH Address: 0x0940958167ca9cbd6409999957a011be7907d904
Thanks for the post. When/How will it get a buy signal?
A buy signal is given based several technical analysis indicators. TA-libs provides those indicators. One of them is MACD.
Thank you for the post!
All things goes OK until that –>
$ source .env/bin/activate
bash: .env/bin/activate: No such file or directory
What can it be?
Think you are missing some dependencies.
Don’t use a script, manually do the following steps to troubleshoot:
1.) Virtual Python environement
python3 -m venv .env
2.) Configure and check the environment
source .env/bin/activate
Make sure you have virualenv and source installed
Have you tried switching from base stake BTC => ETH? How does this work
How can I install it on Windows?
Think you could make a video tutorial please, my english and understanding isn’t very good.