Skip to content

Commit

Permalink
fix(quoteSummary): add twitter? to {asset,summary}Profile (fixes #418)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 27, 2022
1 parent 4a77e61 commit 1c7c1cb
Show file tree
Hide file tree
Showing 33 changed files with 2,618 additions and 0 deletions.
6 changes: 6 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4361,6 +4361,9 @@
},
"description": {
"type": "string"
},
"twitter": {
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -6844,6 +6847,9 @@
"maxAge": {
"yahooFinanceType": "number"
},
"twitter": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down
2 changes: 2 additions & 0 deletions src/modules/quoteSummary-iface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface AssetProfile {
name?: string; // 'Bitcoin';
startDate?: Date; // new Date('2013-04-28')
description?: string; // 'Bitcoin (BTC) is a cryptocurrency...'
twitter?: string; // in e.g. "ADA-USD" (#418)
}

export interface CompanyOfficer {
Expand Down Expand Up @@ -812,6 +813,7 @@ export interface SummaryProfile {
fullTimeEmployees?: number;
companyOfficers: any[];
maxAge: number;
twitter?: string; // in e.g. "ADA-USD" (#418)

// seems like for cryptocurency only
// TODO: how does this relate to Quote type. Common base?
Expand Down
1 change: 1 addition & 0 deletions src/modules/quoteSummary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const testSymbols = [
// "Got {}->null for 'number', did you want 'number | null' ?"
"CMCOM.AS",
"CRM",
"ADA-USD", // has summaryProfile.twitter (#418)
];

const yf = testYf({ quoteSummary });
Expand Down
179 changes: 179 additions & 0 deletions tests/http/quoteSummary-all-ADA-USD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"request": {
"url": "https://query2.finance.yahoo.com/v10/finance/quoteSummary/ADA-USD?formatted=false&modules=assetProfile%2CbalanceSheetHistory%2CbalanceSheetHistoryQuarterly%2CcalendarEvents%2CcashflowStatementHistory%2CcashflowStatementHistoryQuarterly%2CdefaultKeyStatistics%2Cearnings%2CearningsHistory%2CearningsTrend%2CfinancialData%2CfundOwnership%2CfundPerformance%2CfundProfile%2CincomeStatementHistory%2CincomeStatementHistoryQuarterly%2CindexTrend%2CindustryTrend%2CinsiderHolders%2CinsiderTransactions%2CinstitutionOwnership%2CmajorDirectHolders%2CmajorHoldersBreakdown%2CnetSharePurchaseActivity%2Cprice%2CquoteType%2CrecommendationTrend%2CsecFilings%2CsectorTrend%2CsummaryDetail%2CsummaryProfile%2CtopHoldings%2CupgradeDowngradeHistory"
},
"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": [
"d44cbh5h1m80r"
],
"x-yahoo-request-id": [
"d44cbh5h1m80r"
],
"x-request-id": [
"5f54983c-0af5-479a-9c5a-af8155b0f75b"
],
"content-encoding": [
"gzip"
],
"content-length": [
"1143"
],
"x-envoy-upstream-service-time": [
"3"
],
"date": [
"Sun, 27 Feb 2022 06:54:19 GMT"
],
"server": [
"ATS"
],
"x-envoy-decorator-operation": [
"finance-company-fundamentals-api--mtls-production-ir2.finance-k8s.svc.yahoo.local:4080/*"
],
"age": [
"0"
],
"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": {
"quoteSummary": {
"result": [
{
"assetProfile": {
"companyOfficers": [],
"twitter": "cardano",
"name": "Cardano",
"startDate": "2017-10-01",
"description": "Cardano (ADA) is a cryptocurrency launched in 2017. Users are able to generate ADA through the process of mining. Cardano has a current supply of 33,865,878,493.804 with 34,159,578,343.084 in circulation. The last known price of Cardano is 1.23810133 USD and is down -2.94 over the last 24 hours. It is currently trading on 296 active market(s) with $1,366,111,865.81 traded over the last 24 hours. More information can be found at https://www.cardano.org.",
"maxAge": 86400
},
"summaryDetail": {
"maxAge": 1,
"priceHint": 6,
"previousClose": 0.88557297,
"open": 0.88557297,
"dayLow": 0.8567304,
"dayHigh": 0.8877995,
"regularMarketPreviousClose": 0.88557297,
"regularMarketOpen": 0.88557297,
"regularMarketDayLow": 0.8567304,
"regularMarketDayHigh": 0.8877995,
"volume": 962185024,
"regularMarketVolume": 962185024,
"averageVolume": 1758491441,
"averageVolume10days": 1718202781,
"averageDailyVolume10Day": 1718202781,
"marketCap": 29587828736,
"fiftyTwoWeekLow": 0.75281,
"fiftyTwoWeekHigh": 3.099186,
"fiftyDayAverage": 1.1174043,
"twoHundredDayAverage": 1.776637,
"currency": "USD",
"fromCurrency": "ADA",
"toCurrency": "USD=X",
"lastMarket": "CoinMarketCap",
"volume24Hr": 962185024,
"volumeAllCurrencies": 962185024,
"circulatingSupply": 33648140288,
"algorithm": null,
"startDate": 1506816000,
"tradeable": false
},
"summaryProfile": {
"companyOfficers": [],
"twitter": "cardano",
"name": "Cardano",
"startDate": "2017-10-01",
"description": "Cardano (ADA) is a cryptocurrency launched in 2017. Users are able to generate ADA through the process of mining. Cardano has a current supply of 33,865,878,493.804 with 34,159,578,343.084 in circulation. The last known price of Cardano is 1.23810133 USD and is down -2.94 over the last 24 hours. It is currently trading on 296 active market(s) with $1,366,111,865.81 traded over the last 24 hours. More information can be found at https://www.cardano.org.",
"maxAge": 86400
},
"quoteType": {
"exchange": "CCC",
"quoteType": "CRYPTOCURRENCY",
"symbol": "ADA-USD",
"underlyingSymbol": "ADA-USD",
"shortName": "Cardano USD",
"longName": null,
"firstTradeDateEpochUtc": 1506816000,
"timeZoneFullName": "UTC",
"timeZoneShortName": "UTC",
"uuid": "47f02c2c-c775-38f0-9898-64937a28f300",
"messageBoardId": "finmb_ADA_CCC",
"gmtOffSetMilliseconds": 0,
"maxAge": 1
},
"price": {
"maxAge": 1,
"regularMarketChangePercent": -0.029904587,
"regularMarketChange": -0.027106643,
"regularMarketTime": 1645944720,
"priceHint": 6,
"regularMarketPrice": 0.8793303,
"regularMarketDayHigh": 0.8877995,
"regularMarketDayLow": 0.8567304,
"regularMarketVolume": 962185024,
"averageDailyVolume10Day": 1718202781,
"averageDailyVolume3Month": 1758491441,
"regularMarketPreviousClose": 0.88557297,
"regularMarketSource": "FREE_REALTIME",
"regularMarketOpen": 0.88557297,
"exchange": "CCC",
"exchangeName": "CCC",
"exchangeDataDelayedBy": 0,
"marketState": "REGULAR",
"quoteType": "CRYPTOCURRENCY",
"symbol": "ADA-USD",
"underlyingSymbol": null,
"shortName": "Cardano USD",
"longName": null,
"currency": "USD",
"quoteSourceName": "CoinMarketCap",
"currencySymbol": "$",
"fromCurrency": "ADA",
"toCurrency": "USD=X",
"lastMarket": "CoinMarketCap",
"volume24Hr": 962185024,
"volumeAllCurrencies": 962185024,
"circulatingSupply": 33648140288,
"marketCap": 29587828736
}
}
],
"error": null
}
}
}
}
86 changes: 86 additions & 0 deletions tests/http/quoteSummary-assetProfile-ADA-USD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"request": {
"url": "https://query2.finance.yahoo.com/v10/finance/quoteSummary/ADA-USD?formatted=false&modules=assetProfile"
},
"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": [
"fch5g6ph1m800"
],
"x-yahoo-request-id": [
"fch5g6ph1m800"
],
"x-request-id": [
"f55da2b4-72bf-4b5d-aa83-94cf9fd6be39"
],
"content-length": [
"632"
],
"x-envoy-upstream-service-time": [
"1"
],
"date": [
"Sun, 27 Feb 2022 06:53:52 GMT"
],
"server": [
"ATS"
],
"x-envoy-decorator-operation": [
"finance-company-fundamentals-api--mtls-production-ir2.finance-k8s.svc.yahoo.local:4080/*"
],
"age": [
"0"
],
"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": {
"quoteSummary": {
"result": [
{
"assetProfile": {
"companyOfficers": [],
"twitter": "cardano",
"name": "Cardano",
"startDate": "2017-10-01",
"description": "Cardano (ADA) is a cryptocurrency launched in 2017. Users are able to generate ADA through the process of mining. Cardano has a current supply of 33,865,878,493.804 with 34,159,578,343.084 in circulation. The last known price of Cardano is 1.23810133 USD and is down -2.94 over the last 24 hours. It is currently trading on 296 active market(s) with $1,366,111,865.81 traded over the last 24 hours. More information can be found at https://www.cardano.org.",
"maxAge": 86400
}
}
],
"error": null
}
}
}
}
81 changes: 81 additions & 0 deletions tests/http/quoteSummary-balanceSheetHistory-ADA-USD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"request": {
"url": "https://query2.finance.yahoo.com/v10/finance/quoteSummary/ADA-USD?formatted=false&modules=balanceSheetHistory"
},
"response": {
"ok": false,
"status": 404,
"statusText": "Not Found",
"headers": {
"content-type": [
"application/json;charset=utf-8"
],
"vary": [
"Origin"
],
"y-rid": [
"aqbrouth1m801"
],
"x-yahoo-request-id": [
"aqbrouth1m801"
],
"x-request-id": [
"f9413a2e-d965-45ad-8eb6-b9cea180cb0a"
],
"content-length": [
"152"
],
"x-envoy-upstream-service-time": [
"1"
],
"date": [
"Sun, 27 Feb 2022 06:53:53 GMT"
],
"server": [
"ATS"
],
"x-envoy-decorator-operation": [
"finance-company-fundamentals-api--mtls-production-ir2.finance-k8s.svc.yahoo.local:4080/*"
],
"cache-control": [
"max-age=0, private"
],
"expires": [
"-1"
],
"age": [
"0"
],
"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": {
"quoteSummary": {
"result": null,
"error": {
"code": "Not Found",
"description": "No fundamentals data found for any of the summaryTypes=balanceSheetHistory"
}
}
}
}
}
Loading

0 comments on commit 1c7c1cb

Please sign in to comment.