Skip to content

Commit 20291c7

Browse files
authored
feat(search): support MONEY_MARKET quoteType (#904)
* Support `MONEY_MARKET` in search * Generate the new schema that supports `MONEY_MARKET` * Write tests for an example Money Market search
1 parent f3b8381 commit 20291c7

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed

src/modules/search.schema.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,73 @@
606606
],
607607
"additionalProperties": {}
608608
},
609+
"SearchQuoteYahooMoneyMarket": {
610+
"type": "object",
611+
"properties": {
612+
"symbol": {
613+
"type": "string"
614+
},
615+
"isYahooFinance": {
616+
"type": "boolean",
617+
"const": true
618+
},
619+
"exchange": {
620+
"type": "string"
621+
},
622+
"exchDisp": {
623+
"type": "string"
624+
},
625+
"shortname": {
626+
"type": "string"
627+
},
628+
"longname": {
629+
"type": "string"
630+
},
631+
"index": {
632+
"type": "string",
633+
"const": "quotes"
634+
},
635+
"score": {
636+
"yahooFinanceType": "number"
637+
},
638+
"newListingDate": {
639+
"yahooFinanceType": "date"
640+
},
641+
"prevName": {
642+
"type": "string"
643+
},
644+
"nameChangeDate": {
645+
"yahooFinanceType": "date"
646+
},
647+
"sector": {
648+
"type": "string"
649+
},
650+
"industry": {
651+
"type": "string"
652+
},
653+
"dispSecIndFlag": {
654+
"type": "boolean"
655+
},
656+
"quoteType": {
657+
"type": "string",
658+
"const": "MONEY_MARKET"
659+
},
660+
"typeDisp": {
661+
"type": "string",
662+
"const": "MoneyMarket"
663+
}
664+
},
665+
"required": [
666+
"exchange",
667+
"index",
668+
"isYahooFinance",
669+
"quoteType",
670+
"score",
671+
"symbol",
672+
"typeDisp"
673+
],
674+
"additionalProperties": {}
675+
},
609676
"SearchQuoteNonYahoo": {
610677
"type": "object",
611678
"properties": {

src/modules/search.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe("search", () => {
2323
"NO0010123060", // has no shortname! (#31)
2424
"EUR", // a currency
2525
"BJ0CDD2", // additionalProperty: { exchDisp: "London" }
26+
'RAMXX', // a money market
2627
],
2728
});
2829

src/modules/search.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export interface SearchQuoteYahooFuture extends SearchQuoteYahoo {
6464
typeDisp: "Future" | "Futures";
6565
}
6666

67+
export interface SearchQuoteYahooMoneyMarket extends SearchQuoteYahoo {
68+
quoteType: 'MONEY_MARKET';
69+
typeDisp: 'MoneyMarket';
70+
}
71+
6772
export interface SearchQuoteNonYahoo {
6873
[key: string]: unknown;
6974
index: string; // '78ddc07626ff4bbcae663e88514c23a0'
@@ -105,6 +110,7 @@ export interface SearchResult {
105110
| SearchQuoteYahooCryptocurrency
106111
| SearchQuoteNonYahoo
107112
| SearchQuoteYahooFuture
113+
| SearchQuoteYahooMoneyMarket
108114
>;
109115
news: Array<SearchNews>;
110116
nav: Array<unknown>;

tests/fixtures/http/search-RAMXX.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"request": {
3+
"url": "https://query2.finance.yahoo.com/v1/finance/search?lang=en-US&region=US&quotesCount=6&newsCount=4&enableFuzzyQuery=false&quotesQueryId=tss_match_phrase_query&multiQuoteQueryId=multi_quote_single_token_query&newsQueryId=news_cie_vespa&enableCb=true&enableNavLinks=true&enableEnhancedTrivialQuery=true&q=RAMXX",
4+
"method": "GET",
5+
"headers": {
6+
"cookie": "",
7+
"user-agent": "@gadicc/yahoo-finance2/0.0.1 (+https://github.com/gadicc/node-yahoo-finance2)"
8+
}
9+
},
10+
"response": {
11+
"ok": true,
12+
"status": 200,
13+
"statusText": "OK",
14+
"headers": {
15+
"age": "0",
16+
"cache-control": "public, max-age=600, stale-while-revalidate=180",
17+
"content-length": "713",
18+
"content-type": "application/json;charset=utf-8",
19+
"date": "Sun, 04 May 2025 04:06:02 GMT",
20+
"referrer-policy": "no-referrer-when-downgrade",
21+
"server": "ATS",
22+
"strict-transport-security": "max-age=31536000",
23+
"vary": "Origin,Origin,Accept-Encoding",
24+
"x-content-type-options": "nosniff",
25+
"x-envoy-decorator-operation": "finance-search--mtls-production-sg3.finance-k8s:4080/*",
26+
"x-envoy-upstream-service-time": "28",
27+
"x-frame-options": "SAMEORIGIN",
28+
"x-xss-protection": "1; mode=block",
29+
"y-rid": "5leo3vhk1dpta"
30+
},
31+
"bodyJson": {
32+
"explains": [],
33+
"count": 1,
34+
"quotes": [
35+
{
36+
"exchange": "NAS",
37+
"shortname": "Ramirez Government Money Market",
38+
"quoteType": "MONEY_MARKET",
39+
"symbol": "RAMXX",
40+
"index": "quotes",
41+
"score": 10004500,
42+
"typeDisp": "MoneyMarket",
43+
"longname": "Advisor Managed Portfolios - Ramirez Asset Management Money Market Fund",
44+
"exchDisp": "NASDAQ",
45+
"isYahooFinance": true
46+
}
47+
],
48+
"news": [],
49+
"nav": [],
50+
"lists": [],
51+
"researchReports": [],
52+
"screenerFieldResults": [],
53+
"totalTime": 25,
54+
"timeTakenForQuotes": 417,
55+
"timeTakenForNews": 900,
56+
"timeTakenForAlgowatchlist": 400,
57+
"timeTakenForPredefinedScreener": 400,
58+
"timeTakenForCrunchbase": 400,
59+
"timeTakenForNav": 400,
60+
"timeTakenForResearchReports": 0,
61+
"timeTakenForScreenerField": 0,
62+
"timeTakenForCulturalAssets": 0,
63+
"timeTakenForSearchLists": 0
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)