66#include < cstddef>
77#include < optional>
88#include < string>
9+ #include < utility>
910#include < vector>
1011
1112class SimulatedDataSource : public IMarketDataSource
1213{
1314public:
15+ // Each mock headline is paired with a synthetic publisher spanning trust
16+ // tiers (wire services / major outlets / PR wires / no-name blogs) so the
17+ // source-trust labeling and filtering are exercised end-to-end without a
18+ // live Finnhub key.
1419 SimulatedDataSource ()
1520 : headlines_{
16- " Fed raises rates by 25bps, signals higher-for-longer stance" ,
17- " AAPL earnings beat as services revenue hits record" ,
18- " US CPI comes in cooler than expected; futures rally" ,
19- " Oil jumps 3% on supply disruption concerns in the Middle East" ,
20- " NVDA announces new AI chips; shares pop in after-hours" ,
21- " Treasury yields fall after weak jobs report; bond market rallies" ,
22- " ECB holds rates steady; hints at possible summer cut" ,
23- " TSLA deliveries miss estimates; margin pressure returns" ,
24- " Gold climbs as dollar weakens and risk-off flows pick up" ,
25- " China announces targeted stimulus; industrial metals rise" ,
26- " MSFT cloud growth accelerates; upbeat guidance lifts tech" ,
27- " Banking sector dips on renewed concerns over CRE exposure" ,
21+ { " Fed raises rates by 25bps, signals higher-for-longer stance" , " Reuters " } ,
22+ { " AAPL earnings beat as services revenue hits record" , " Bloomberg " } ,
23+ { " US CPI comes in cooler than expected; futures rally" , " Associated Press " } ,
24+ { " Oil jumps 3% on supply disruption concerns in the Middle East" , " CNBC " } ,
25+ { " NVDA announces new AI chips; shares pop in after-hours" , " PRNewswire " } ,
26+ { " Treasury yields fall after weak jobs report; bond market rallies" , " Reuters " } ,
27+ { " ECB holds rates steady; hints at possible summer cut" , " Financial Times " } ,
28+ { " TSLA deliveries miss estimates; margin pressure returns" , " MarketWatch " } ,
29+ { " Gold climbs as dollar weakens and risk-off flows pick up" , " Yahoo Finance " } ,
30+ { " China announces targeted stimulus; industrial metals rise" , " Bloomberg " } ,
31+ { " MSFT cloud growth accelerates; upbeat guidance lifts tech" , " GlobeNewswire " } ,
32+ { " Banking sector dips on renewed concerns over CRE exposure" , " Seeking Alpha " } ,
2833 // Single-stock headlines (no macro keyword) for testing watchlists.
29- " GOOGL slides after antitrust ruling threatens ad business" ,
30- " AMZN holiday sales smash records; cloud margins expand" ,
31- " META unveils new AI assistant; shares rally 7% after the bell" ,
32- " AMD wins major data-center deal, taking share from NVDA" ,
33- " JPM tops estimates as net interest income climbs to a record" ,
34- " DIS streaming losses narrow as subscriber growth returns" ,
35- " COIN surges as crypto trading volumes spike to yearly high" ,
36- " PLTR jumps on raised guidance and new government contracts" ,
34+ { " GOOGL slides after antitrust ruling threatens ad business" , " Reuters " } ,
35+ { " AMZN holiday sales smash records; cloud margins expand" , " PRNewswire " } ,
36+ { " META unveils new AI assistant; shares rally 7% after the bell" , " TechCrunch " } ,
37+ { " AMD wins major data-center deal, taking share from NVDA" , " MarketBeat Blog " } ,
38+ { " JPM tops estimates as net interest income climbs to a record" , " Wall Street Journal " } ,
39+ { " DIS streaming losses narrow as subscriber growth returns" , " CNBC " } ,
40+ { " COIN surges as crypto trading volumes spike to yearly high" , " CoinDesk " } ,
41+ { " PLTR jumps on raised guidance and new government contracts" , " StockTwits " } ,
3742 }
3843 {
3944 }
4045
41- explicit SimulatedDataSource (std::vector<std::string > headlines)
46+ explicit SimulatedDataSource (std::vector<Headline > headlines)
4247 : headlines_{std::move (headlines)}
4348 {
4449 }
4550
46- std::optional<std::string > nextHeadline () override
51+ std::optional<Headline > nextHeadline () override
4752 {
4853 if (headlines_.empty ())
4954 return std::nullopt ;
@@ -59,15 +64,15 @@ class SimulatedDataSource : public IMarketDataSource
5964 first_tick_ = false ;
6065 last_emit_ = now;
6166
62- const std::string &h = headlines_[next_idx_];
67+ const Headline &h = headlines_[next_idx_];
6368 next_idx_ = (next_idx_ + 1 ) % headlines_.size ();
6469 return h;
6570 }
6671
6772private:
6873 static constexpr std::chrono::milliseconds kInterval {2000 };
6974
70- std::vector<std::string > headlines_;
75+ std::vector<Headline > headlines_;
7176 std::size_t next_idx_ = 0 ;
7277 std::chrono::steady_clock::time_point last_emit_{};
7378 bool first_tick_ = true ;
0 commit comments