Simulation Engine
AMIBB simulation engine is designed to simulate realistic portfolio activities from history till present. Built in Rust for performance and reliability, the engine processes trading days sequentially to simulate realistic portfolio management including position tracking, tax lot accounting, transaction costs, and cash management.
General Info
All portfolios are simulated up to T-1 day, using end of day prices.
Portfolios are updated every hour
Newly created portfolios will be simulated automatically on the next schedule.
General Flow
The simulation runs day-by-day from start date to present, processing each trading day sequentially
Daily Loop, date t:
- Find current portfolio target allocation using closing prices up to date(t-1)
- Calculate current Daily Position Stats(t)
- Check if t is a rebalancing day
- [Non-rebalancing day] Save db and move to next day
- [Rebalancing day]
- Compare target weight and current weight
- Gather all weight differences exceeding drift tolerance
- Liquidate allocations with positive weight diffs
- Accumulate allocations with negative weight diffs
- Update Daily Position Stats and save db
Output:
Portfolio Value (t)
Daily Position Stats (t)
Tax Lot
Cash Flows
Deposit
Withdrawal (coming soon)
Liquidation
Accumulation
Trades
Allocation
Last updated