Skip to content

feat: Allow custom range and interval in market widget#978

Open
suffer-sami wants to merge 1 commit intoglanceapp:devfrom
suffer-sami:feat/custom-market-range-interval
Open

feat: Allow custom range and interval in market widget#978
suffer-sami wants to merge 1 commit intoglanceapp:devfrom
suffer-sami:feat/custom-market-range-interval

Conversation

@suffer-sami
Copy link
Copy Markdown

Closes #974

Summary

This PR adds support for customizing the range and interval parameters used when fetching chart data for the market widget.

Previously, the API request hardcoded these values:

https://query1.finance.yahoo.com/v8/finance/chart/%s?range=1mo&interval=1d

This now allows us to use custom range and also to fetch data for symbols that require different parameters as mentioned in issue #974 (e.g. VNINDEX only returns data with a 4h interval and a short range).

Changes

  • Added range and interval fields to the marketRequest struct
  • Defaults to range: 1mo / interval: 1d when not specified (fully backwards compatible)
  • Returns a clear config error for invalid values at startup
  • Updated docs/configuration.md with the new properties and valid values

Example

- type: markets
 markets:
   - symbol: SPY
     name: S&P 500
   - symbol: BTC-USD
     name: Bitcoin
     chart-link: https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD
   - symbol: NVDA
     name: NVIDIA
   - symbol: AAPL
     symbol-link: https://www.google.com/search?tbm=nws&q=apple
     name: Apple
   - symbol: ^VNINDEX.VN
     name: VNINDEX (4h)
     interval: 4h
     range: 1mo

Screenshot

image

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