Quick answer
Basana is an asyncio-based, event-driven Python framework for algorithmic trading, focused on crypto. It supports backtesting with a simulated exchange and live trading on Binance and Bitstamp. Its author, Gabriel Becedillas, also wrote PyAlgoTrade, which points users to Basana after being archived.
Basana at a glance
- Category
- Backtest + live trading engines
- Language
- Python
- License
- Apache-2.0
- Does
- Backtesting, Live trading
- Markets
- Crypto
- Best for
- Crypto traders who liked PyAlgoTrade and want an async, maintained replacement.
- In AlgoGP
- Use the exported strategy object from your own code
Pick it if
Crypto traders who liked PyAlgoTrade and want an async, maintained replacement.
Watch out for
Few exchanges (Binance, Bitstamp).
Basana strengths and limitations
Strengths
- Async event-driven design.
- Same strategy for backtest and live.
- Small, readable codebase.
Limitations
- Few exchanges (Binance, Bitstamp).
- Smaller community than Freqtrade or Hummingbot.
Basana example
pip install basanaimport asyncio
import basana as bs
import basana.backtesting.exchange as backtesting_exchange
async def main():
event_dispatcher = bs.backtesting_dispatcher()
exchange = backtesting_exchange.Exchange(event_dispatcher, initial_balances={"USDT": 1000})
# add bars from CSV, subscribe a strategy to bar events, then:
await event_dispatcher.run()
asyncio.run(main())Use Basana with AlgoGP
AlgoGP does not add Basana to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from Basana yourself.
- 1
Design and backtest in AlgoGP
Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.
- 2
Add any bridge to get the adapter core
Adding a bridged framework (for example Backtrader) writes
frameworks/algogp_bridge.py, whoseStrategyBridge.on_bar()returns the orders the strategy wants. - 3
Call it from Basana
Feed Basana’s bars to
StrategyBridge, place the returned orders with Basana, and report fills back withsync().
Basana connects to Binance, Bitstamp. Each guide shows how to create the API key, which you can store in the project’s Keys & secrets.
Basana: frequently asked questions
Is Basana the successor to PyAlgoTrade?
PyAlgoTrade’s repository recommends Basana; both come from the same author.
Basana alternatives
- PyAlgoTradePythonThe early event-driven Python backtester, archived in 2023; its author recommends Basana. What it did, and what to migrate to.
- FreqtradePythonThe most popular open-source crypto trading bot: Python strategies, backtesting, hyperopt, FreqAI machine learning, dry-run and Telegram/web control.
- JessePythonPython crypto trading framework with a clean strategy API, accurate multi-timeframe backtests, optimization and a live-trading plugin.
- NautilusTraderPython, RustHigh-performance, Rust-core trading platform with a Python API: the same strategy runs in a nanosecond-resolution backtester and live across many venues.
Independent guide. AlgoGP is not affiliated with Basana. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.