From 4d19692dc80cca136eb97c88602a9f759b692195 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Sat, 6 Feb 2021 07:41:04 +0200 Subject: [PATCH] fix(quoteSummary/iface): additional fixes for mutual fund types (#20) --- schema.json | 221 ++++++++++++++++++++++++------ src/modules/quoteSummary-iface.ts | 163 ++++++++++++++-------- 2 files changed, 283 insertions(+), 101 deletions(-) diff --git a/schema.json b/schema.json index 0d45c04c..6e336d7c 100644 --- a/schema.json +++ b/schema.json @@ -30,6 +30,9 @@ "address2": { "type": "string" }, + "address3": { + "type": "string" + }, "auditRisk": { "yahooFinanceType": "number" }, @@ -95,10 +98,10 @@ } }, "required": [ + "maxAge", "phone", "longBusinessSummary", - "companyOfficers", - "maxAge" + "companyOfficers" ], "type": "object" }, @@ -546,6 +549,12 @@ "SandP52WeekChange": { "yahooFinanceType": "number" }, + "annualHoldingsTurnover": { + "yahooFinanceType": "number" + }, + "annualReportExpenseRatio": { + "yahooFinanceType": "number" + }, "beta": { "yahooFinanceType": "number" }, @@ -603,6 +612,9 @@ "heldPercentInstitutions": { "yahooFinanceType": "number" }, + "lastCapGain": { + "yahooFinanceType": "number" + }, "lastDividendDate": { "yahooFinanceType": "number" }, @@ -630,6 +642,12 @@ "maxAge": { "yahooFinanceType": "number" }, + "morningStarOverallRating": { + "yahooFinanceType": "number" + }, + "morningStarRiskRating": { + "yahooFinanceType": "number" + }, "mostRecentQuarter": { "yahooFinanceType": "number" }, @@ -1240,6 +1258,9 @@ "annualTotalReturns": { "$ref": "#/definitions/FundPerformanceReturns" }, + "loadAdjustedReturns": { + "$ref": "#/definitions/PeriodRange" + }, "maxAge": { "yahooFinanceType": "number" }, @@ -1252,6 +1273,9 @@ "performanceOverviewCat": { "$ref": "#/definitions/FundPerformancePerformanceOverviewCat" }, + "rankInCategory": { + "$ref": "#/definitions/PeriodRange" + }, "riskOverviewStatistics": { "$ref": "#/definitions/FundPerformanceRiskOverviewStats" }, @@ -1288,22 +1312,37 @@ "asOfDate": { "yahooFinanceType": "date" }, + "bestOneYrTotalReturn": { + "yahooFinanceType": "number" + }, + "bestThreeYrTotalReturn": { + "yahooFinanceType": "number" + }, + "morningStarReturnRating": { + "yahooFinanceType": "number" + }, + "numYearsDown": { + "yahooFinanceType": "number" + }, + "numYearsUp": { + "yahooFinanceType": "number" + }, "oneYearTotalReturn": { "yahooFinanceType": "number" }, "threeYearTotalReturn": { "yahooFinanceType": "number" }, + "worstOneYrTotalReturn": { + "yahooFinanceType": "number" + }, + "worstThreeYrTotalReturn": { + "yahooFinanceType": "number" + }, "ytdReturnPct": { "yahooFinanceType": "number" } }, - "required": [ - "asOfDate", - "ytdReturnPct", - "oneYearTotalReturn", - "threeYearTotalReturn" - ], "type": "object" }, "FundPerformancePerformanceOverviewCat": { @@ -1316,10 +1355,6 @@ "yahooFinanceType": "number" } }, - "required": [ - "ytdReturnPct", - "fiveYrAvgReturnPct" - ], "type": "object" }, "FundPerformanceReturns": { @@ -1349,6 +1384,18 @@ "annualValue": { "yahooFinanceType": "number" }, + "q1": { + "yahooFinanceType": "number" + }, + "q2": { + "yahooFinanceType": "number" + }, + "q3": { + "yahooFinanceType": "number" + }, + "q4": { + "yahooFinanceType": "number" + }, "year": { "yahooFinanceType": "number" } @@ -1361,6 +1408,9 @@ "FundPerformanceRiskOverviewStats": { "additionalProperties": false, "properties": { + "riskRating": { + "yahooFinanceType": "number" + }, "riskStatistics": { "items": { "$ref": "#/definitions/FundPerformanceRiskOverviewStatsRow" @@ -1462,10 +1512,6 @@ "yahooFinanceType": "number" } }, - "required": [ - "ytd", - "oneMonth" - ], "type": "object" }, "FundProfile": { @@ -1489,8 +1535,20 @@ "feesExpensesInvestmentCat": { "$ref": "#/definitions/FundProfileFeesExpensesInvestmentCat" }, + "initAipInvestment": { + "yahooFinanceType": "number" + }, + "initInvestment": { + "yahooFinanceType": "number" + }, + "initIraInvestment": { + "yahooFinanceType": "number" + }, "legalType": { - "type": "string" + "type": [ + "null", + "string" + ] }, "managementInfo": { "$ref": "#/definitions/FundProfileManagementInfo" @@ -1500,6 +1558,15 @@ }, "styleBoxUrl": { "type": "string" + }, + "subseqAipInvestment": { + "yahooFinanceType": "number" + }, + "subseqInvestment": { + "yahooFinanceType": "number" + }, + "subseqIraInvestment": { + "yahooFinanceType": "number" } }, "required": [ @@ -1525,6 +1592,12 @@ "annualReportExpenseRatio": { "yahooFinanceType": "number" }, + "grossExpRatio": { + "yahooFinanceType": "number" + }, + "netExpRatio": { + "yahooFinanceType": "number" + }, "projectionValues": { "type": "object" }, @@ -1534,8 +1607,6 @@ }, "required": [ "annualReportExpenseRatio", - "annualHoldingsTurnover", - "totalNetAssets", "projectionValues" ], "type": "object" @@ -1549,6 +1620,12 @@ "annualReportExpenseRatio": { "yahooFinanceType": "number" }, + "grossExpRatio": { + "yahooFinanceType": "number" + }, + "netExpRatio": { + "yahooFinanceType": "number" + }, "projectionValuesCat": { "type": "object" }, @@ -1557,10 +1634,8 @@ } }, "required": [ - "annualHoldingsTurnover", "annualReportExpenseRatio", - "projectionValuesCat", - "totalNetAssets" + "projectionValuesCat" ], "type": "object" }, @@ -1578,6 +1653,9 @@ "null", "string" ] + }, + "startdate": { + "yahooFinanceType": "date" } }, "required": [ @@ -2224,6 +2302,36 @@ ], "type": "object" }, + "PeriodRange": { + "additionalProperties": false, + "properties": { + "asOfDate": { + "yahooFinanceType": "date" + }, + "fiveYear": { + "yahooFinanceType": "number" + }, + "oneMonth": { + "yahooFinanceType": "number" + }, + "oneYear": { + "yahooFinanceType": "number" + }, + "tenYear": { + "yahooFinanceType": "number" + }, + "threeMonth": { + "yahooFinanceType": "number" + }, + "threeYear": { + "yahooFinanceType": "number" + }, + "ytd": { + "yahooFinanceType": "number" + } + }, + "type": "object" + }, "Price": { "additionalProperties": false, "properties": { @@ -2367,12 +2475,8 @@ "regularMarketChange", "regularMarketTime", "regularMarketPrice", - "regularMarketDayHigh", - "regularMarketDayLow", - "regularMarketVolume", "regularMarketPreviousClose", "regularMarketSource", - "regularMarketOpen", "quoteSourceName", "quoteType", "symbol", @@ -2600,7 +2704,10 @@ "yahooFinanceType": "number" }, "messageBoardId": { - "type": "string" + "type": [ + "null", + "string" + ] }, "quoteType": { "type": "string" @@ -3184,28 +3291,19 @@ }, "yield": { "yahooFinanceType": "number" + }, + "ytdReturn": { + "yahooFinanceType": "number" } }, "required": [ "maxAge", "priceHint", "previousClose", - "open", - "dayLow", - "dayHigh", "regularMarketPreviousClose", - "regularMarketOpen", - "regularMarketDayLow", - "regularMarketDayHigh", - "volume", - "regularMarketVolume", "averageVolume", "averageVolume10days", "averageDailyVolume10Day", - "bid", - "ask", - "bidSize", - "askSize", "fiftyTwoWeekLow", "fiftyTwoWeekHigh", "fiftyDayAverage", @@ -3228,6 +3326,9 @@ "address2": { "type": "string" }, + "address3": { + "type": "string" + }, "city": { "type": "string" }, @@ -3290,6 +3391,12 @@ }, "type": "array" }, + "cashPosition": { + "yahooFinanceType": "number" + }, + "convertiblePosition": { + "yahooFinanceType": "number" + }, "equityHoldings": { "$ref": "#/definitions/TopHoldingsEquityHoldings" }, @@ -3302,6 +3409,12 @@ "maxAge": { "yahooFinanceType": "number" }, + "otherPosition": { + "yahooFinanceType": "number" + }, + "preferredPosition": { + "yahooFinanceType": "number" + }, "sectorWeightings": { "items": { "$ref": "#/definitions/TopHoldingsSectorWeighting" @@ -3360,24 +3473,48 @@ "TopHoldingsEquityHoldings": { "additionalProperties": false, "properties": { + "medianMarketCap": { + "yahooFinanceType": "number" + }, + "medianMarketCapCat": { + "yahooFinanceType": "number" + }, "priceToBook": { "yahooFinanceType": "number" }, + "priceToBookCat": { + "yahooFinanceType": "number" + }, "priceToCashflow": { "yahooFinanceType": "number" }, + "priceToCashflowCat": { + "yahooFinanceType": "number" + }, "priceToEarnings": { "yahooFinanceType": "number" }, + "priceToEarningsCat": { + "yahooFinanceType": "number" + }, "priceToSales": { "yahooFinanceType": "number" + }, + "priceToSalesCat": { + "yahooFinanceType": "number" + }, + "threeYearEarningsGrowth": { + "yahooFinanceType": "number" + }, + "threeYearEarningsGrowthCat": { + "yahooFinanceType": "number" } }, "required": [ - "priceToEarnings", "priceToBook", - "priceToSales", - "priceToCashflow" + "priceToCashflow", + "priceToEarnings", + "priceToSales" ], "type": "object" }, diff --git a/src/modules/quoteSummary-iface.ts b/src/modules/quoteSummary-iface.ts index 2f2659d8..cc48c440 100644 --- a/src/modules/quoteSummary-iface.ts +++ b/src/modules/quoteSummary-iface.ts @@ -48,12 +48,16 @@ export interface QuoteSummaryResult { } export interface AssetProfile { + maxAge: number; address1?: string; + address2?: string; + address3?: string; city?: string; state?: string; zip?: string; country?: string; phone: string; + fax?: string; website?: string; industry?: string; sector?: string; @@ -67,9 +71,6 @@ export interface AssetProfile { overallRisk?: number; governanceEpochDate?: Date; compensationAsOfEpochDate?: Date; - maxAge: number; - address2?: string; - fax?: string; } export interface CompanyOfficer { @@ -216,8 +217,11 @@ export interface DefaultKeyStatistics { fundInceptionDate?: Date; threeYearAverageReturn?: number; fiveYearAverageReturn?: number; - - + morningStarOverallRating?: number; + morningStarRiskRating?: number; + annualReportExpenseRatio?: number; + lastCapGain?: number; + annualHoldingsTurnover?: number; } export interface QuoteSummaryEarnings { @@ -374,6 +378,8 @@ export interface OwnershipList { export interface FundPerformance { maxAge: number; + loadAdjustedReturns?: PeriodRange; + rankInCategory?: PeriodRange; performanceOverview: FundPerformancePerformanceOverview; performanceOverviewCat: FundPerformancePerformanceOverviewCat; trailingReturns: FundPerformanceTrailingReturns; @@ -385,31 +391,41 @@ export interface FundPerformance { riskOverviewStatisticsCat: FundPerformanceRiskOverviewStatsCat; } -export interface FundPerformancePerformanceOverview { - asOfDate: Date; - ytdReturnPct: number; - oneYearTotalReturn: number; - threeYearTotalReturn: number; -} - -export interface FundPerformancePerformanceOverviewCat { - ytdReturnPct: number; - fiveYrAvgReturnPct: number; +export interface PeriodRange { + asOfDate?: Date; + ytd?: number; + oneMonth?: number; + threeMonth?: number; + oneYear?: number; + threeYear?: number; + fiveYear?: number; + tenYear?: number; } -export interface FundPerformanceTrailingReturns { - asOfDate?: Date; - ytd: number; - oneMonth: number; - threeMonth?: number; - oneYear?: number; - threeYear?: number; - fiveYear?: number; - tenYear?: number; +export interface FundPerformanceTrailingReturns extends PeriodRange { lastBullMkt?: number; lastBearMkt?: number; } +export interface FundPerformancePerformanceOverview { + asOfDate?: Date; + ytdReturnPct?: number; + oneYearTotalReturn?: number; + threeYearTotalReturn?: number; + morningStarReturnRating?: number; + numYearsUp?: number; + numYearsDown?: number; + bestOneYrTotalReturn?: number; + worstOneYrTotalReturn?: number; + bestThreeYrTotalReturn?: number; + worstThreeYrTotalReturn?: number; +} + +export interface FundPerformancePerformanceOverviewCat { + ytdReturnPct?: number; + fiveYrAvgReturnPct?: number; +} + export interface FundPerformanceReturns { returns: FundPerformanceReturnsRow[]; returnsCat?: FundPerformanceReturnsRow[]; @@ -418,10 +434,15 @@ export interface FundPerformanceReturns { export interface FundPerformanceReturnsRow { year: number; // coerce to number from string "2020" annualValue?: number; + q1?: number; + q2?: number; + q3?: number; + q4?: number; } export interface FundPerformanceRiskOverviewStats { riskStatistics: FundPerformanceRiskOverviewStatsRow[]; + riskRating?: number; } export interface FundPerformanceRiskOverviewStatsCat { @@ -444,23 +465,33 @@ export interface FundProfile { styleBoxUrl?: string; family: string; categoryName: string; - legalType: string; + legalType: null | string; managementInfo: FundProfileManagementInfo; feesExpensesInvestment?: FundProfileFeesExpensesInvestment; feesExpensesInvestmentCat?: FundProfileFeesExpensesInvestmentCat; brokerages: FundProfileBrokerage[]; + initInvestment?: number; + initIraInvestment?: number; + initAipInvestment?: number; + subseqInvestment?: number; + subseqIraInvestment?: number; + subseqAipInvestment?: number; + } export interface FundProfileManagementInfo { managerName: null | string; managerBio: null | string; + startdate?: Date; } export interface FundProfileFeesExpensesInvestment { + annualHoldingsTurnover?: number; annualReportExpenseRatio: number; - annualHoldingsTurnover: number; - totalNetAssets: number; + grossExpRatio?: number; + netExpRatio?: number; projectionValues: object; + totalNetAssets?: number; } export interface FundProfileFeesExpensesInvestmentCat extends @@ -627,12 +658,12 @@ export interface Price { regularMarketChange: number; regularMarketTime: Date; regularMarketPrice: number; - regularMarketDayHigh: number; - regularMarketDayLow: number; - regularMarketVolume: number; + regularMarketDayHigh?: number; + regularMarketDayLow?: number; + regularMarketVolume?: number; regularMarketPreviousClose: number; regularMarketSource: string; - regularMarketOpen: number; + regularMarketOpen?: number; quoteSourceName: string; quoteType: string; @@ -663,7 +694,7 @@ export interface QuoteType { timeZoneFullName: string; timeZoneShortName: string; uuid: string; - messageBoardId: string; + messageBoardId: null | string; gmtOffSetMilliseconds: number; maxAge: number; } @@ -706,13 +737,14 @@ export interface SummaryDetail { maxAge: number; priceHint: number; previousClose: number; - open: number; - dayLow: number; - dayHigh: number; + open?: number; + dayLow?: number; + dayHigh?: number; regularMarketPreviousClose: number; - regularMarketOpen: number; - regularMarketDayLow: number; - regularMarketDayHigh: number; + regularMarketOpen?: number; + regularMarketDayLow?: number; + regularMarketDayHigh?: number; + regularMarketVolume?: number; dividendRate?: number; dividendYield?: number; exDividendDate?: Date; @@ -721,15 +753,14 @@ export interface SummaryDetail { beta?: number; trailingPE?: number; forwardPE?: number; - volume: number; - regularMarketVolume: number; + volume?: number; averageVolume: number; averageVolume10days: number; averageDailyVolume10Day: number; - bid: number; - ask: number; - bidSize: number; - askSize: number; + bid?: number; + ask?: number; + bidSize?: number; + askSize?: number; marketCap?: number; fiftyTwoWeekLow: number; fiftyTwoWeekHigh: number; @@ -744,18 +775,22 @@ export interface SummaryDetail { lastMarket: null; algorithm: null; tradeable: boolean; - yield?: number; + "yield"?: number; totalAssets?: number; navPrice?: number; + ytdReturn?: number; } export interface SummaryProfile { address1?: string; + address2?: string; + address3?: string; city?: string; state?: string; zip?: string; country?: string; phone?: string; + fax?: string; website?: string; industry?: string; sector?: string; @@ -763,19 +798,21 @@ export interface SummaryProfile { fullTimeEmployees?: number; companyOfficers: any[]; maxAge: number; - address2?: string; - fax?: string; } export interface TopHoldings { - maxAge: number; - stockPosition: number; - bondPosition: number; - holdings: TopHoldingsHolding[]; - equityHoldings: TopHoldingsEquityHoldings; - bondHoldings: object; - bondRatings: TopHoldingsBondRating[]; - sectorWeightings: TopHoldingsSectorWeighting[]; + maxAge: number; + stockPosition: number; + bondPosition: number; + holdings: TopHoldingsHolding[]; + equityHoldings: TopHoldingsEquityHoldings; + bondHoldings: object; + bondRatings: TopHoldingsBondRating[]; + sectorWeightings: TopHoldingsSectorWeighting[]; + cashPosition?: number; + otherPosition?: number; + preferredPosition?: number; + convertiblePosition?: number; } export interface TopHoldingsHolding { @@ -785,10 +822,18 @@ export interface TopHoldingsHolding { } export interface TopHoldingsEquityHoldings { - priceToEarnings: number; - priceToBook: number; - priceToSales: number; - priceToCashflow: number; + medianMarketCap?: number; + medianMarketCapCat?: number; + priceToBook: number; + priceToBookCat?: number; + priceToCashflow: number; + priceToCashflowCat?: number; + priceToEarnings: number; + priceToEarningsCat?: number; + priceToSales: number; + priceToSalesCat?: number; + threeYearEarningsGrowth?: number; + threeYearEarningsGrowthCat?: number; } export interface TopHoldingsBondRating {