Skip to content

Madmartigan1/tradebot

Repository files navigation

Tradebot v1.1.6

Latest version License Python Code size Last commit Open issues Open PRs Stars


⚙️ Full CLI Control, AutoTune Transparency and Runtime Flexibility


⚓ The Fleet Metaphor

To make the strategy easier to visualize:

  • EMA → Captain
    The EMA crossover is the leader and core signal engine. When the short EMA crosses the long EMA, the Captain gives the order.

  • AutoTune → Navigator
    The Navigator studies recent tides — analyzing market “weather” to recalibrate course.
    When the seas are calm (choppy), it tightens risk controls; when trending, it opens the sails for broader moves.
    AutoTune dynamically adjusts parameters like EMA confirmation count, RSI thresholds, and MACD bands based on regime votes (uptrend, downtrend, choppy, or blend).

  • MACD → Commodore
    The Commodore confirms momentum and trend direction. If the histogram disagrees, the Captain’s signal can be overridden.

  • RSI → Skipper
    The Skipper keeps things safe in the short term. If RSI shows overbought/oversold, trades are vetoed even if the Captain/Commodore want action.

  • Quartermaster → Take-Profit & Stagnation Officer
    The Quartermaster safeguards the fleet’s earnings and tidiness.

    • Take-Profit (8%+): When profits reach a safe margin, the Quartermaster locks the cargo and sends the ship home — a quick market exit.
  • Deckhand (36h, ±2%): The “broom” that sweeps idle trades off the deck when they drift aimlessly without momentum, keeping the decks lean and ready for action. This ensures capital is recycled efficiently while the Captain (EMA) and Advisors (RSI/MACD) focus on live opportunities.

  • Swab → Deck Maintenance & Logkeeper The newest crew member in v1.0.8 — responsible for keeping the decks spotless and logs consistent. Handles processed fill pruning and record hygiene to prevent bloat. (Fun fact: The term “Swab” was inspired by Captain Ron — because every good ship needs a swab.)

  • Watchdog → Connection Officer
    The newest recruit in v1.1.1 — a loyal sentry who keeps the fleet online and alert.

    • Duties: Monitors the WebSocket line for silence, issues pings, reconnects when idle, and even switches to local candle tracking if the exchange link grows unstable.
      The Watchdog ensures the Captain (EMA) never sails blind, keeping communication alive through calm and storm alike.

Together they form a chain of command: EMA (Captain) gives orders -> AutoTune (Navigator) continuously adjusts the fleet’s heading based on market weather -> MACD (Commodore) ensures strategy aligns with the broader trend -> RSI (Skipper) vetoes reckless moves -> Quartermaster secures profits and clears stagnation -> Deckhand keeps the decks clear of idle trades, ensuring the fleet stays agile and battle-ready -> Swab ensures no duplicate fills, stale positions, or misaligned logs remain aboard -> Watchdog keeps watch over the horizon, ensuring communication lines stay open and the ship never drifts alone.


📖 Documentation


✨ v1.1.6 Highlights

  • Periodic AutoTune refresh — AutoTune now re-runs automatically every 3 hours (or whatever value you set in AUTOTUNE_ELAPSED_REFRESH_HOURS), continuously adapting to market shifts without restart.
  • AutoTune learns EMA periods — the Navigator (AutoTune) now adjusts short_ema and long_ema every 3 hours (default).
    It ensures safe, spaced-out EMA pairs (e.g. 40/120 → 35/110), adapting to volatility while avoiding overfitting.
  • Banner branding — The bot proudly launches under the name VODAN with a stylized console banner.
  • Dry-run still simulates spend — to mimic real trading exposure while placing no live orders.
  • Dry-run safety banner — When dry_run=True, the bot clearly prints: ******** DRY RUN MODE: NO LIVE ORDERS WILL BE SENT ********
  • Clean shutdown handling — Periodic AutoTune and reconcile threads exit gracefully when you stop the bot.
  • Full CLI parameterization — Nearly every runtime value can now be set directly from the command line:
    python main.py --enable-autotune=0 --confirm-candles=1 --cooldown-time=200 --deadband=4
    python main.py --quartermaster-profit=1200 --quartermaster-hold-time=36 --stop-loss=300
    python main.py --candle-mode=local --candle-interval=1m --prefer-maker=1 --prefer-maker-for-sells=no

🔧 Upgrade notes

  • Improved BLEND functionality with autotune.
  • Added CLI overrides.
  • Backward-compatible with v1.0.9 state files.
  • No CSV header changes.
  • Daily-spend logic tightened to count only successfully accepted orders.

🧑‍💻 Developer Notes

  • The CLI system now builds help text dynamically using live values from config.py.
  • Boolean flags use a unified _BOOL_KW parser shared across runtime and maker options.
  • Help epilog automatically includes both defaults and AutoTune behavior notes.

⚖️ Risk controls

  • Daily BUY cap: limits the number of BUYs per day to curb overtrading during chop. Logged as
    **********Daily BUY cap reached (N). Skipping further BUYs.**********
  • Quartermaster: take-profit and stagnation exits; respects base_increment and min_market_base_size.
  • Exits: MARKET_ONLY by default for deterministic fills under stress.

🔐 Secrets

Copy APIkeys.env.example -> APIkeys.env and fill your Coinbase credentials.
Never commit real keys.


🛠️ Quickstart

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy APIkeys.env.example APIkeys.env   # fill your keys
python .\main.py

⚠️ Disclaimer:

This bot is intended for educational and experimental purposes only. It is not financial advice and will not guarantee profit. Use it at your own risk. Always do your own research, monitor your trades, and configure the system to match your risk tolerance. Past performance is not indicative of future results. Trade responsibly.

About

Autonomous Coinbase trading bot with adaptive EMA, RSI, and MACD strategy — commanded by the Captain (EMA), guided by the Navigator (AutoTune), and advised by the Skipper (RSI) and Commodore (MACD).

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages