Fix XAU/USD display name, pip value, and invalid symbol validation

- config.py: add XAU/USD and XAG/USD to SYMBOL_DISPLAY; add PIP_VALUES
  map for commodities (gold pip = $0.01, not $0.0001)
- data_provider.py: use PIP_VALUES in get_pair_info so gold trade setup
  shows correct pip counts instead of 269,000 pips for a $27 SL
- main.py: validate symbols in symbol_from_name — rejects non-alpha
  inputs like '15M' with a helpful hint to use --timeframe instead

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Harwinder
2026-05-04 15:59:34 -04:00
parent a15fc6db91
commit 94b93cf1e7
3 changed files with 29 additions and 9 deletions
+4 -2
View File
@@ -17,7 +17,7 @@ import numpy as np
import pandas as pd
import requests
from config import PlatformConfig, Timeframe, SYMBOL_DISPLAY
from config import PlatformConfig, Timeframe, SYMBOL_DISPLAY, PIP_VALUES
logger = logging.getLogger(__name__)
@@ -196,10 +196,12 @@ class ForexDataProvider:
"""Return display name and pip value for a pair."""
display = SYMBOL_DISPLAY.get(symbol, symbol)
is_jpy = "JPY" in symbol
# Commodity-specific pip values take priority, then JPY pairs, then standard forex
pip_value = PIP_VALUES.get(symbol, 0.01 if is_jpy else 0.0001)
return {
"symbol": symbol,
"display": display,
"pip_value": 0.01 if is_jpy else 0.0001,
"pip_value": pip_value,
"is_jpy_pair": is_jpy,
}