Files
miti99bot/tests/modules
tiennm99 7f47799733 fix(trading): swap dead TCBS endpoint for KBS data_day
The TCBS `apipubaws.tcbs.com.vn` host returns HTTP 404/500 for every
request, so every ticker resolved as "Unknown stock ticker" and /trade_buy
was unusable. Switch price + symbol resolution to the KBS public endpoint
that vnstock currently defaults to (`kbbuddywts.kbsec.com.vn/iis-server/
investment/stocks/{TICKER}/data_day`). KBS needs no auth, returns JSON,
and is Worker-compatible.

- `prices.fetchStockPrice` now queries KBS with a 14-day lookback window
  (covers weekends/holidays) and drops the TCBS-specific ×1000 scaling;
  KBS returns real VND.
- `symbols.resolveSymbol` delegates to `fetchStockPrice` for existence
  checks — empty `data_day` means unknown ticker.
- Update test fetch stubs to match the `kbsec` host and KBS response
  shape (`{ symbol, data_day: [{ c }] }`).
2026-04-21 14:39:05 +07:00
..