refactor: consolidate duplicated market data lists into shared JSON configs (#1212)

Adding a new item (crypto, ETF, stablecoin, gulf symbol, etc.) previously
required editing 2-4 files because the same list was hardcoded independently
in seed scripts, RPC handlers, and frontend config. Following the proven
shared/crypto.json pattern, extract 6 new shared JSON configs so each list
has a single source of truth.

New shared configs:
- shared/stablecoins.json (ids + coinpaprika mappings)
- shared/etfs.json (BTC spot ETF tickers + issuers)
- shared/gulf.json (GCC indices, currencies, oil benchmarks)
- shared/sectors.json (sector ETF symbols + names)
- shared/commodities.json (VIX, gold, oil, gas, silver, copper)
- shared/stocks.json (market symbols + yahoo-only set)

All seed scripts, RPC handlers, and frontend config now import from
these shared JSON files instead of maintaining independent copies.
This commit is contained in:
Elie Habib
2026-03-07 22:00:55 +04:00
committed by GitHub
parent 591b664d59
commit dd127447c0
17 changed files with 144 additions and 134 deletions

View File

@@ -1,25 +1,18 @@
#!/usr/bin/env node
import { createRequire } from 'module';
import { loadEnvFile, CHROME_UA, runSeed } from './_seed-utils.mjs';
const require = createRequire(import.meta.url);
const etfConfig = require('../shared/etfs.json');
loadEnvFile(import.meta.url);
const CANONICAL_KEY = 'market:etf-flows:v1';
const CACHE_TTL = 3600;
const YAHOO_DELAY_MS = 200;
const ETF_LIST = [
{ ticker: 'IBIT', issuer: 'BlackRock' },
{ ticker: 'FBTC', issuer: 'Fidelity' },
{ ticker: 'ARKB', issuer: 'ARK/21Shares' },
{ ticker: 'BITB', issuer: 'Bitwise' },
{ ticker: 'GBTC', issuer: 'Grayscale' },
{ ticker: 'HODL', issuer: 'VanEck' },
{ ticker: 'BRRR', issuer: 'Valkyrie' },
{ ticker: 'EZBC', issuer: 'Franklin' },
{ ticker: 'BTCO', issuer: 'Invesco' },
{ ticker: 'BTCW', issuer: 'WisdomTree' },
];
const ETF_LIST = etfConfig.btcSpot;
function sleep(ms) {
return new Promise((r) => setTimeout(r, ms));