Skip to content

Commit

Permalink
fix(validation): more optionality, SQYFuture type, more tests
Browse files Browse the repository at this point in the history
* test: add more symbols to test against
* fix(validation): fix the validation for the new symbols added
* refactor(search.ts): add SearchQuoteYahooFuture enum
  • Loading branch information
advaiyalad authored Feb 21, 2021
1 parent 16eea3e commit 4377fdf
Show file tree
Hide file tree
Showing 220 changed files with 97,851 additions and 3 deletions.
59 changes: 57 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@
"Grade": {
"enum": [
"Accumulate",
"Add",
"Buy",
"",
"Equal-Weight",
Expand All @@ -1664,6 +1665,7 @@
"Sell",
"Strong Buy",
"Underperform",
"Underperformer",
"Underweight"
],
"type": "string"
Expand Down Expand Up @@ -1897,7 +1899,7 @@
"yahooFinanceType": "number"
},
"interestExpense": {
"yahooFinanceType": "number"
"yahooFinanceType": "number|null"
},
"maxAge": {
"yahooFinanceType": "number"
Expand Down Expand Up @@ -4436,6 +4438,55 @@
],
"type": "object"
},
"SearchQuoteYahooFuture": {
"additionalProperties": false,
"properties": {
"exchange": {
"type": "string"
},
"index": {
"const": "quotes",
"type": "string"
},
"isYahooFinance": {
"const": true,
"type": "boolean"
},
"longname": {
"type": "string"
},
"newListingDate": {
"yahooFinanceType": "date"
},
"quoteType": {
"const": "FUTURE",
"type": "string"
},
"score": {
"yahooFinanceType": "number"
},
"shortname": {
"type": "string"
},
"symbol": {
"type": "string"
},
"typeDisp": {
"const": "Future",
"type": "string"
}
},
"required": [
"exchange",
"index",
"isYahooFinance",
"quoteType",
"score",
"symbol",
"typeDisp"
],
"type": "object"
},
"SearchQuoteYahooIndex": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -4584,6 +4635,9 @@
},
{
"$ref": "#/definitions/SearchQuoteNonYahoo"
},
{
"$ref": "#/definitions/SearchQuoteYahooFuture"
}
]
},
Expand Down Expand Up @@ -5207,7 +5261,8 @@
"10-K",
"10-Q",
"8-K",
"8-K/A"
"8-K/A",
"10-K/A"
],
"type": "string"
},
Expand Down
5 changes: 4 additions & 1 deletion src/modules/quoteSummary-iface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export interface IncomeStatementHistoryElement {
operatingIncome: number;
totalOtherIncomeExpenseNet: number;
ebit: number;
interestExpense: number;
interestExpense: number | null;
incomeBeforeTax: number;
incomeTaxExpense: number;
minorityInterest: number | null;
Expand Down Expand Up @@ -727,6 +727,7 @@ export enum Type {
The10Q = "10-Q",
The8K = "8-K",
The8KA = "8-K/A",
The10KA = "10-K/A",
}

export interface SummaryDetail {
Expand Down Expand Up @@ -881,6 +882,7 @@ export enum Action {

export enum Grade {
Accumulate = "Accumulate",
Add = "Add",
Buy = "Buy",
Empty = "",
EqualWeight = "Equal-Weight",
Expand All @@ -906,5 +908,6 @@ export enum Grade {
Sell = "Sell",
StrongBuy = "Strong Buy",
Underperform = "Underperform",
Underperformer = "Underperformer",
Underweight = "Underweight",
}
7 changes: 7 additions & 0 deletions src/modules/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export interface SearchQuoteYahooCryptocurrency extends SearchQuoteYahoo {
quoteType: "CRYPTOCURRENCY";
typeDisp: "Cryptocurrency";
}

export interface SearchQuoteYahooFuture extends SearchQuoteYahoo {
quoteType: "FUTURE";
typeDisp: "Future";
}

export interface SearchQuoteNonYahoo {
index: string; // '78ddc07626ff4bbcae663e88514c23a0'
name: string; // 'AAPlasma'
Expand Down Expand Up @@ -71,6 +77,7 @@ export interface SearchResult {
| SearchQuoteYahooCurrency
| SearchQuoteYahooCryptocurrency
| SearchQuoteNonYahoo
| SearchQuoteYahooFuture
>;
news: Array<SearchNews>;
nav: Array<any>;
Expand Down
139 changes: 139 additions & 0 deletions tests/http/autoc-ABBV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"request": {
"url": "https://autoc.finance.yahoo.com/autoc?region=1&lang=en&query=ABBV"
},
"response": {
"ok": true,
"status": 200,
"statusText": "OK",
"headers": {
"x-content-type-options": [
"nosniff"
],
"x-yahoo-request-id": [
"ftsb68dg2vse0"
],
"cache-control": [
"public, max-age=300, stale-while-revalidate=30, stale-if-error=3600"
],
"content-encoding": [
"gzip"
],
"content-type": [
"application/json;charset=utf-8"
],
"content-length": [
"309"
],
"date": [
"Fri, 19 Feb 2021 17:13:36 GMT"
],
"age": [
"0"
],
"strict-transport-security": [
"max-age=31536000"
],
"server": [
"ATS"
],
"expect-ct": [
"max-age=31536000, report-uri=\"http://csp.yahoo.com/beacon/csp?src=yahoocom-expect-ct-report-only\""
],
"public-key-pins-report-only": [
"max-age=2592000; pin-sha256=\"2fRAUXyxl4A1/XHrKNBmc8bTkzA7y4FB/GLJuNAzCqY=\"; pin-sha256=\"I/Lt/z7ekCWanjD0Cvj5EqXls2lOaThEA0H2Bg4BT/o=\"; pin-sha256=\"K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q=\"; pin-sha256=\"Wd8xe/qfTwq3ylFNd3IpaqLHZbh2ZNCLluVzmeNkcpw=\"; pin-sha256=\"WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=\"; pin-sha256=\"cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A=\"; pin-sha256=\"dolnbtzEBnELx/9lOEQ22e6OZO/QNb6VSSX2XHA3E7A=\"; pin-sha256=\"i7WTqTvh0OioIruIfFR4kMPnBqrS2rdiVPl/s2uC/CY=\"; pin-sha256=\"r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=\"; pin-sha256=\"uUwZgwDOxcBXrQcntwu+kYFpkiVkOaezL0WYEZ3anJc=\"; includeSubdomains; report-uri=\"http://csp.yahoo.com/beacon/csp?src=yahoocom-hpkp-report-only\""
],
"x-frame-options": [
"SAMEORIGIN"
],
"x-xss-protection": [
"1; mode=block"
],
"referrer-policy": [
"no-referrer-when-downgrade"
],
"connection": [
"close"
]
},
"bodyJson": {
"ResultSet": {
"Query": "ABBV",
"Result": [
{
"symbol": "ABBV",
"name": "AbbVie Inc.",
"exch": "NYQ",
"type": "S",
"exchDisp": "NYSE",
"typeDisp": "Equity"
},
{
"symbol": "ABBV34.SA",
"name": "AbbVie Inc.",
"exch": "SAO",
"type": "S",
"exchDisp": "Sao Paolo",
"typeDisp": "Equity"
},
{
"symbol": "4AB.F",
"name": "AbbVie Inc.",
"exch": "FRA",
"type": "S",
"exchDisp": "Frankfurt",
"typeDisp": "Equity"
},
{
"symbol": "4AB.DE",
"name": "AbbVie Inc.",
"exch": "GER",
"type": "S",
"exchDisp": "XETRA",
"typeDisp": "Equity"
},
{
"symbol": "ABBV.VI",
"name": "AbbVie Inc.",
"exch": "VIE",
"type": "S",
"exchDisp": "Vienna",
"typeDisp": "Equity"
},
{
"symbol": "ABBV.MX",
"name": "AbbVie Inc.",
"exch": "MEX",
"type": "S",
"exchDisp": "Mexico",
"typeDisp": "Equity"
},
{
"symbol": "4AB.SG",
"name": "AbbVie Inc. Registered Shares D",
"exch": "STU",
"type": "S",
"exchDisp": "Stuttgart",
"typeDisp": "Equity"
},
{
"symbol": "4AB.DU",
"name": "ABBVIE INC. DL-,01",
"exch": "DUS",
"type": "S",
"exchDisp": "Dusseldorf Stock Exchange",
"typeDisp": "Equity"
},
{
"symbol": "4AB.BE",
"name": "ABBVIE INC. DL-,01",
"exch": "BER",
"type": "S",
"exchDisp": "Berlin",
"typeDisp": "Equity"
}
]
}
}
}
}
Loading

0 comments on commit 4377fdf

Please sign in to comment.