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
Manage gmail account using python, forget about imap and just code what you supposed to do.

GGmail Manage gmail account using python, forget about imap and just code what you supposed to do. Help See documentation for more details. Install In

Dylan Do Amaral 6 Sep 23, 2022
A casino discord bot written in Python

Casino Bot Casino bot is a gambling discord bot I made for my friends. It is able to play blackjack, slots, flip a coin, and roll dice. It stores ever

Connor Swislow 27 Dec 30, 2022
Python bindings to the Syncthing REST interface.

python-syncthing Python bindings to the Syncthing REST interface. Python API Documentation Syncthing Syncthing REST Documentation Syncthing Forums $ p

Blake VandeMerwe 64 Aug 13, 2022
This is telegram bot to generate string session for using user bots. You can see live bot in https://telegram.dog/string_session_Nsbot

TG String Session Generate Pyrogram String Session Using this bot. Demo Bot: Configs: API_HASH Get from Here. API_ID Get from Here. BOT_TOKEN Telegram

Anonymous 27 Oct 28, 2022
SpaceManJax's open-source Discord Bot. Now on Github!

SpaceManBot This is SpaceManJax's open-source Discord.py Bot. Now on Github! This bot runs on Repl.it, which is a free online code editor. It can do a

Jack 1 Nov 16, 2021
🤖 Automated follow/unfollow bot for GitHub. Uses GitHub API. Written in python.

GitHub Follow Bot Table of Contents Disclaimer How to Use Install requirements Authenticate Get a GitHub Personal Access Token Add your GitHub usernam

João Correia 37 Dec 27, 2022
一个基于Python3的Bot。目前支持以Docker的方式部署在vps上。支持Aria2、本子下载、网易云音乐下载、Pixiv榜单下载、Youtue-dl支持、搜图。

介绍 一个基于Python3的Bot。目前支持以Docker的方式部署在vps上。 主要功能: 文件管理 修改主界面为 filebrowser,账号为admin,密码为admin,主界面路径:http://ip:port,请自行修改密码 FolderMagic自带的webdav:路径:http://

Ben 650 Jan 08, 2023
A simple Python wrapper for the Amazon.com Product Advertising API ⛺

Amazon Simple Product API A simple Python wrapper for the Amazon.com Product Advertising API. Features An object oriented interface to Amazon products

Yoav Aviram 789 Dec 26, 2022
Os-Remoter with Python (Telegram Bot)

Remote-Os Os-Remoter with Python (Telegram Bot) [1] First install "python -m pip install --upgrade pip" [2] Second install the modules inside file ins

Alisa Alikhani 2 Nov 09, 2022
0-1 knapsack with an additional constraint of maximum number of items used

extended_knapsack 0-1 knapsack with an additional constraint of maximum number of items used. Usage pip3 install extended_knapsack from extended_knaps

Lion Ralfs 1 Jan 06, 2022
The Python SDK for the BattleshAPI game

BattleshAPy The Python SDK for the BattleshAPI game Installation This library will be eventually going on PyPI, but until then, simply clone or downlo

Christopher 0 Apr 18, 2022
Python library to connect to Firebots API

This is a firebot library to connect to Firebots API. https://firebot.app/ From Firebots Website: "Firebot is a fully featured open-source bot that c

1 Jan 08, 2022
Tinkoff social pulse api wrapper

Tinkoff social pulse api wrapper

Semenov Artur 9 Dec 20, 2022
An advanced Filter Bot with nearly unlimitted filters

Telegram MTProto API Framework for Python Documentation • Releases • Community Pyrogram from pyrogram import Client, filters app = Client("my_account

Pyrogram 3.2k Jan 05, 2023
Authenticate your League of legends account on riot client in a few lines of code.

lol-authenticator v1.0.0 Content index Project Setup Dependencies Project Setup Dependencies Python v3.9.6 If you don't have Python installed on your

Cássio Fontoura 5 Aug 28, 2022
Upload-Instagram - Auto Uploading Instagram Bot

###Instagram Uploading Bot### Download Python and Chrome browser pip install -r

byeonggeon sim 1 Feb 13, 2022
Play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 🧪 Get SESSION_NAME from below: Pyrogram

Sehath Perera 1 Jan 17, 2022
IOGen - An Open source discord token generator

_____ ____ _____ |_ _/ __ \ / ____| | || | | | |

0xVichy#1234 85 Nov 03, 2022
Instrument asyncio Python for distributed tracing with AWS X-Ray.

xraysink (aka xray-asyncio) Extra AWS X-Ray instrumentation to use distributed tracing with asyncio Python libraries that are not (yet) supported by t

Gary Donovan 12 Nov 10, 2022
Telegram bot to trim and download videos from youtube.

Inline-YouTube-Trim-Bot Telegram bot to trim and download youtube videos Deploy You can deploy this bot anywhere. Demo - YouTubeBot Required Variables

SUBIN 56 Dec 11, 2022