Files
cnmcdee 11493b5f22 Stock charts: CSV data loading (load_csv/set_series/clear/populate)
Every chart widget rendered only the baked-in 250-bar demo series:
no set_series existed in Python despite the docstring naming it, so
there was no way to plot real data at all. Now StockWidget holds up
to three series slots (primary + two extra for the multi-symbol
charts) via set_series (the C API), get_series, add_point, clear /
populate, item_count, and load_csv; all 37 draw paths read the
widget series through _bars(widget) instead of module DEMO_SERIES,
so derived series (Heikin-Ashi, Renko, VWAP, OBV, ...) rebuild from
the loaded data and the drawing tools inherit it as background.

load_csv reads date,open,high,low,close,volume with the stdlib csv
module: header optional (matched by name, any order, extra columns
ignored), dates YYYY-MM-DD / YYYY/MM/DD / DD-MM-YYYY / ISO datetime
/ epoch seconds (validated, not stored -- the x-axis is bar index),
ValueError naming the row on bad data. A cleared series draws a
no-data placeholder; a one-bar series draws (Price: flat change).

Tests: tests/test_stock_csv.py, 27 tests (parsing, API, headless
renders of all 24 chart kinds incl. CSV-vs-template pixel diff).
Fixture tests/data/ohlcv_30.csv (30 weekday bars). Full suite 311
tests pass; visreg 24/24 stock charts pixel-identical to template
goldens. Docs: docs/stock-charts-data.md. Screenshots:
tools/stock_csv_shots.py (Xvfb, RMSE 9-35% vs template goldens).
2026-12-02 09:55:14 +00:00

32 lines
1.3 KiB
CSV

date,open,high,low,close,volume
2026-01-05,100.00,100.18,98.80,99.40,530827
2026-01-06,99.40,99.94,99.30,99.58,1196376
2026-01-07,99.58,100.00,97.81,97.92,558790
2026-01-08,97.92,98.67,97.53,97.69,761555
2026-01-09,97.69,99.07,97.15,98.21,1026921
2026-01-12,98.21,100.11,97.43,100.02,863102
2026-01-13,100.02,100.17,98.44,98.75,1668673
2026-01-14,98.75,99.29,97.03,97.62,989768
2026-01-15,97.62,97.95,97.52,97.85,735116
2026-01-16,97.85,98.98,97.53,98.57,1315909
2026-01-19,98.57,98.87,97.72,98.45,1489461
2026-01-20,98.45,98.99,97.05,97.55,1758960
2026-01-21,97.55,98.74,96.67,98.45,600640
2026-01-22,98.45,99.14,98.02,98.20,1168113
2026-01-23,98.20,98.82,95.85,96.55,1296729
2026-01-26,96.55,98.31,95.91,97.99,1329385
2026-01-27,97.99,98.78,97.23,98.34,1865362
2026-01-28,98.34,98.95,98.19,98.29,1493282
2026-01-29,98.29,99.77,97.54,98.88,855431
2026-01-30,98.88,99.50,98.44,98.51,1126393
2026-02-02,98.51,98.66,97.23,97.33,1595396
2026-02-03,97.33,97.59,95.63,96.01,1753275
2026-02-04,96.01,96.44,93.99,94.51,1771577
2026-02-05,94.51,96.52,94.22,95.74,1055403
2026-02-06,95.74,96.54,94.41,95.27,650908
2026-02-09,95.27,95.52,93.87,94.12,1161992
2026-02-10,94.12,94.77,94.07,94.50,1060988
2026-02-11,94.50,95.03,93.21,94.07,1476455
2026-02-12,94.07,94.75,93.45,94.18,502609
2026-02-13,94.18,96.42,93.39,95.71,1640745