Skip to content

Commit

Permalink
fix(search): add types for new fields
Browse files Browse the repository at this point in the history
sector,industry,displaySecIndFlag,thumbnail,relatedTickers
  • Loading branch information
gadicc committed Jun 30, 2022
1 parent 7d556be commit 714d891
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
126 changes: 126 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7760,6 +7760,15 @@
},
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
}
},
"required": [
Expand Down Expand Up @@ -7808,6 +7817,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "EQUITY"
Expand Down Expand Up @@ -7865,6 +7883,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "OPTION"
Expand Down Expand Up @@ -7922,6 +7949,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "ETF"
Expand Down Expand Up @@ -7979,6 +8015,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "MUTUALFUND"
Expand Down Expand Up @@ -8036,6 +8081,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "INDEX"
Expand Down Expand Up @@ -8093,6 +8147,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "CURRENCY"
Expand Down Expand Up @@ -8150,6 +8213,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "CRYPTOCURRENCY"
Expand Down Expand Up @@ -8207,6 +8279,15 @@
"nameChangeDate": {
"yahooFinanceType": "date"
},
"sector": {
"type": "string"
},
"industry": {
"type": "string"
},
"dispSecIndFlag": {
"type": "boolean"
},
"quoteType": {
"type": "string",
"const": "FUTURE"
Expand Down Expand Up @@ -8270,6 +8351,27 @@
},
"type": {
"type": "string"
},
"thumbnail": {
"type": "object",
"properties": {
"resolutions": {
"type": "array",
"items": {
"$ref": "#/definitions/SearchNewsThumbnailResolution"
}
}
},
"required": [
"resolutions"
],
"additionalProperties": false
},
"relatedTickers": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
Expand All @@ -8281,6 +8383,30 @@
"type"
]
},
"SearchNewsThumbnailResolution": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"width": {
"yahooFinanceType": "number"
},
"height": {
"yahooFinanceType": "number"
},
"tag": {
"type": "string"
}
},
"required": [
"url",
"width",
"height",
"tag"
],
"additionalProperties": false
},
"SearchResult": {
"type": "object",
"properties": {
Expand Down
12 changes: 12 additions & 0 deletions src/modules/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export interface SearchQuoteYahoo {
newListingDate?: Date; // "2021-02-16"
prevName?: string;
nameChangeDate?: Date;
sector?: string; // "Industrials"
industry?: string; // "Building Products & Equipment"
dispSecIndFlag?: boolean; // true
}
export interface SearchQuoteYahooEquity extends SearchQuoteYahoo {
quoteType: "EQUITY";
Expand Down Expand Up @@ -69,6 +72,15 @@ export interface SearchNews {
link: string; // "https://finance.yahoo.com/m/9aff624a-e84c-35f3-9c23-db39852006dc/analyst-report%3A-alibaba-group.html"
providerPublishTime: Date; // coerced to new Date(1611286342 * 1000)
type: string; // "STORY" TODO "STORY" | ???
thumbnail?: { resolutions: SearchNewsThumbnailResolution[] };
relatedTickers?: string[]; // [ "AAPL" ]
}

export interface SearchNewsThumbnailResolution {
url: string;
width: number;
height: number;
tag: string;
}

export interface SearchResult {
Expand Down

0 comments on commit 714d891

Please sign in to comment.