refactor: Environment owns modes + per-day candle cache #2

Open
derfenix wants to merge 1 commit from refactor/environment-owns-modes into master
Owner

Summary

  • Move paper/live differences into Environment (PrepareAccount, rollover quotes/orders); Trader and rollover wiring no longer branch on cfg.Environment
  • Split datasource into LoadWithPortfolio / LoadInstrument; simplify Live via LiveBroker; optional rollover placer only when enabled
  • Add durable historical CandleCache (localfs per UTC day): day-rounded broker fetch, exact [from,to) response; current UTC day never cached; empty past days cached as []
  • Cleanup: drop empty EventHandler, merge traders/envs into runningTrader, paper_equity config, docs update

Test plan

  • direnv exec . go test ./...
  • direnv exec . golangci-lint run ./...
  • Smoke: paper + live trader start (provider Start still runs with separate candle cache)
  • Optional: GetCandles past day hits cache; current day always hits upstream and is not saved
## Summary - Move paper/live differences into Environment (`PrepareAccount`, rollover quotes/orders); Trader and rollover wiring no longer branch on `cfg.Environment` - Split datasource into `LoadWithPortfolio` / `LoadInstrument`; simplify Live via `LiveBroker`; optional rollover placer only when enabled - Add durable historical `CandleCache` (localfs per UTC day): day-rounded broker fetch, exact `[from,to)` response; current UTC day never cached; empty past days cached as `[]` - Cleanup: drop empty `EventHandler`, merge traders/envs into `runningTrader`, `paper_equity` config, docs update ## Test plan - [ ] `direnv exec . go test ./...` - [ ] `direnv exec . golangci-lint run ./...` - [ ] Smoke: paper + live trader start (provider `Start` still runs with separate candle cache) - [ ] Optional: `GetCandles` past day hits cache; current day always hits upstream and is not saved
Keep paper/live differences behind PrepareAccount and env-owned rollover
quotes/orders so Trader and rollover wiring no longer branch on mode.
Add a durable per-day historical candle cache that never stores the
current UTC day.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin refactor/environment-owns-modes:refactor/environment-owns-modes
git switch refactor/environment-owns-modes

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff refactor/environment-owns-modes
git switch refactor/environment-owns-modes
git rebase master
git switch master
git merge --ff-only refactor/environment-owns-modes
git switch refactor/environment-owns-modes
git rebase master
git switch master
git merge --no-ff refactor/environment-owns-modes
git switch master
git merge --squash refactor/environment-owns-modes
git switch master
git merge --ff-only refactor/environment-owns-modes
git switch master
git merge refactor/environment-owns-modes
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
trading/tradebot!2
No description provided.