Skip to content

Commit

Permalink
fix(quote): equity: allow underlyingSymbol. LDN.MI test (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Dec 21, 2021
1 parent 3a0a369 commit 817410b
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 5 deletions.
31 changes: 26 additions & 5 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -1815,6 +1818,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -2142,6 +2148,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -2437,6 +2446,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -2732,6 +2744,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -3027,6 +3042,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -3322,6 +3340,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -3360,9 +3381,6 @@
},
"expireIsoDate": {
"yahooFinanceType": "number"
},
"underlyingSymbol": {
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -3637,6 +3655,9 @@
"symbol": {
"type": "string"
},
"underlyingSymbol": {
"type": "string"
},
"ytdReturn": {
"yahooFinanceType": "number"
},
Expand Down Expand Up @@ -3800,6 +3821,7 @@
"averageDailyVolume10Day",
"displayName",
"symbol",
"underlyingSymbol",
"ytdReturn",
"trailingThreeMonthReturns",
"trailingThreeMonthNavReturns",
Expand All @@ -3812,8 +3834,7 @@
"strike",
"openInterest",
"expireDate",
"expireIsoDate",
"underlyingSymbol"
"expireIsoDate"
]
},
"ResultType": {
Expand Down
1 change: 1 addition & 0 deletions src/modules/quote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const testSymbols = [
...testSymbolsOriginal,
"AZT.OL", // Far less properties than other symbols (#42)
"AAPL220121C00025000", // Option
"LDO.MI", // additionalProperty: underlyingSymbol (#363)
];

const marketStates = [
Expand Down
1 change: 1 addition & 0 deletions src/modules/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface QuoteBase {
averageDailyVolume10Day?: number; // 5546385,
displayName?: string; // "NVIDIA",
symbol: string; // "NVDA"
underlyingSymbol?: string; // "LD.MI" (for LDO.MI, #363)
// only on ETF? not on EQUITY?
ytdReturn?: number; // 0.31
trailingThreeMonthReturns?: number; // 16.98
Expand Down
146 changes: 146 additions & 0 deletions tests/http/quote-LDO.MI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"request": {
"url": "https://query2.finance.yahoo.com/v7/finance/quote?symbols=LDO.MI"
},
"response": {
"ok": true,
"status": 200,
"statusText": "OK",
"headers": {
"content-type": [
"application/json;charset=utf-8"
],
"vary": [
"Origin,Accept-Encoding"
],
"cache-control": [
"public, max-age=1, stale-while-revalidate=9"
],
"y-rid": [
"atgppepgs362s"
],
"x-yahoo-request-id": [
"atgppepgs362s"
],
"x-request-id": [
"a23dafae-533d-4ee7-b4dc-70745fe76deb"
],
"content-length": [
"1938"
],
"x-envoy-upstream-service-time": [
"1"
],
"date": [
"Tue, 21 Dec 2021 09:03:23 GMT"
],
"server": [
"ATS"
],
"x-envoy-decorator-operation": [
"finance-quote-api--mtls-production-ir2.finance-k8s.svc.yahoo.local:4080/*"
],
"age": [
"1"
],
"strict-transport-security": [
"max-age=15552000"
],
"referrer-policy": [
"no-referrer-when-downgrade"
],
"x-frame-options": [
"SAMEORIGIN"
],
"connection": [
"close"
],
"expect-ct": [
"max-age=31536000, report-uri=\"http://csp.yahoo.com/beacon/csp?src=yahoocom-expect-ct-report-only\""
],
"x-xss-protection": [
"1; mode=block"
],
"x-content-type-options": [
"nosniff"
]
},
"bodyJson": {
"quoteResponse": {
"result": [
{
"language": "en-US",
"region": "US",
"quoteType": "EQUITY",
"triggerable": false,
"currency": "EUR",
"shortName": "LEONARDO",
"epsTrailingTwelveMonths": 0.578,
"epsForward": 1.21,
"epsCurrentYear": 1.13,
"priceEpsCurrentYear": 5.2778764,
"sharesOutstanding": 575174016,
"bookValue": 10.196,
"fiftyDayAverage": 6.39064,
"fiftyDayAverageChange": -0.42663956,
"fiftyDayAverageChangePercent": -0.06676007,
"twoHundredDayAverage": 6.79327,
"twoHundredDayAverageChange": -0.8292699,
"twoHundredDayAverageChangePercent": -0.122072265,
"marketCap": 3430338048,
"forwardPE": 4.9289255,
"priceToBook": 0.5849353,
"sourceInterval": 20,
"exchangeDataDelayedBy": 0,
"tradeable": false,
"underlyingSymbol": "LD.MI",
"exchange": "MIL",
"longName": "Leonardo S.p.a.",
"messageBoardId": "finmb_688713",
"exchangeTimezoneName": "Europe/Rome",
"exchangeTimezoneShortName": "CET",
"gmtOffSetMilliseconds": 3600000,
"market": "it_market",
"esgPopulated": false,
"marketState": "REGULAR",
"firstTradeDateMilliseconds": 1121670000000,
"priceHint": 2,
"regularMarketChange": 0.018000126,
"regularMarketChangePercent": 0.30272663,
"regularMarketTime": 1640076483,
"regularMarketPrice": 5.964,
"regularMarketDayHigh": 5.998,
"regularMarketDayRange": "5.94 - 5.998",
"regularMarketDayLow": 5.94,
"regularMarketVolume": 317973,
"regularMarketPreviousClose": 5.946,
"bid": 5.96,
"ask": 5.964,
"bidSize": 0,
"askSize": 0,
"fullExchangeName": "Milan",
"financialCurrency": "EUR",
"regularMarketOpen": 5.984,
"averageDailyVolume3Month": 6120701,
"averageDailyVolume10Day": 4489689,
"fiftyTwoWeekLowChange": 0.54400015,
"fiftyTwoWeekLowChangePercent": 0.10036903,
"fiftyTwoWeekRange": "5.42 - 8.01",
"fiftyTwoWeekHighChange": -2.046,
"fiftyTwoWeekHighChangePercent": -0.2554307,
"fiftyTwoWeekLow": 5.42,
"fiftyTwoWeekHigh": 8.01,
"earningsTimestamp": 1646909940,
"earningsTimestampStart": 1646909940,
"earningsTimestampEnd": 1646909940,
"trailingAnnualDividendRate": 0.14,
"trailingPE": 10.318339,
"trailingAnnualDividendYield": 0.023545241,
"symbol": "LDO.MI"
}
],
"error": null
}
}
}
}

0 comments on commit 817410b

Please sign in to comment.