Builders
Python crypto bots with ccxt
With the trading bots option, Edgoro writes complete crypto trading bots in Python 3.11 or later, built on ccxt, the open-source library that connects to most crypto exchanges. Without other instructions a bot targets Binance spot; you can ask for Bybit, OKX, Kraken or another ccxt exchange. Every bot is written to start in paper mode and reads your API keys from a .env file on your machine. The code is checked with Python's py_compile, which catches syntax errors only, with up to 2 automatic fix requests per conversation.
On this page
What you get
- bot.py: the complete bot in one
pythoncode block. - requirements.txt: limited to
ccxt,pandasandpython-dotenvunless more is truly needed. Indicators are computed with pandas (EMA, Wilder RSI, ATR), so there's no TA-Lib to install. - How it works: data, entry, exit, risk and filters in plain English.
- Run it safely: the numbered steps below.
Python code blocks have a Copy button (the Download button is for .pine and .mq5 files).
Defaults the bot is written with
These are the builder's instructions to the AI, so check them in the file before you run it:
- Keys only from environment variables (
os.getenvwith python-dotenv), never written in the code. ccxt.<exchange>({"enableRateLimit": True, ...}),PAPER = Trueby default (orders are logged instead of sent), andexchange.set_sandbox_mode(True)when the exchange has a testnet.- Candles from
fetch_ohlcvinto pandas; one action per closed candle; one position per symbol. - Size from your risk (
RISK_PCTof the free balance and the stop distance), within the exchange's limits and rounded withamount_to_precisionandprice_to_precision. - Stop-loss and take-profit managed by the bot, or by exchange parameters when supported; a daily loss limit.
- Retries on
ccxt.NetworkError, clear logging, and a clean exit on Ctrl+C.
What the syntax check covers
When the answer is complete, the python block is sent to Edgoro's compile service, which runs Python's py_compile on a temporary file and deletes it. The same access rules as MQL5 apply: a plan with the trading bots option, up to 60 checks per hour.
- "Python syntax checked: 0 errors" means the file parses as valid Python.
- If it doesn't, the error and its line go back to the AI automatically, up to 2 automatic fix requests per conversation.
py_compile doesn't install the requirements, import ccxt, connect to an exchange or run the strategy. API permissions, minimum order sizes, symbols an exchange doesn't list and regional restrictions only show up when you run the bot, which is why it starts in paper mode.
How to run it
- Install Python 3.11 or later.
- Create an exchange API key with trading permission only: withdrawals disabled, and an IP whitelist if the exchange offers one. Testnet keys are separate from live keys.
- Put the keys in a
.envfile next tobot.py. - Run
pip install -r requirements.txt. - Start on the testnet or in paper mode:
python bot.py. - Live trading starts only when you set
PAPER = Falseyourself.
The bot runs wherever you start it, on your computer or a VPS. Edgoro never asks for your exchange keys and doesn't host bots.
Related pages
- Crypto trading bot generator
- Python crypto bot with ccxt
- Crypto futures sizing and liquidation
- Crypto position calculator
- Trading fee calculator
Trading involves substantial risk of loss and is not suitable for every investor. Edgoro is a software tool, not a broker or financial adviser: nothing it produces is investment advice, and past or backtested performance does not guarantee future results.
Something wrong or missing? Email contact@edgoro.com