Skip to content

๐Ÿค– Experimental algorithmic trading bot combining DeepSeek LLM with technical indicators. Backtested on 1000h of BTC/USDT data. Spoiler: didn't work, but great learning experience! ๐Ÿ“š Full code + honest results inside.

License

Notifications You must be signed in to change notification settings

aethrox/deepseek-trading-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– DeepSeek Crypto Trading Bot

I built this trading bot to see if I could use AI (specifically DeepSeek LLM) to make trading decisions in the crypto market. Spoiler alert: it didn't work, but I learned a ton ๐Ÿ“š

โš ๏ธ Fair Warning

Don't use this with real money ๐Ÿ’ธโŒ I tested three different strategies and they all lost money. This is a learning project, not a get-rich-quick scheme. The crypto market is way more complex than I initially thought.

๐Ÿ’ก What This Project Is About

I wanted to experiment with combining AI language models and algorithmic trading. The idea was simple: fetch BTC price data from Bybit, ask DeepSeek to analyze it, and make buy/sell decisions based on its recommendations. Then backtest everything on historical data to see if it would've worked ๐Ÿ”

๐Ÿ“– What I Actually Learned

  • How to work with exchange APIs (Bybit in this case) ๐Ÿ”Œ
  • Using LLMs for financial analysis (harder than it sounds) ๐Ÿง 
  • Building and running backtests ๐Ÿ“Š
  • Working with financial data in Python ๐Ÿ
  • Why most simple trading bots fail ๐Ÿ’”

๐Ÿ› ๏ธ Tech Stack

  • Python 3.x ๐Ÿ
  • Bybit API for market data ๐Ÿ“ˆ
  • DeepSeek API for the AI part ๐Ÿค–
  • Pandas for data wrangling ๐Ÿผ
  • Basic HTTP requests ๐ŸŒ

๐Ÿ“ Files in This Project

fetch_data.py          โ†’ Grabs BTC price history from Bybit ๐Ÿ’ฐ
deepseek_signal.py     โ†’ Asks DeepSeek for trading signals ๐ŸŽฏ
backtest.py            โ†’ Tests the basic momentum strategy ๐Ÿ“‰
backtest_hybrid.py     โ†’ Tests technical indicators + AI combo ๐Ÿ”ง
test_signal.py         โ†’ Quick tests to see what signals we get โšก
btc_data.csv          โ†’ The historical data (auto-generated) ๐Ÿ“„

๐Ÿš€ How to Run This

Install Dependencies

pip install requests pandas

โš™๏ธ Setup

  1. You don't need Bybit API keys for fetching data (public endpoint) โœ…
  2. Get a DeepSeek API key from platform.deepseek.com ๐Ÿ”‘
  3. Drop your API key into the scripts where it says:
    DEEPSEEK_API_KEY = "your-api-key-here"

๐Ÿƒ Running the Code

Fetch data:

python fetch_data.py

Test if signals are working:

python test_signal.py

Run the full backtest:

python backtest_hybrid.py

๐Ÿ“Š The Strategies I Tried

Round 1: Simple Momentum ๐ŸŽข

The idea: If price goes up more than 2.5% in 24 hours, buy. If it drops more than 2.5%, sell.

Result: Lost 1.15% over 1000 hours ๐Ÿ“‰ Made literally 1 trade.

Round 2: Let AI Do Everything ๐Ÿค–

The idea: Give DeepSeek all the price data and let it figure out patterns.

Result: Lost 0.65% ๐Ÿ“‰ Still only 1 trade. AI was way too cautious.

Round 3: Hybrid Approach โšก

The idea: Use actual technical indicators (RSI, moving averages, volume) and have DeepSeek confirm the signals.

Result: Lost 3.95% ๐Ÿ’€ Worst performance yet. 0% win rate.

๐Ÿค” Why Everything Failed

The Main Issues

  1. DeepSeek was too conservative ๐Ÿ›‘ - It basically said "HOLD" for everything. Even when I gave it clear rules, it barely pulled the trigger.

  2. Crypto is chaotic ๐ŸŒช๏ธ - BTC dropped 3% over the test period and the bot just couldn't adapt fast enough.

  3. My prompts weren't good enough ๐Ÿ“ - Getting an LLM to consistently make good trading decisions is really hard.

  4. Not enough trades โธ๏ธ - 1-2 trades over 1000 hours means the strategy is way too picky.

๐Ÿ’ญ What I Realized

Real trading bots that actually make money need:

  • Way more sophisticated algorithms ๐Ÿงฎ
  • High-frequency trading capabilities โšก
  • Proper risk management ๐Ÿ›ก๏ธ
  • Years of development and testing โณ
  • A lot more computing power than my laptop ๐Ÿ’ป

LLMs are probably better for:

  • Analyzing news sentiment ๐Ÿ“ฐ
  • Summarizing market reports ๐Ÿ“‹
  • Supporting decisions, not making them ๐Ÿค

And the biggest lesson: always backtest before risking real money ๐Ÿ’ฏ Even then, past performance doesn't mean future success.

๐Ÿ”ฎ If I Were to Continue This

Some ideas I didn't try:

  • Copy trading ๐Ÿ‘ฅ - Just follow people who actually know what they're doing
  • Grid bots ๐ŸŽฏ - Buy low, sell high in a price range (works in sideways markets)
  • DCA bots ๐Ÿ’ฐ - Invest small amounts regularly over time
  • Sentiment analysis ๐Ÿ“Š - Use AI to read crypto Twitter instead of predicting prices
  • Multiple LLMs voting ๐Ÿ—ณ๏ธ - Get several AI opinions and average them out

๐Ÿค Want to Use This?

Feel free to fork it and experiment ๐Ÿด Just remember this didn't make money, so don't expect miracles. It's a learning project, not a money printer ๐Ÿ–จ๏ธโŒ

๐Ÿ“„ License

MIT - Do whatever you want with this code โœ…

๐Ÿ™ Thanks

  • Bybit for free API access ๐ŸŽ
  • DeepSeek for the LLM API ๐Ÿค–
  • Everyone who told me this wouldn't work (you were right) ๐Ÿ˜…

Bottom line: I set out to build a trading bot and ended up learning why that's really hard ๐ŸŽ“ The code works, the backtesting works, but the strategy doesn't. That's still valuable experience though - now I know what doesn't work and why ๐Ÿ’ก

About

๐Ÿค– Experimental algorithmic trading bot combining DeepSeek LLM with technical indicators. Backtested on 1000h of BTC/USDT data. Spoiler: didn't work, but great learning experience! ๐Ÿ“š Full code + honest results inside.

Topics

Resources

License

Stars

Watchers

Forks

Languages