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
SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather

SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather, the c

John Calhoun 372 Jan 02, 2023
Archive tweets and make them searchable

Tweeter Archive and search your tweets and liked tweets using AWS Lambda, DynamoDB and Elasticsearch. Note: this project is primarily being used a tes

Kamil Sindi 8 Nov 18, 2022
Telegram bot to host python bots

Host-Bot Setup the api Upload the flask api on your host #its not important to do #i used it just for simple captcha system + save ids on your host!

Plugin 15 Feb 11, 2022
Sniper for Anigame and Izzi discord bots!

Anigame Sniper Gen-3 Features Inbuilt Spammer Responds to your messages in discord (on/off) Snipes only where you want it to Set latency so that the b

22 Nov 13, 2022
Telegram Url Upload Bot With Same more Features ✨

Telegram Url Upload Bot With Same more Features ✨

Group Dc Bots 4 Feb 12, 2022
Declarative assertions for AWS

AWSsert AWSsert is a Python library providing declarative assertions about AWS resources to your tests. Installation Use the package manager pip to in

19 Jan 04, 2022
E-Commerce Telegram Bot for UCA Students

ucaStudentStore To buy from and sell to other students Features Register the first time, after that you will always be recognised You can login either

Shukur Sabzaliev 5 Jun 26, 2022
A auto clock-in script based on python3 for BJUTer.

Introduction A auto clock-in script based on python3 for BJUTer. It could clock in at 9:00 a.m everyday. The script is inspired by tsosunchia What can

X 7 Nov 15, 2022
Simulation artifacts, core components and configuration files to integrate AWS DeepRacer device with ROS Navigation stack.

AWS DeepRacer Overview The AWS DeepRacer Evo vehicle is a 1/18th scale Wi-Fi enabled 4-wheel ackermann steering platform that features two RGB cameras

AWS DeepRacer 31 Nov 21, 2022
Rich presence app for playstation 3. Display what game you are playing on the PS3 via Discord

PS3-Rich-Presence-for-Discord Discord Rich Presence script for PS3 consoles on HFW&HEN or CFW. Written in Python. Display what you are playing on your

17 Dec 11, 2022
Generate and Visualize Data Lineage from query history

Tokern Lineage Engine Tokern Lineage Engine is fast and easy to use application to collect, visualize and analyze column-level data lineage in databas

Tokern 237 Dec 29, 2022
Checks instagram names to see if they're available

How to install You must have python 3.7.6 installed and make sure you click the 'ADD TO PATH' option when installing Open cmd and type pip install aio

2 Oct 20, 2021
Configure your linux server and check for vulnerabilities with serverlla

serverlla Configure your linux server and check for vulnerabilities with serverlla. Serverlla has a menu with options and allows you to configure your

Dylan Meca 10 Feb 01, 2022
Balanced API library in python.

Balanced Online Marketplace Payments v1.x requires Balanced API 1.1. Use v0.x for Balanced API 1.0. Installation pip install balanced Usage View Bala

Balanced 70 Oct 04, 2022
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

Amazon Web Services - Labs 1.9k Jan 07, 2023
A Telegram Bot to return Youtube Video Tags Using YoutubeTags API

YouTube-TagFind-Bot A Telegram Bot to return Youtube Video Tags Using YoutubeTags API YoutubeTags API Wrapper YoutubeTags is a python third-party api

Nuhman Pk 9 Aug 25, 2022
Async client API for the Telegram Group Calls

PyTgCalls This project allow to make Telegram group call with MTProto Api using Pyrogram and WebRTC, this is possible thanks to the power of NodeJS's

185 Jan 03, 2023
Asynchronous wrapper for wttr.in weather forecast.

aiopywttr Asynchronous wrapper for wttr.in weather forecast. Synchronous version here. Installation pip install aiopywttr Example This example prints

Almaz 4 Dec 24, 2022
A simpler way to make forms, surveys, and reaction input using discord.py.

discord-ext-forms An easier way to make forms and surveys in discord.py. This module is a very simple way to ask questions and create complete forms i

thrizzle 16 Nov 06, 2022
Unirest in Python: Simplified, lightweight HTTP client library.

Unirest for Python Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by Mashape, who also maintain

Kong 432 Dec 21, 2022