Inspiration

I want to buy a Bugatti 🏎️ and heard algorithmic trading is the way to go. So I created a trading bot to arbitrage semiconductor ETFs and their underlying stocks while I sleep.

What it does

  • Trades semiconductor ETFs (EU and US) and their component stocks (ASML, NVDA, AMD)
  • Implements 4 main arbitrage strategies:
    1. ETF vs ETF arbitrage (EU vs US)
    2. Single ETF vs its components
    3. ETF vs stocks when they're too cheap
    4. ETF vs stocks when they're too expensive
  • Handles single-market scenarios (US-only or EU-only) using price history
  • Manages position limits and risk with dynamic position sizing
  • Auto-balances positions when crisis mode hits

How we built it

  • Used Python and the Optibook trading API
  • Implemented real-time order book monitoring
  • Created safe volume calculations considering position limits and market liquidity
  • Built position tracking across multiple instruments
  • Added crisis management for when positions get too large
  • Used weighted thresholds based on current positions

Challenges we ran into

  • Dealing with market hours (EU/US timezone differences)
  • Managing cross-market risk when one market is closed
  • Handling position limits across 5 different instruments
  • Balancing aggression vs safety in trading
  • Rate limiting (25 requests per second)
  • Not blowing up the account while trying to get that Bugatti

Accomplishments that we're proud of

  • Built a fully automated trading system
  • Implemented multiple arbitrage strategies in one bot
  • Created dynamic position sizing and risk management
  • Made the bot recover from crisis situations
  • Didn't lose the house (yet)

What we learned

  • ETF arbitrage is more complex than it looks
  • Position management is crucial
  • Market microstructure matters
  • Sometimes the best trade is no trade
  • Crisis management needs to be built in from the start
  • Python can handle real-time trading pretty well

What's next for Do you even trade bro?

  • Add more sophisticated pricing models for closed-market scenarios
  • Implement machine learning for better threshold optimization
  • Add more ETFs and stocks to the mix
  • Create a dashboard for monitoring
  • Buy that Bugatti (eventually) 🏎️
  • Maybe add some risk management before the Bugatti

What's next for Do you even trade bro?

Built With

Share this project:

Updates