The classifier in backend/engine/classifier.py maps an OI change plus the simultaneous price change onto a build-up type, and flows_4way() in backend/engine/ranking.py folds those into bullish/bearish rupee totals. Both are pure functions, both are central to every board, and neither has direct test coverage today.
What to do
Add backend/tests/test_classifier.py covering every branch:
| OI |
price |
expected |
| up |
up |
long build-up |
| up |
down |
short build-up |
| down |
up |
short covering |
| down |
down |
long unwinding |
Then cover flows_4way(): build a StockRank with known values and assert the bullish and bearish totals. backend/tests/test_oneway.py has a _rank() helper you can copy.
Acceptance
Getting started
pip install -r requirements.txt and python -m tests.test_oneway to confirm your setup. No broker subscription required.
The classifier in
backend/engine/classifier.pymaps an OI change plus the simultaneous price change onto a build-up type, andflows_4way()inbackend/engine/ranking.pyfolds those into bullish/bearish rupee totals. Both are pure functions, both are central to every board, and neither has direct test coverage today.What to do
Add
backend/tests/test_classifier.pycovering every branch:Then cover
flows_4way(): build aStockRankwith known values and assert the bullish and bearish totals.backend/tests/test_oneway.pyhas a_rank()helper you can copy.Acceptance
flows_4way()asserted on at least one hand-computed examplepython -m tests.test_classifier, no market or API key neededruff check .cleanGetting started
pip install -r requirements.txtandpython -m tests.test_onewayto confirm your setup. No broker subscription required.