From 904934acfe05c21424daad21da93ab2141214de6 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Wed, 3 Feb 2021 10:49:31 +0200 Subject: [PATCH] fix(quoteSummary): iface fixes, TopHoldings --- schema.json | 175 +++++++++++++++++++++++++++++- src/modules/quoteSummary-iface.ts | 61 ++++++++++- 2 files changed, 226 insertions(+), 10 deletions(-) diff --git a/schema.json b/schema.json index 08440ed1..9f18b413 100644 --- a/schema.json +++ b/schema.json @@ -294,9 +294,6 @@ "otherLiab", "totalCurrentLiabilities", "totalLiab", - "retainedEarnings", - "treasuryStock", - "otherStockholderEquity", "totalStockholderEquity", "netTangibleAssets" ], @@ -306,13 +303,13 @@ "additionalProperties": false, "properties": { "dividendDate": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "earnings": { "$ref": "#/definitions/CalendarEventsEarnings" }, "exDividendDate": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "maxAge": { "yahooFinanceType": "number" @@ -1948,6 +1945,9 @@ "summaryProfile": { "$ref": "#/definitions/SummaryProfile" }, + "topHoldings": { + "$ref": "#/definitions/TopHoldings" + }, "upgradeDowngradeHistory": { "$ref": "#/definitions/UpgradeDowngradeHistory" } @@ -2705,6 +2705,171 @@ ], "type": "object" }, + "TopHoldings": { + "additionalProperties": false, + "properties": { + "bondHoldings": { + "type": "object" + }, + "bondPosition": { + "yahooFinanceType": "number" + }, + "bondRatings": { + "items": { + "$ref": "#/definitions/TopHoldingsBondRating" + }, + "type": "array" + }, + "equityHoldings": { + "$ref": "#/definitions/TopHoldingsEquityHoldings" + }, + "holdings": { + "items": { + "$ref": "#/definitions/TopHoldingsHolding" + }, + "type": "array" + }, + "maxAge": { + "yahooFinanceType": "number" + }, + "sectorWeightings": { + "items": { + "$ref": "#/definitions/TopHoldingsSectorWeighting" + }, + "type": "array" + }, + "stockPosition": { + "yahooFinanceType": "number" + } + }, + "required": [ + "maxAge", + "stockPosition", + "bondPosition", + "holdings", + "equityHoldings", + "bondHoldings", + "bondRatings", + "sectorWeightings" + ], + "type": "object" + }, + "TopHoldingsBondRating": { + "additionalProperties": false, + "properties": { + "a": { + "yahooFinanceType": "number" + }, + "aa": { + "yahooFinanceType": "number" + }, + "aaa": { + "yahooFinanceType": "number" + }, + "b": { + "yahooFinanceType": "number" + }, + "bb": { + "yahooFinanceType": "number" + }, + "bbb": { + "yahooFinanceType": "number" + }, + "below_b": { + "yahooFinanceType": "number" + }, + "other": { + "yahooFinanceType": "number" + }, + "us_government": { + "yahooFinanceType": "number" + } + }, + "type": "object" + }, + "TopHoldingsEquityHoldings": { + "additionalProperties": false, + "properties": { + "priceToBook": { + "yahooFinanceType": "number" + }, + "priceToCashflow": { + "yahooFinanceType": "number" + }, + "priceToEarnings": { + "yahooFinanceType": "number" + }, + "priceToSales": { + "yahooFinanceType": "number" + } + }, + "required": [ + "priceToEarnings", + "priceToBook", + "priceToSales", + "priceToCashflow" + ], + "type": "object" + }, + "TopHoldingsHolding": { + "additionalProperties": false, + "properties": { + "holdingName": { + "type": "string" + }, + "holdingPercent": { + "yahooFinanceType": "number" + }, + "symbol": { + "type": "string" + } + }, + "required": [ + "symbol", + "holdingName", + "holdingPercent" + ], + "type": "object" + }, + "TopHoldingsSectorWeighting": { + "additionalProperties": false, + "properties": { + "basic_materials": { + "yahooFinanceType": "number" + }, + "communication_services": { + "yahooFinanceType": "number" + }, + "consumer_cyclical": { + "yahooFinanceType": "number" + }, + "consumer_defensive": { + "yahooFinanceType": "number" + }, + "energy": { + "yahooFinanceType": "number" + }, + "financial_services": { + "yahooFinanceType": "number" + }, + "healthcare": { + "yahooFinanceType": "number" + }, + "industrials": { + "yahooFinanceType": "number" + }, + "realestate": { + "yahooFinanceType": "number" + }, + "technology": { + "yahooFinanceType": "number" + }, + "utilities": { + "yahooFinanceType": "number" + } + }, + "type": "object" + }, "Transaction": { "additionalProperties": false, "properties": { diff --git a/src/modules/quoteSummary-iface.ts b/src/modules/quoteSummary-iface.ts index cb9286be..b4ac2f19 100644 --- a/src/modules/quoteSummary-iface.ts +++ b/src/modules/quoteSummary-iface.ts @@ -41,6 +41,7 @@ export interface QuoteSummaryResult { sectorTrend?: Trend; summaryDetail?: SummaryDetail; summaryProfile?: SummaryProfile; + topHoldings?: TopHoldings; upgradeDowngradeHistory?: UpgradeDowngradeHistory; } @@ -107,9 +108,9 @@ export interface BalanceSheetStatement { totalCurrentLiabilities: number; totalLiab: number; commonStock?: number; - retainedEarnings: number; - treasuryStock: number; - otherStockholderEquity: number; + retainedEarnings?: number; + treasuryStock?: number; + otherStockholderEquity?: number; totalStockholderEquity: number; netTangibleAssets: number; goodWill?: number; @@ -123,8 +124,8 @@ export interface BalanceSheetStatement { export interface CalendarEvents { maxAge: number; earnings: CalendarEventsEarnings; - exDividendDate?: number; - dividendDate?: number; + exDividendDate?: Date; + dividendDate?: Date; } export interface CalendarEventsEarnings { @@ -653,6 +654,56 @@ export interface SummaryProfile { fax?: string; } +export interface TopHoldings { + maxAge: number; + stockPosition: number; + bondPosition: number; + holdings: TopHoldingsHolding[]; + equityHoldings: TopHoldingsEquityHoldings; + bondHoldings: object; + bondRatings: TopHoldingsBondRating[]; + sectorWeightings: TopHoldingsSectorWeighting[]; +} + +export interface TopHoldingsHolding { + symbol: string; + holdingName: string; + holdingPercent: number; +} + +export interface TopHoldingsEquityHoldings { + priceToEarnings: number; + priceToBook: number; + priceToSales: number; + priceToCashflow: number; +} + +export interface TopHoldingsBondRating { + a?: number; + aa?: number; + aaa?: number; + other?: number; + b?: number; + bb?: number; + bbb?: number; + below_b?: number; + us_government?: number; +} + +export interface TopHoldingsSectorWeighting { + realestate?: number; + consumer_cyclical?: number; + basic_materials?: number; + consumer_defensive?: number; + technology?: number; + communication_services?: number; + financial_services?: number; + utilities?: number; + industrials?: number; + energy?: number; + healthcare?: number; +} + export interface UpgradeDowngradeHistory { history: UpgradeDowngradeHistoryHistory[]; maxAge: number;