Skip to content
← All projects

Crypto Trading Bot (FIDU)

Python bot that trades SOL/USDT on Binance Testnet from MACD, RSI and Stochastic RSI signals, with built-in risk limits.

Context
Personal project
Role
Solo project
Period
Jul 2025 – Aug 2025
Stack
  • Python
  • CCXT
  • TA-Lib
  • NumPy
  • python-decouple
  • PyInstaller

Context & problem

I built this for an independent trader on Binance who wanted to automate his trading so he wouldn't miss opportunities. I gathered his requirements and built the automation around the calculations he defined for the pair he chose, SOL/USDT.

The bot runs market analysis and executes buy and sell orders on its own, against Binance Testnet, so no real money is involved. Every buy and sell parameter is set manually by the user, not hard-wired into the strategy.

Constraints

  • Someone else's strategy. The trading logic had to follow the client's calculations, with buy and sell parameters the user sets.
  • Exchange API limits and clock drift. Exchange APIs reject requests with a skewed timestamp and limit how often a client can call. The bot enables CCXT's built-in rate limiting and re-syncs with Binance server time before each call.
  • Safety first. Sandbox (Testnet) mode is switched on in code, so a misconfigured run can't touch a real account.
  • Secrets out of the code. API keys live in a .env file, including when the bot runs as a packaged Windows executable.

Architecture

FIDU flow: Binance market data, indicator calculation, rule evaluation, then a buy or sell order
Architecture diagram. At each 5-minute candle close the bot syncs its clock with Binance, fetches the latest 100 candles, computes MACD, RSI, Stochastic RSI, EMA 9 and a volume average, then buys (up to 3 entries by default), sells partially or sells everything.
Open SVG in a new tab 

FIDU is a single Python process with five steps in a loop. The indicator settings and risk rules below are defaults: every buy and sell parameter can be changed by the user.

  1. Scheduler. Sleeps until the next 5-minute candle closes.
  2. Market data. Fetches the latest 100 OHLCV candles and the account balance through CCXT.
  3. Indicators. Computes MACD (12/26/9), RSI (14), Stochastic RSI, EMA 9 and a 10-period volume average with TA-Lib and NumPy (default settings).
  4. Rules. Evaluates the user-configurable buy and sell conditions against those indicators.
  5. Orders. Places market orders on Binance Testnet, then goes back to sleep.

Configuration and keys are loaded with python-decouple, and PyInstaller packages the bot as an .exe that still reads the same .env file.

Decisions & trade-offs

  • Requirements first. I started by gathering the client's requirements and turning his calculations into explicit buy and sell rules, instead of designing a strategy of my own.
  • Manual, configurable parameters. All buy and sell parameters are set by the user. He can tune the strategy without touching the code. The trade-off: the bot is only as good as the values it's given.
  • Candle-aligned scheduling instead of fixed polling. Every evaluation runs on a closed candle, so the signals don't change halfway through a candle. The cost is latency: the bot reacts at most once per 5-minute candle.
  • Explicit risk rules, with configurable defaults. By default, a maximum of 3 buy entries, a minimum order size and a balance check before every trade. On the sell side, a moderate overbought signal triggers a partial sell and an extreme one sells the whole position.

Want to talk about this project?

Get in touch