Skip to content

Commit

Permalink
fix(search): add support for screener fields (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Aug 11, 2021
1 parent d7a6693 commit 2b23ccb
Show file tree
Hide file tree
Showing 33 changed files with 1,261 additions and 1,282 deletions.
7 changes: 7 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7140,6 +7140,10 @@
"totalTime": {
"yahooFinanceType": "number"
},
"screenerFieldResults": {
"type": "array",
"items": {}
},
"timeTakenForQuotes": {
"yahooFinanceType": "number"
},
Expand All @@ -7160,6 +7164,9 @@
},
"timeTakenForResearchReports": {
"yahooFinanceType": "number"
},
"timeTakenForScreenerField": {
"yahooFinanceType": "number"
}
},
"required": [
Expand Down
8 changes: 8 additions & 0 deletions src/modules/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,21 @@ export interface SearchResult {
lists: Array<any>;
researchReports: Array<any>;
totalTime: number;
// ALWAYS present, but TEMPORARILY marked optional ("?") since its
// sudden appearance, let's make sure it doesn't get suddenly removed.
// Array<any> until we can find some examples of what it actually looks
// like (#255).
screenerFieldResults?: Array<any>;
timeTakenForQuotes: number; // 26
timeTakenForNews: number; // 419
timeTakenForAlgowatchlist: number; // 700
timeTakenForPredefinedScreener: number; // 400
timeTakenForCrunchbase: number; // 400
timeTakenForNav: number; // 400
timeTakenForResearchReports: number; // 0
// ALWAYS present, but TEMPORARILY marked optional ("?") since its
// sudden appearance, let's make sure it doesn't get suddenly removed.
timeTakenForScreenerField?: number;
}

export interface SearchOptions {
Expand Down
39 changes: 19 additions & 20 deletions tests/http/search-0P000071W8.TO.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"statusText": "OK",
"headers": {
"content-type": [
"application/json"
"application/json;charset=utf-8"
],
"vary": [
"Origin,Origin,Accept-Encoding"
Expand All @@ -17,34 +17,31 @@
"public, max-age=120, stale-while-revalidate=180"
],
"y-rid": [
"b65ni6hg6s90r"
"33v4ql5gh7rjg"
],
"x-yahoo-request-id": [
"b65ni6hg6s90r"
"33v4ql5gh7rjg"
],
"x-request-id": [
"cefa2ea2-4c62-4cca-917c-322c35e362dd"
],
"content-encoding": [
"gzip"
"ae105b64-73f0-4f59-a5db-2105a7bc0dfa"
],
"content-length": [
"609"
"1413"
],
"x-envoy-upstream-service-time": [
"28"
],
"date": [
"Wed, 07 Apr 2021 21:28:59 GMT"
"Wed, 11 Aug 2021 15:36:16 GMT"
],
"server": [
"ATS"
],
"x-envoy-decorator-operation": [
"finance-search--mtls-production-bf1.finance-k8s.svc.yahoo.local:4080/*"
"finance-search--mtls-canary-production-bf1.finance-k8s.svc.yahoo.local:4080/*"
],
"age": [
"4"
"0"
],
"strict-transport-security": [
"max-age=15552000"
Expand Down Expand Up @@ -78,7 +75,7 @@
"quoteType": "MUTUALFUND",
"symbol": "0P000071W8.TO",
"index": "quotes",
"score": 2001600,
"score": 2000400,
"typeDisp": "Fund",
"longname": "TD U.S. Index Fund - e",
"isYahooFinance": true
Expand All @@ -88,15 +85,15 @@
"nav": [
{
"navName": "How To",
"navUrl": "http://finance.yahoo.com/tech/how-to"
"navUrl": "http://finance.yahoo.com/tech/how-to/"
}
],
"lists": [
{
"slug": "most-added",
"name": "Most Added to Watchlists",
"index": "most-added",
"score": 13.218811,
"score": 14.613496,
"type": "ALGO_WATCHLIST",
"brandSlug": "yahoo-finance",
"pfId": "most_added"
Expand All @@ -105,7 +102,7 @@
"slug": "top-crypto-bets",
"name": "Top Crypto Bets",
"index": "top-crypto-bets",
"score": 6.1471534,
"score": 6.724023,
"type": "ALGO_WATCHLIST",
"brandSlug": "yahoo-finance",
"pfId": "top_crypto_bets"
Expand All @@ -114,7 +111,7 @@
"slug": "crypto-top-market-cap",
"name": "Top Cryptos by Market Cap",
"index": "crypto-top-market-cap",
"score": 3.2906277,
"score": 3.995912,
"type": "ALGO_WATCHLIST",
"brandSlug": "yahoo-finance",
"pfId": "crypto_top_market_cap"
Expand All @@ -123,21 +120,23 @@
"slug": "crypto-top-volume-24hr",
"name": "Top Cryptos by Volume (all currencies, 24hr)",
"index": "crypto-top-volume-24hr",
"score": 2.6340094,
"score": 3.011166,
"type": "ALGO_WATCHLIST",
"brandSlug": "yahoo-finance",
"pfId": "crypto_top_volume_24hr"
}
],
"researchReports": [],
"totalTime": 26,
"timeTakenForQuotes": 416,
"screenerFieldResults": [],
"totalTime": 25,
"timeTakenForQuotes": 415,
"timeTakenForNews": 600,
"timeTakenForAlgowatchlist": 400,
"timeTakenForPredefinedScreener": 400,
"timeTakenForCrunchbase": 400,
"timeTakenForNav": 400,
"timeTakenForResearchReports": 0
"timeTakenForResearchReports": 0,
"timeTakenForScreenerField": 0
}
}
}
90 changes: 46 additions & 44 deletions tests/http/search-AAPL.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"statusText": "OK",
"headers": {
"content-type": [
"application/json"
"application/json;charset=utf-8"
],
"vary": [
"Origin,Origin,Accept-Encoding"
Expand All @@ -17,25 +17,25 @@
"public, max-age=120, stale-while-revalidate=180"
],
"y-rid": [
"dv5i1v5g6s90l"
"eo12kv5gh7rcp"
],
"x-yahoo-request-id": [
"dv5i1v5g6s90l"
"eo12kv5gh7rcp"
],
"x-request-id": [
"7806aee7-c0aa-4386-9c5a-6e89830624f3"
"de034c6a-88f0-4517-ae09-e19ad335a4eb"
],
"content-encoding": [
"gzip"
],
"content-length": [
"966"
"1047"
],
"x-envoy-upstream-service-time": [
"55"
"38"
],
"date": [
"Wed, 07 Apr 2021 21:28:53 GMT"
"Wed, 11 Aug 2021 15:32:41 GMT"
],
"server": [
"ATS"
Expand Down Expand Up @@ -78,7 +78,7 @@
"quoteType": "EQUITY",
"symbol": "AAPL",
"index": "quotes",
"score": 123462200,
"score": 77457696,
"typeDisp": "Equity",
"longname": "Apple Inc.",
"isYahooFinance": true
Expand All @@ -89,48 +89,48 @@
"quoteType": "EQUITY",
"symbol": "AAPL.MX",
"index": "quotes",
"score": 20980,
"score": 20552,
"typeDisp": "Equity",
"longname": "Apple Inc.",
"isYahooFinance": true
},
{
"exchange": "OPR",
"shortname": "AAPL Apr 2021 60.000 call",
"shortname": "AAPL Aug 2021 147.000 call",
"quoteType": "OPTION",
"symbol": "AAPL210409C00060000",
"symbol": "AAPL210813C00147000",
"index": "quotes",
"score": 20242,
"score": 20172,
"typeDisp": "Option",
"isYahooFinance": true
},
{
"exchange": "OPR",
"shortname": "AAPL Apr 2021 127.000 call",
"shortname": "AAPL Sep 2021 140.000 call",
"quoteType": "OPTION",
"symbol": "AAPL210409C00127000",
"symbol": "AAPL210917C00140000",
"index": "quotes",
"score": 20209,
"score": 20162,
"typeDisp": "Option",
"isYahooFinance": true
},
{
"exchange": "OPR",
"shortname": "AAPL Apr 2021 126.000 call",
"shortname": "AAPL Aug 2021 146.000 call",
"quoteType": "OPTION",
"symbol": "AAPL210409C00126000",
"symbol": "AAPL210813C00146000",
"index": "quotes",
"score": 20171,
"score": 20127,
"typeDisp": "Option",
"isYahooFinance": true
},
{
"exchange": "OPR",
"shortname": "AAPL Apr 2021 125.000 call",
"shortname": "AAPL Aug 2021 150.000 call",
"quoteType": "OPTION",
"symbol": "AAPL210409C00125000",
"symbol": "AAPL210813C00150000",
"index": "quotes",
"score": 20133,
"score": 20079,
"typeDisp": "Option",
"isYahooFinance": true
},
Expand All @@ -143,49 +143,51 @@
],
"news": [
{
"uuid": "c327e416-d091-3c59-97e2-aa93811f6972",
"title": "China’s Baidu Teams With Geely on Electric Cars",
"publisher": "Bloomberg",
"link": "https://finance.yahoo.com/news/china-baidu-teams-geely-electric-032150096.html",
"providerPublishTime": 1610076110,
"uuid": "e75104b4-1563-49fe-9085-b58b970574ab",
"title": "Samsung and Google take aim at the Apple Watch with the Galaxy Watch4 and Watch4 Classic",
"publisher": "Yahoo Finance",
"link": "https://finance.yahoo.com/news/samsung-galaxy-watch4-watch4-classic-versus-apple-watch-140046960.html",
"providerPublishTime": 1628690446,
"type": "STORY"
},
{
"uuid": "8575a1e6-0fec-34d7-a694-bcdce96c1165",
"title": "How Elliott Missed Out on This Apple Car Spike",
"publisher": "Bloomberg",
"link": "https://finance.yahoo.com/news/elliott-missed-apple-car-spike-043855102.html",
"providerPublishTime": 1610080735,
"uuid": "0db97a0f-58b2-39fd-a5fd-ef19244d020f",
"title": "Top 5 Blue-Chip Picks to Gain From Dow's Strong Rally",
"publisher": "Zacks",
"link": "https://finance.yahoo.com/news/top-5-blue-chip-picks-111811663.html",
"providerPublishTime": 1628680691,
"type": "STORY"
},
{
"uuid": "2f0480d0-2c80-3900-8769-dec0f8f100d5",
"title": "Apple Supplier TSMC’s Quarterly Revenue Hits Record on Strong iPhone Demand",
"publisher": "Bloomberg",
"link": "https://finance.yahoo.com/news/apple-supplier-tsmc-quarterly-revenue-054136718.html",
"providerPublishTime": 1610084496,
"uuid": "4f90f8a1-feed-379f-b666-0eb74e00f077",
"title": "Dow Jones Today Leads Stocks Higher After Inflation Data; Nucor, CAT, Vulcan Climb; AMD Leads Mixed Chip Sector",
"publisher": "Investor's Business Daily",
"link": "https://finance.yahoo.com/m/4f90f8a1-feed-379f-b666-0eb74e00f077/dow-jones-today-leads-stocks.html",
"providerPublishTime": 1628690429,
"type": "STORY"
},
{
"uuid": "0ee4adb2-5c90-3094-b3e7-1579f15530e7",
"title": "Samsung Surges to New High on Strong Memory Market Outlook",
"publisher": "Bloomberg",
"link": "https://finance.yahoo.com/news/samsung-misses-estimates-5g-contest-001537501.html",
"providerPublishTime": 1610089886,
"uuid": "65b53896-faf4-3a06-9d0d-a63cf3c83192",
"title": "5 Dow Jones Stocks To Buy And Watch In August 2021: Apple Rallies",
"publisher": "Investor's Business Daily",
"link": "https://finance.yahoo.com/m/65b53896-faf4-3a06-9d0d-a63cf3c83192/5-dow-jones-stocks-to-buy-and.html",
"providerPublishTime": 1628689233,
"type": "STORY"
}
],
"nav": [],
"lists": [],
"researchReports": [],
"totalTime": 54,
"timeTakenForQuotes": 446,
"screenerFieldResults": [],
"totalTime": 35,
"timeTakenForQuotes": 420,
"timeTakenForNews": 600,
"timeTakenForAlgowatchlist": 400,
"timeTakenForPredefinedScreener": 400,
"timeTakenForCrunchbase": 400,
"timeTakenForNav": 400,
"timeTakenForResearchReports": 0
"timeTakenForResearchReports": 0,
"timeTakenForScreenerField": 0
}
}
}
Loading

0 comments on commit 2b23ccb

Please sign in to comment.