refactor(msn): remove HistoryProvider — Finance/Charts 404s on all IDX stocks

MSN Finance/Charts does not serve OHLCV data for XIDX stocks (returns 404).
Following the FP principle of not exposing capabilities a provider cannot fulfil:

- Remove impl HistoryProvider for MsnProvider entirely
- Remove fetch_charts from MsnClient
- Remove parse_chart_history, resample_history, trim_history_to_period from map.rs
- Remove MsnChart, ChartSeries, RawChart from raw_types.rs
- Remove parse_history_from_str, parse_close_only_history from parse.rs
- Decouple HistoryProvider from MarketDataProvider trait bound
- Add history_provider() factory: returns None for MSN, Some(Yahoo) for Yahoo
- CLI gates History/Technical on history_provider(), fails fast for MSN
- MSN mock returns Err(Unsupported); tests verify the behaviour explicitly
This commit is contained in:
Ciphercat 2026-03-06 20:55:35 +00:00
commit 6d6d51a04f
8 changed files with 71 additions and 504 deletions

View file

@ -107,27 +107,32 @@ fn technical_with_mock_provider_json_contains_fields() {
}
#[test]
fn msn_history_with_mock_returns_data() {
// MSN chart parsing works with fixture data; real IDX stocks 404 on Finance/Charts
// which surfaces as Unsupported (not the old blanket UNSUPPORTED message).
test_bin("msn-history-mock")
fn msn_history_returns_unsupported() {
// MSN Finance/Charts returns 404 for IDX (XIDX) stocks — history is not supported.
// history_provider() returns None for MSN, which surfaces as Unsupported error.
test_bin("msn-history-unsupported")
.env("IDX_PROVIDER", "msn")
.env("IDX_USE_MOCK_PROVIDER", "1")
.args(["stocks", "history", "BBCA", "--period", "3mo"])
.assert()
.success();
.failure()
.stderr(predicate::str::contains(
"MSN does not provide price history",
));
}
#[test]
fn msn_technical_with_mock_returns_data() {
// Technical analysis works via MSN chart fixture data (mock); real IDX stocks
// return Unsupported from Finance/Charts (404 on XIDX).
test_bin("msn-technical-mock")
fn msn_technical_returns_unsupported() {
// Technical analysis requires history — also unsupported for MSN/IDX.
test_bin("msn-technical-unsupported")
.env("IDX_PROVIDER", "msn")
.env("IDX_USE_MOCK_PROVIDER", "1")
.args(["-o", "json", "stocks", "technical", "BBCA"])
.assert()
.success();
.failure()
.stderr(predicate::str::contains(
"MSN does not provide price history",
));
}
#[test]