DEV Community

Cover image for What Happens If You Build Your Own Trading Bot? I Tried It
AdarshGzz...
AdarshGzz...

Posted on

What Happens If You Build Your Own Trading Bot? I Tried It

I Built a Real-Time Paper Trading Bot (To Understand How Trading Systems Work and can i automate it) and it took me 3 weeks.

so recently i wanted to understand how trading systems actually work behind the scenes

not just charts… but like:
• how data comes in
• how decisions are made
• how trades are executed

so i ended up building a paper trading bot for BTC/USDT

(no real money involved 😅)

what it does

it connects to Binance WebSocket and gets live market data

then on every 5-minute candle, it decides:
• go LONG
• go SHORT
• or do nothing

based on a simple strategy

*the strategy *(kept it simple)

i didn’t want anything too complex

so i used:
• EMA (50) → trend
• RSI (14) → momentum

entry logic:
• LONG → price above EMA + RSI > 50 + green candle
• SHORT → price below EMA + RSI < 50 + red candle

entry happens exactly on candle close

risk management (most important part)

this was actually interesting to implement
• only 1% risk per trade
• stop loss based on structure (swing high/low)
• target = 1.5x risk
• auto stop trading if:
• -3% loss
• +5% profit

also restricted trading hours to avoid random moves

tech i used
• Node.js → backend
• WebSockets → real-time data
• PostgreSQL (Neon) → store trades + candles
• React → dashboard

what i learned

this project was less about trading and more about systems
• handling real-time streams is tricky
• small delays can affect decisions
• syncing backend + frontend in real time is not easy
• logic looks simple but edge cases are everywhere

live project

if you want to see it:

👉 https://paper-trader-drab.vercel.app/
👉 https://github.com/AdarshGzz/Paper-Trader

final thought

it’s still a simple bot and not something for real trading

but building it gave me a better idea of:
• how trading engines work
• how data flows in real-time systems

planning to improve it more (maybe better strategies or analytics)

if you’ve built something similar or have ideas, would love to hear 👍

Top comments (0)