Skip to content

Commit 02735aa

Browse files
committed
mapped HKEX symbols by rule, mapped crypto symbols manually
1 parent fbdd5a8 commit 02735aa

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

frontend/src/app/home/components/tradingview-advanced-chart.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@ function TradingViewAdvancedChart({
4242
}, [mappingUrl]);
4343

4444
const tvSymbol = useMemo(() => {
45+
const t = ticker;
46+
if (typeof t === "string" && t.includes(":")) {
47+
const [ex, sym] = t.split(":");
48+
const exUpper = ex.toUpperCase();
49+
if (exUpper === "HKEX") {
50+
const norm = (sym ?? "").replace(/^0+/, "") || "0";
51+
return `${exUpper}:${norm}`;
52+
}
53+
}
4554
const m = symbolMapRef.current;
46-
if (m && typeof m === "object" && ticker in m) {
47-
const v = m[ticker];
55+
if (m && typeof m === "object" && t in m) {
56+
const v = m[t];
4857
if (typeof v === "string" && v.length > 0) return v;
4958
}
50-
if (ticker.includes(":")) return ticker;
51-
return ticker;
59+
return t;
5260
}, [ticker, mappingUrl]);
5361

5462
const containerId = useMemo(

frontend/src/app/home/components/tv-symbol-map.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
{
2-
"HKEX:00700": "HKEX:700",
3-
"HKEX:00005": "HKEX:5",
4-
"HKEX:00011": "HKEX:11",
5-
"HKEX:00001": "HKEX:1",
6-
"HKEX:00002": "HKEX:2",
7-
"HKEX:03690": "HKEX:3690",
8-
"HKEX:09988": "HKEX:9988",
9-
"HKEX:09618": "HKEX:9618",
10-
"HKEX:09888": "HKEX:9888",
11-
"HKEX:02800": "HKEX:2800",
12-
"HKEX:03067": "HKEX:3067",
132
"CRYPTO:BTC": "BINANCE:BTCUSDT",
143
"CRYPTO:ETH": "BINANCE:ETHUSDT",
154
"CRYPTO:SOL": "BINANCE:SOLUSDT",

0 commit comments

Comments
 (0)