Skip to content

perf: avoid smart money OBV allocation#18

Open
stmr wants to merge 1 commit into
Dragoon4002:mainfrom
stmr:codex/artic-smart-money-obv
Open

perf: avoid smart money OBV allocation#18
stmr wants to merge 1 commit into
Dragoon4002:mainfrom
stmr:codex/artic-smart-money-obv

Conversation

@stmr

@stmr stmr commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Avoid materializing a full OBV series inside the smart-money strategy. The strategy only needs to know whether OBV increased over the trailing obv_window, so this computes that trailing delta directly.

Type

  • Bug fix
  • New strategy
  • New feature
  • Refactor
  • Documentation
  • Tests
  • Performance

Related Issue

Related to #2.

Changes

  • Replace _obv_series(...) with _obv_trending_up(...) in app/strategies/quant_algos/smart_money.py.
  • Avoid allocating one cumulative OBV entry per candle on every smart-money signal check.
  • Preserve the old decision rule: obv[-1] > obv[-(obv_window + 1)] is equivalent to trailing OBV delta > 0.

Testing

  • python3 -m py_compile app/strategies/quant_algos/smart_money.py
  • git diff --check
  • Local equivalence + benchmark script on a synthetic 20,000-candle cache:
    • OBV trend equality ok for lookbacks 1, 5, 20, 250, 1000
    • 5,000 helper calls: old 14.5807s, new 0.0043s, 3388.77x faster
    • 5,000 full smart_money(...) calls after patch: 0.0133s

Checklist

  • No secrets, API keys, or private keys committed
  • Type hints on all new public functions
  • docs/connections/service-map.md updated (if adding a new call path) - not applicable
  • docs/architecture/data-model.md updated (if changing DB schema) - not applicable
  • New strategy registered in app/strategies/signals.py (if adding a strategy) - not applicable
  • New strategy added to strategy index in app/onchain_logger.py (if adding a strategy) - not applicable
  • Breaking changes documented in PR description - not applicable

If selected for payout: USDC 0x10DFE6771131BEc830A7a44D7Be45Ced0741b2b3.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@stmr is attempting to deploy a commit to the dragoon4002's projects Team on Vercel.

A member of the Team first needs to authorize it.

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