Skip to content

feat: add stock market data to perps#12528

Open
Kahnchan wants to merge 7 commits into
OneKeyHQ:release/v6.5.0from
Kahnchan:feat/perps-stock-ticker-data-release-v6.5.0
Open

feat: add stock market data to perps#12528
Kahnchan wants to merge 7 commits into
OneKeyHQ:release/v6.5.0from
Kahnchan:feat/perps-stock-ticker-data-release-v6.5.0

Conversation

@Kahnchan

Copy link
Copy Markdown
Contributor

Summary

  • Add stock asset metadata support for Perps markets.
  • Fetch and normalize stock fundamentals from the utility market service.
  • Display stock analysis, activity metrics, descriptions, tooltips, and disclaimers in the existing Perps information UI.

Intent & Context

Some Perps tickers represent U.S. stocks, but their information page previously only supported CoinGecko-backed crypto metadata. The utility service now exposes stock market data already used by Market. This change reuses that data source and presents stock information through the existing Perps information experience while preserving the Perps-configured ticker logo.

Design Decisions

  • Route assets explicitly configured with assetType: stock to the stock utility endpoint; keep existing crypto and non-CoinGecko behavior unchanged.
  • Normalize the utility response in the background service before exposing it to UI code.
  • Reuse Market stock-stat formatting and DashText tooltip patterns for consistent field definitions.
  • Keep the original Perps information layout and configured asset logo instead of using the logo returned by the stock endpoint.
  • Show a single third-party market-data disclaimer and retain the complete details in the Information tab.

Changes Detail

  • Extend shared market and Hyperliquid asset metadata types with stock support.
  • Add stock response mapping utilities and unit coverage in kit-bg.
  • Resolve crypto or stock market details according to asset configuration.
  • Add stock asset analysis, trading activity, introduction, field tooltips, and responsive Perps layouts.
  • Add hook tests for stock routing and fallback behavior.

Risk Assessment

  • Risk Level: Medium
  • Affected Platforms: Mobile, Desktop, Web, Extension
  • Risk Areas: Backend stock response normalization, ticker-to-stock mapping, and responsive information layouts. Existing non-stock Perps paths are expected to remain unchanged.

Test plan

  • Run yarn agent:check --profile commit.
  • Run targeted stock mapping and Perps market-detail hook tests.
  • Verify a configured stock Perps ticker displays stock fundamentals and the Perps-configured logo.
  • Verify crypto Perps information remains unchanged.
  • Verify missing or partial stock data renders fallback values without breaking the page.
  • Verify mobile and desktop/web information layouts and DashText tooltips.

Comment thread packages/kit-bg/src/services/ServiceMarketV2.ts
Comment thread packages/kit/src/views/Perp/components/MarketDetail/PerpMarketDetailContent.tsx Outdated
Comment thread packages/kit/src/views/Perp/components/MarketDetail/PerpMarketIntroContent.tsx Outdated
Comment thread packages/kit/src/views/Perp/components/MarketDetail/PerpMarketIntroContent.tsx Outdated
Comment thread packages/kit-bg/src/services/utils/marketStockUtils.ts
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.

4 participants