Skip to content

feat: Phase 2b — data core (DataPoint, Indicators, Levels, SimulationData)#2

Open
may01 wants to merge 4 commits into
phase-2a-stock-abstractionfrom
phase-2b-data-core
Open

feat: Phase 2b — data core (DataPoint, Indicators, Levels, SimulationData)#2
may01 wants to merge 4 commits into
phase-2a-stock-abstractionfrom
phase-2b-data-core

Conversation

@may01

@may01 may01 commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add DataPoint protocol + LiveDataPoint / WideDataPoint — unified read interface so signals/strategies are path-agnostic (live vs simulation)
  • Add Indicators class with TA-Lib path and pandas fallback; all columns named {tf}_{indicator} and computed in-place
  • Add Levels class for support/resistance price level management
  • Add SimulationData — O(1) backtesting replay engine over pre-computed wide DataFrame

Depends On

PR #1 (Phase 2a — BaseStock, BinanceStock, StockItem)

Test Plan

  • pytest tests/data/ — 38 passed, 0 failed
  • LiveDataPoint.get(col, tf, shift) returns correct scalar; raises KeyError for missing tf
  • WideDataPoint.get() uses position-based indexing with bounds guard
  • Indicators pandas fallback: RSI in [0,100], EMA columns present, idempotent, drop_na shrinks df
  • Indicators index-aligned (works with datetime-indexed DataFrames)
  • Levels: add/load/nearest/clear all correct; load deep-copies dicts
  • SimulationData: step advances cursor, is_done, reset, StopIteration on exhaustion

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant