Skip to content

fix(market): label and measure 5m Hyperliquid intraday series correctly - #1567

Open
creativityventures wants to merge 4 commits into
NoFxAiOS:devfrom
creativityventures:fix/intraday-interval-labels
Open

creativityventures wants to merge 4 commits into
NoFxAiOS:devfrom
creativityventures:fix/intraday-interval-labels

Conversation

@creativityventures

Copy link
Copy Markdown

Summary

  • Problem: for Hyperliquid, GetWithExchange fetches 5m candles, but Format labels the series "3‑minute intervals" and "3m ATR", and the "1h change" looks 20 bars back, which is 100 minutes on 5m data. The strategy engine also hard-codes "3m ATR" (kernel/engine_prompt.go). So the model is told the wrong timeframe and gets a wrong 1h change (market.Format labels Hyperliquid 5m series as "3-minute intervals" #1562).
  • What changed:
    • IntradayData.Interval records the K-line interval of the series ("3m" or "5m"). Empty keeps the legacy 3m default (intervalOrDefault).
    • intradayPriceChange1h(klines, interval) computes the 1h lookback from the interval: 20 bars on 3m, 12 bars on 5m.
    • Format and the engine's ATR label use the actual interval (the engine uses klineConfig.PrimaryTimeframe, as the line above it already does).
  • What did NOT change: data sources, indicator maths, the 3m path for non-Hyperliquid exchanges. gofmt also realigned the GridDirection comments in market/types.go.

Change Type

  • Bug fix
  • Feature
  • Refactoring
  • Docs
  • Security fix
  • Chore / infra

Scope

  • Trading engine / strategies

  • MCP / AI clients

  • API / server

  • Web UI / frontend

  • Config / deployment

  • CI/CD / infra

Linked Issues

Testing

What you verified and how:

  • go build ./... passes
  • go test ./... passes (ran go test ./market/ ./kernel/, both pass; I didn't run the whole repo)
  • Manual testing done

New market/data_interval_test.go: the 1h change uses 20 bars on 3m and 12 on 5m, returns 0 without a full hour or with an unknown interval, and Format labels a 5m series as 5‑minute / 5m ATR while legacy data keeps the 3m labels. These tests don't compile on dev without the change. I didn't run the bot against Hyperliquid.

Security Impact

  • Secrets/keys handling changed? No
  • New/changed API endpoints? No
  • User input validation affected? No

Compatibility

  • Backward compatible? Yes (new struct field, empty means 3m)
  • Config/env changes? No
  • Migration needed? No

🤖 Generated with Claude Code

https://claude.ai/code/session_014cRzwuyJe8BGwXowsQ3kpw

creativityventures and others added 4 commits November 20, 2026 10:05
Add IntradayData.Interval so the formatter knows whether the series is 3m or 5m (Hyperliquid).

Co-authored-by: Claude <noreply@anthropic.com>
Hyperliquid intraday data is fetched as 5m candles, but Format labelled it "3-minute intervals" / "3m ATR", and the 1h change looked 20 bars back (100 minutes on 5m). Compute the 1h lookback from the interval and use it in the labels.

Fixes NoFxAiOS#1562

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
@cla-assistant

cla-assistant Bot commented Nov 20, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Nov 20, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

market.Format labels Hyperliquid 5m series as "3-minute intervals"

1 participant