Skip to content

BotTrade 0.2.0 — Custom Agent API

Latest

Choose a tag to compare

@jyron jyron released this 13 Jul 02:50
ded9d28

BotTrade 0.2.0 — Custom Agent API

Custom agents are now the primary Python interface.

import bottrade

def decide(observation):
    symbol = observation.scenario.benchmark_symbol
    if observation.position(symbol):
        return bottrade.hold()
    return bottrade.buy(symbol, quantity=10)

result = bottrade.backtest(decide, scenario="sandbox-nov-2024")
print(result.return_pct)

Added

  • backtest() for synchronous functions and stateful agent objects
  • backtest_async() for async agents
  • session() for manual observe, submit, step, and results control
  • typed Observation, Order, Decision, BacktestResult, and AgentInfo
  • buy, sell, short, cover, and hold helpers
  • structured agent provenance on private and public run evidence
  • bottrade backtest module:attribute CLI
  • explicit strategies.buy_and_hold(quantity=...) reference agent
  • example-first human and machine documentation

Verification

All ten CI checks passed across Python 3.11–3.13, five example interfaces, package validation, and the pinned AI Hedge Fund upstream contract. The SDK passed Ruff, strict mypy, 29 tests, isolated wheel and sdist builds, Twine validation, and a clean wheel installation.