Examples
Examples are ordered from simplest to most research-specific. Start with package examples before running paper-specific agents.
Custom Dataset
Run:
This example creates an in-memory FinsaberDataset, runs BuyAndHoldStrategy, and prints total return.
Use it to learn the required dictionary shape before writing a custom loader.
Research Experiment Launchers
These scripts are repository examples and are not included in the package wheel.
python examples/experiments/run_llm_traders_exp.py \
--setup selected_4 \
--strategy FinMemStrategy \
--strat_config_path strats_configs/finmem_config_normal.json
Minimal Package Usage
from finsaber import FINSABERBt, FinsaberParquetDataset
from finsaber.strategy.timing import BuyAndHoldStrategy
data = FinsaberParquetDataset("path/to/sp500_2000_2025_parquet")
config = {
"data_loader": data,
"tickers": ["AAPL"],
"date_from": "2024-01-02",
"date_to": "2024-01-10",
"setup_name": "minimal",
"save_results": False,
"silence": True,
}
results = FINSABERBt(config).run_iterative_tickers(BuyAndHoldStrategy)
Recommended Learning Sequence
- Run the minimal package usage example with one ticker.
- Enable
save_results=Trueand inspectrun_summary.csv. - Add
slippage_percandliquidity_cap_pct. - Replace
BuyAndHoldStrategywith a simple moving-average strategy. - Replace
FinsaberParquetDatasetwith your ownTradingDataimplementation. - Only then run LLM or RL research launchers.