fix: FARTCOIN symbol normalization priority
- Problem: FARTCOIN signals being treated as SOL-PERP
- Root cause: Symbol normalization checked includes('SOL') before FARTCOIN
- Since TradingView may send symbols with 'SOL' in name, order matters
Files changed:
- config/trading.ts: Reordered checks (FARTCOIN before SOL)
- app/api/trading/market-data/route.ts: Added FARTCOIN mappings
Symbol matching now checks:
1. FARTCOIN/FART (most specific)
2. SOL (catch-all for Solana)
3. BTC, ETH (other majors)
4. Default fallback
This fixes TradingView alerts for FARTCOIN 5-min and 1-min data
collection being incorrectly stored as SOL-PERP in BlockedSignal table.
Status: ✅ DEPLOYED Dec 7, 2025 19:30 CET
Next FARTCOIN signal will correctly save as FARTCOIN-PERP
This commit is contained in:
@@ -31,6 +31,11 @@ function normalizeTradingViewSymbol(tvSymbol: string): string {
|
|||||||
if (tvSymbol.includes('-PERP')) return tvSymbol
|
if (tvSymbol.includes('-PERP')) return tvSymbol
|
||||||
|
|
||||||
const symbolMap: Record<string, string> = {
|
const symbolMap: Record<string, string> = {
|
||||||
|
'FARTCOINUSDT': 'FARTCOIN-PERP',
|
||||||
|
'FARTCOINUSD': 'FARTCOIN-PERP',
|
||||||
|
'FARTCOIN': 'FARTCOIN-PERP',
|
||||||
|
'FARTUSDT': 'FARTCOIN-PERP',
|
||||||
|
'FART': 'FARTCOIN-PERP',
|
||||||
'SOLUSDT': 'SOL-PERP',
|
'SOLUSDT': 'SOL-PERP',
|
||||||
'SOLUSD': 'SOL-PERP',
|
'SOLUSD': 'SOL-PERP',
|
||||||
'SOL': 'SOL-PERP',
|
'SOL': 'SOL-PERP',
|
||||||
|
|||||||
@@ -255,10 +255,12 @@ export const SUPPORTED_MARKETS: Record<string, MarketConfig> = {
|
|||||||
export function normalizeTradingViewSymbol(tvSymbol: string): string {
|
export function normalizeTradingViewSymbol(tvSymbol: string): string {
|
||||||
const upper = tvSymbol.toUpperCase()
|
const upper = tvSymbol.toUpperCase()
|
||||||
|
|
||||||
|
// Check FARTCOIN before SOL (FARTCOIN may contain SOL in ticker name)
|
||||||
|
if (upper.includes('FARTCOIN')) return 'FARTCOIN-PERP'
|
||||||
|
if (upper.includes('FART')) return 'FARTCOIN-PERP'
|
||||||
if (upper.includes('SOL')) return 'SOL-PERP'
|
if (upper.includes('SOL')) return 'SOL-PERP'
|
||||||
if (upper.includes('BTC')) return 'BTC-PERP'
|
if (upper.includes('BTC')) return 'BTC-PERP'
|
||||||
if (upper.includes('ETH')) return 'ETH-PERP'
|
if (upper.includes('ETH')) return 'ETH-PERP'
|
||||||
if (upper.includes('FARTCOIN')) return 'FARTCOIN-PERP'
|
|
||||||
|
|
||||||
// Default to SOL if unknown
|
// Default to SOL if unknown
|
||||||
console.warn(`Unknown symbol ${tvSymbol}, defaulting to SOL-PERP`)
|
console.warn(`Unknown symbol ${tvSymbol}, defaulting to SOL-PERP`)
|
||||||
|
|||||||
Reference in New Issue
Block a user