Python Crypto Trading Bot Development
AlgoDevelop does Python crypto trading bot development for traders who already know what they want the market to do. You bring the rules, or a rough idea we help you pin down. We write the bot against the exchange’s official API, test it on testnet and at minimum size, and hand over the full source code.
The finished bot runs on your server with your API keys. We never hold the keys, and nothing in the code reports back to us.
On this page
- What a custom Python crypto trading bot is
- Strategies we build in Python
- Custom build, open-source framework or a ready-made bot?
- Exchange rules the code has to follow
- Timeouts, reconnects and duplicate orders
- API keys stay on your server
- Backtest, testnet, then minimum size
- Running around the clock on a VPS
- What Python crypto trading bot development costs
- How a project runs
- Questions about Python crypto bot projects
What a custom Python crypto trading bot is
A bot of this kind is a program that keeps a connection open to an exchange. It watches what your strategy watches, then sends orders once your conditions hold. There is no MetaTrader and no chart in between, only your code and the exchange’s API.
Direct API access cuts both ways. At three in the morning the bot does exactly what the code says, mistakes included. Most of the work in Python crypto trading bot development therefore sits outside the strategy: order sizing, reconnects, restarts and logs.

Strategies we build in Python
- Signal execution: your indicator, a TradingView alert or your own model, turned into orders.
- Grid and DCA bots: laddered entries with defined exits, plus the position accounting that keeps them honest.
- Market making: quotes on both sides with inventory limits and skew.
- Portfolio rebalancing: target weights, rebalanced on a schedule or when they drift.
- Arbitrage: between exchanges, or between spot and a perpetual.
Simple price gaps between exchanges are mostly taken by firms that sit next to the matching engine. What a retail setup can still reach is usually funding-rate or basis capture, where the edge lasts days rather than milliseconds. If you have a specific trade in mind, we’ll say plainly whether your latency can get there.
Some clients also want a screen to watch. A Python crypto trading bot can run headless on a VPS, or it can come with a small web panel or a Windows app that shows positions, the journal and a pause button. A panel is extra scope, so it’s priced separately.
Custom build, open-source framework or a ready-made bot?
Not every project needs custom Python crypto trading bot development. Three routes cover most cases:
| Route | Good fit | Where it stops |
|---|---|---|
| Open-source framework (Freqtrade, Hummingbot, or a CCXT script) | You code, your strategy fits the framework’s model, and you’re happy to maintain it | Unusual order logic, several exchanges with different rules, or support when it breaks |
| Our ready-made bots | You copy Telegram calls or your own TradingView alerts to Binance or Delta Exchange | Your own strategy logic, other exchanges |
| A custom crypto trading bot | Your rules don’t fit a template, or you need specific risk controls, reports or a panel | It costs more than a licence and needs a written spec |
For copying signals, the Telegram to Binance bot, the Telegram to Delta Exchange bot, the TradingView to Binance bot and the TradingView to Delta Exchange bot already do the job on your own account, and each has a free 2-day trial. On Shark Exchange, the Shark Exchange copier mirrors one master account onto your other accounts.
If you’d rather write the bot yourself, our guide on how to build a crypto trading bot covers the seven steps, with a worked Binance order from signal to quantity.
Exchange rules the code has to follow
Our Python crypto trading bot development work targets each exchange’s official API: Binance, Bybit, OKX, KuCoin, Kraken, Coinbase and others, on spot or derivatives. The rules differ by exchange. Binance Spot is a good example of how specific they get, and its official API documentation is what we code against:
- Request weight is counted per IP, not per key. Two bots behind one server address share the same budget. Go over and Binance answers HTTP 429. Ignore that and it sends 418, an automatic IP ban that grows from 2 minutes to 3 days for repeat offenders. Both replies carry a
Retry-Afterheader, and the bot waits for it. - Order count is tracked separately, through
X-MBX-ORDER-COUNTheaders on each successful order.
Order filters and the server clock
- Every quantity must pass
LOT_SIZE: at leastminQty, at mostmaxQty, in whole steps ofstepSize. We round down. Rounding up would trade more than you meant. - Every price must sit on the
PRICE_FILTERtick size, and the order value must pass theNOTIONALfilter. For market orders, Binance checks that value against an average price, not the price your bot saw. - Signed requests carry a timestamp. If the server clock drifts outside
recvWindow(5,000 ms by default, 60,000 ms at most), Binance rejects the order with error -1021. - Spot and futures are separate APIs, with different margin rules. Perpetuals also add funding payments that a strategy may need to track.
Futures and perpetuals can be liquidated. Leverage is always your own setting.

Timeouts, reconnects and duplicate orders
Bots that run for a year rarely fail on the strategy. The usual failure is a dropped connection at the exact moment an order was in flight.
Binance’s documentation is direct about this: a timeout or a 5xx reply means the execution status is unknown, and the order may have gone through. A client order ID helps, but only partly. Binance treats newClientOrderId as unique among open orders. Once the first order has filled, the same ID can be accepted a second time. A bot that simply resends after a timeout can still double the position.
The fix is to look before resending. Here is the shape of that path in our code, trimmed to the essentials:
# Python 3.10+, requests 2.32 or later. Binance Spot REST: one market buy, safe on timeout.
import hashlib, hmac, os, time, uuid
from decimal import Decimal, ROUND_DOWN
import requests
BASE = "https://testnet.binance.vision" # Spot Test Network; live is https://api.binance.com
KEY = os.environ.get("BINANCE_KEY", "")
SECRET = os.environ.get("BINANCE_SECRET", "")
def signed(method, path, **params):
params["timestamp"] = int(time.time() * 1000)
query = "&".join(f"{k}={v}" for k, v in params.items())
sig = hmac.new(SECRET.encode(), query.encode(), hashlib.sha256).hexdigest()
return requests.request(method, f"{BASE}{path}?{query}&signature={sig}",
headers={"X-MBX-APIKEY": KEY}, timeout=10)
def round_qty(qty, step_size):
"""LOT_SIZE: round down to a whole number of steps, never up."""
step = Decimal(step_size)
return f"{(Decimal(qty) / step).to_integral_value(ROUND_DOWN) * step:f}"
def buy_market(symbol, qty, step_size):
cid = uuid.uuid4().hex # our own ID; log it before sending
try:
r = signed("POST", "/api/v3/order", symbol=symbol, side="BUY", type="MARKET",
quantity=round_qty(qty, step_size), newClientOrderId=cid)
if r.status_code < 500:
return r.json() # a fill, or a clear rejection such as a filter error
except requests.Timeout:
pass # status unknown, not failed
# 5xx or timeout: ask Binance what happened before doing anything else
return signed("GET", "/api/v3/order", symbol=symbol, origClientOrderId=cid).json()
What the delivered version adds
The rounding helper passed its own checks (0.0123456 with step 0.00001000 gives 0.01234000). We haven’t run this trimmed version against the testnet as shown. A delivered bot adds what the sketch leaves out. It checks minQty and NOTIONAL, reads the rate-limit headers and logs every request and reply. If Binance answers -2013 (no such order) straight after a timeout, it waits briefly and looks again.
Reconnects without guesswork
The same rule applies when the connection drops:
- A heartbeat catches silent drops. A WebSocket can stay open and still stop sending data, so the bot reconnects when nothing arrives for too long.
- Reconnect, then resubscribe. A new connection starts empty, so the bot rejoins every stream it had and backs off between tries.
- State comes from the exchange. After a reconnect or a restart, the bot asks what is open, what filled and what the balance is. Only then does it trade again.
- Maintenance is normal. The bot pauses, backs off and resumes.

API keys stay on your server
You create the keys in your own exchange account, and they live on the server that runs the bot. Testnet keys are enough for our build and test work; the live run at minimum size happens on your server, with keys only you hold.
- Trading on, withdrawals off. A new Binance key can only read until you switch trading on in API Management. Leave withdrawals off; a bot has no use for them.
- Restrict the key to the server’s IP. A leaked key is then useless from anywhere else.
- Use a sub-account where the exchange offers one, so the bot’s capital has a hard ceiling.
- Keep keys in environment variables or a secrets file outside the repository.

Backtest, testnet, then minimum size
A backtest on past candles proves the logic matches your rules. It doesn’t prove the fills, because order books are thin at the edges and real prices often differ from the candle close.
Our Python crypto trading bot development process has four stages: the backtest, the exchange’s testnet or paper mode where one exists, live at the smallest size the exchange allows, and only then your full size. On Binance Spot the test network has its own keys and its own address (testnet.binance.vision), so a test bot can’t touch real funds. You compare each stage’s log with the one before it and move on when they agree.

Running around the clock on a VPS
Crypto never closes, so a Python crypto trading bot normally lives on a small Linux VPS rather than a laptop. Each build ships with:
- Safe restarts. On start-up the bot reads its real position from the exchange, not from a file that may be stale.
- A process supervisor. On a plain VPS that’s a systemd service with
Restart=always; in Docker, a restart policy such asunless-stopped. The bot comes back after a crash or a reboot. - Rotating logs through journald or Docker’s log driver, with a size cap, so a busy month can’t fill the disk.
- Time sync with chrony or another NTP client, which keeps signed requests inside
recvWindow. - Alerts by Telegram or email when the bot stops, keeps failing or hits a limit you set.
- Kill switches: a daily loss cap, a maximum position and a maximum number of orders per hour. They stay off until you set them.
What Python crypto trading bot development costs
Our pricing page lists a Python crypto bot at $300 to $1,000+ as a typical starting range. It’s indicative. The fixed price comes after we read your spec, with the timeline and a written list of what’s included. What moves it:
- The number of exchanges and markets. Each one brings its own filters, limits and errors to test.
- Order logic. A single market entry is quick; grids, partial fills, trailing exits and hedging take longer.
- Speed needs. A WebSocket order book and sub-second reactions need more engineering than a Python crypto trading bot that acts on 15-minute candles.
- Extras such as a web panel, a Windows app, reports or several accounts.
Exchange fees, the VPS and any data subscription are yours to pay directly, in your own name.
On delivery you receive the full Python source with comments and a dependency list, a configuration file for every parameter, setup steps for your server and supervisor, and a plain guide to each setting. Support after delivery covers setup and reasonable adjustments. You own the code outright.
How a project runs
- You describe the strategy and the exchange. Say which market, spot or futures, and what the Python crypto trading bot should decide.
- We scope it and send a fixed quote. If something won’t work as described, we say so here.
- We build and test it on testnet or at minimum size.
- You review the logs before it trades at size.
- We deliver, document and support it.
Send your rules, the exchange and the market, and we’ll come back with a scope and a price. Ask for a quote. For a strategy you already trade by hand, see crypto trading automation. The trading bot development page lists everything else we build.
Trading crypto, especially with leverage, can lose you money quickly. A bot executes your rules; it does not make them profitable, and past results say nothing about future ones.
Questions about Python crypto bot projects
Which exchanges can you build for?
Any exchange with a documented public API. Binance, Bybit, OKX, KuCoin, Kraken and Coinbase are the usual ones. For a smaller exchange, send the API docs and we’ll check rate limits, order types and testnet support before we quote.
Is Python fast enough?
For strategies that act in seconds or minutes, yes. The bottleneck is usually the network round trip to the exchange, not Python. Racing co-located firms is a different business that Python alone won’t win.
Can I start from Freqtrade or a script I already have?
Yes. We can extend a Freqtrade strategy or take over your existing code, but we read it first. Sometimes fixing it costs less than a rewrite, and sometimes not.
Can you add a dashboard or user interface?
Yes, as a web panel or a Windows desktop app showing positions, the journal and controls such as pause. It adds scope, so it’s quoted with the bot.
What if an API key leaks?
Delete it in the exchange’s API Management first. Then create a new one, put it in the bot’s environment file and restart the bot so it loads the new key.
Will it trade futures and perpetuals?
Yes, through the exchange’s futures API, with leverage set by you. Perpetuals add funding payments, which the bot can log or include in its decisions.
How long does a build take?
Build time depends on scope. The timeline comes with the fixed quote, and a simple single-exchange bot is far quicker than a multi-exchange one with a panel.