Leveraged grid-trading bot using CCXT/CCXT Pro library in FTX exchange.

Overview

Leveraged-grid-trading-bot

The code is designed to perform infinity grid trading strategy in FTX exchange.

The basic trader named Gridtrader.py control the number of grids dynamically using the setting in JSON file.

asyncGridtrader.py will do the same job asynchronously.

Trader with database support, Gridtrader_with_db.py and asyncGridtrader_with_db.py, will store the transaction info in database via mysql.

If the trader termineated accidentally, the next execution of trader will follow the history stored in the database.

It is recommended to execeute the code in Linux system with Python version 3.7+.

The bot will show the following information in log file:

  1. Cash flow
  2. Realized profit, averaged profit per day (Not including fee)
  3. Total volume, averaged volume per day
  4. Maker ratio in filled orders
  5. Number of filled orders
  6. Transaction fee

How leveraged?

Most of the funds is locked in normal grid trading bot, while this bot will only create limit orders near the market price (controlled by parameters in setting file). Under this circumstance, the profit can be much greater for short-term price volatility by increasing the transaction frequency. The funds may not be enough to afford the infinity grid trading under the same parameter settings, so it can be regarded as leveraged trading policy.

Reguired packages

For async-supported version:

For database-supported version:

Cheatsheet

pip install pytz ccxt simplejson asyncio mysql-connector-python

Setting.json

This grid trader will create at least grid_level and at most 2x grid_level numerber of grids for buy/sell, respectively. That is, the trader will make sure the number of orders for buy and sell are both not less than grid_level and also not greater than 2x grid_level.

The price difference of grids is set as interval_prof . For each transaction, the amount is set as amount.

Getting started

  1. Rename setting.json.sample to setting.json (Not required).
  2. Edit the parameters in setting.json
  3. Run the command (See examples).

Cautions

It is recommended to create a subaccount to use this trading bot to avoid your orders being cancelled by the bot at the beginning.

Examples

Without async support and without database

python3 GridTrader.py your.setting.json

This command execute GridTrader.py with json file named your.setting.json.

python3 GridTrader.py

This command execute GridTrader.py with json file named setting.json.

For other version of trader, change the Gridtrader.py to others in above commands.

Log snapshots (ETH/USD)

Aug 05 2021 17:37:11, ##########.Trading Info.##########
Trade balance: -218.06 USD, +0.1000 ETH
Return: 54.3300 USD, 20.6422 USD/Day
Volume: 93891.71 USD, 35673.27 USD/Day
Maker ratio: 96.50%, Total: 3681
Fee: 2.12847845 USD, 0.00000000 ETH
##########.##########.##########.##########.##########
Aug 05 2021 17:37:34, buy at 2588.4, place new sell at 2591.4.
Aug 05 2021 17:37:35, Enlarge grid for buy at 2468.4
Aug 05 2021 17:37:35, ##########.Trading Info.##########
Trade balance: -243.94 USD, +0.1100 ETH
Return: 54.3300 USD, 20.6401 USD/Day
Volume: 93917.59 USD, 35679.49 USD/Day
Maker ratio: 96.50%, Total: 3682
Fee: 2.12847845 USD, 0.00000000 ETH
##########.##########.##########.##########.##########
Aug 05 2021 17:37:39, buy at 2585.4, place new sell at 2588.4.
Aug 05 2021 17:37:39, Enlarge grid for buy at 2465.4
Aug 05 2021 17:37:44, buy at 2582.4, place new sell at 2585.4.
Aug 05 2021 17:37:44, Enlarge grid for buy at 2462.4
Aug 05 2021 17:37:53, sell at 2585.4, place new buy at 2582.4.

Buy me a coffee

BTC address: bc1qdqw277tqsqv0jqsc3hk4h2rwfa6zvfel2j09xe

ETH address: 0xCD5ea947424EaC5c277AbA8EcEDB1Ee760aBd265

FTX Pay

You might also like...
Crypto-trading-simulator - Cryptocurrency trading simulator using Python, Streamlit
Crypto-trading-simulator - Cryptocurrency trading simulator using Python, Streamlit

Crypto Trading Simulator Run streamlit run main.py Dependency Python 3 streamli

Autov2new - Pro Auto Filter Bot V2
Autov2new - Pro Auto Filter Bot V2

Pro Auto Filter Bot V2 Deploy You can deploy this bot anywhere. Watch Deploying

`python-jamf` is a library for connecting to a Jamf Server that maps directly to the Jamf Pro Classic API.
`python-jamf` is a library for connecting to a Jamf Server that maps directly to the Jamf Pro Classic API.

`python-jamf` is a library for connecting to a Jamf Server that maps directly to the Jamf Pro Classic API. It is the basis for the `jctl` tool to automate patch management & packages and many other items.

Stock trading bot made using the Robinhood API / Python library...

High-Low Stock trading bot made using the Robinhood API / Python library... Index Installation Use Development Notes Installation To Install and run t

Ethereum Gas Fee for the MacBook Pro touchbar (using BetterTouchTool)
Ethereum Gas Fee for the MacBook Pro touchbar (using BetterTouchTool)

Gasbar Ethereum Gas Fee for the MacBook Pro touchbar (using BetterTouchTool) Worried about Ethereum gas fees? Me too. I'd like to keep an eye on them

Coinbase Pro API interface framework and tooling

neutrino This project has just begun. Rudimentary API documentation Installation Prerequisites: Python 3.8+ and Git 2.33+ Navigate into a directory of

Upbit(업비트) Cryptocurrency Exchange OPEN API Client for Python
Upbit(업비트) Cryptocurrency Exchange OPEN API Client for Python

Base Repository Python Upbit Client Repository Upbit OPEN API Client @Author: uJhin @GitHub: https://github.com/uJhin/upbit-client/ @Officia

Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of delivery for realtime exchange data and other financial information. This repository provides an SDK for developing applications to access the NCDS.

Nasdaq Cloud Data Service (NCDS) Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of delivery for realtime exchange data and ot

Releases(demo.v1)
Owner
Hao-Liang Wen
Hao-Liang Wen
Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI

Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI. Used REST and WebSocket API to connect to two of the most popular crypto exchanges in the world.

Francis 8 Sep 15, 2022
FTX auto lending bot with python

FTX auto lending bot Get the API key Check my article for step by step + screenshots Setup & Run Install python 3 Install dependency pip install -r re

Patompong Manprasatkul 1 Dec 24, 2021
Andrei 1.4k Dec 24, 2022
A muti pairs martingle trading bot for Binance exchange.

multi_pairs_martingle_bot English Documentation A muti pairs martingle trading bot for Binance exchange. Configuration { "platform": "binance_futur

51bitquant 62 Nov 16, 2022
Trading bot - A Trading bot With Python

Trading_bot Trading bot intended for 1) Tracking current prices of tokens 2) Set

Tymur Kotkov 29 Dec 1, 2022
Utilizing the freqtrade high-frequency cryptocurrency trading framework to build and optimize trading strategies. The bot runs nonstop on a Rasberry Pi.

Freqtrade Strategy Repository Please test all scripts and dry run them before using them in live mode Contact me on discord if you have any questions!

Michael Fourie 90 Jan 1, 2023
This program is an automated trading bot that uses TDAmeritrades Thinkorswim trading platform's scanners and alerts system.

Python Trading Bot w/ Thinkorswim Description This program is an automated trading bot that uses TDAmeritrades Thinkorswim trading platform's scanners

Trey Thomas 201 Jan 3, 2023
Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Alexandr Savinov 326 Jan 3, 2023
BT CCXT Store

bt-ccxt-store-cn backtrader是一个非常好的开源量化回测平台,我自己也时常用它,backtrader也能接入实盘,而bt-ccxt-store就是帮助backtrader接入数字货币实盘交易的一个插件,但是bt-ccxt-store的某些实现并不是很好,无节制的网络轮询,一些

moses 40 Dec 31, 2022