Skip to content

Commit

Permalink
chore(quoteSummary): restore point in case this all goes wrong :)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 1, 2021
1 parent e95dbc8 commit 3206146
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 27 deletions.
148 changes: 127 additions & 21 deletions src/modules/quoteSummary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,50 @@

export interface QuoteSummaryResultJson {
assetProfile?: AssetProfileJson;
balanceSheetHistory?: BalanceSheetHistoryJson;
balanceSheetHistoryQuarterly?: BalanceSheetHistoryJson;
calendarEvents?: CalendarEventsJson;
cashflowStatementHistory?: CashflowStatementHistoryJson;
cashflowStatementHistoryQuarterly?: CashflowStatementHistoryJson;
defaultKeyStatistics?: DefaultKeyStatisticsJson;
earnings?: QuoteSummaryEarningsJson;
earningsHistory?: EarningsHistoryJson;
earningsTrend?: EarningsTrendJson;
financialData?: FinancialDataJson;
fundOwnership?: OwnershipJson;
incomeStatementHistory?: IncomeStatementHistoryJson;
incomeStatementHistoryQuarterly?: IncomeStatementHistoryJson;
indexTrend?: IndexTrendJson;
industryTrend?: TrendJson;
insiderHolders?: HoldersJson;
insiderTransactions?: InsiderTransactionsJson;
institutionOwnership?: OwnershipJson;
majorDirectHolders?: HoldersJson;
majorHoldersBreakdown?: MajorHoldersBreakdownJson;
netSharePurchaseActivity?: NetSharePurchaseActivityJson;
price?: PriceJson;
quoteType?: QuoteTypeJson;
recommendationTrend?: RecommendationTrendJson;
secFilings?: SECFilingsJson;
sectorTrend?: TrendJson;
summaryDetail?: SummaryDetailJson;
summaryProfile?: SummaryProfileJson;
upgradeDowngradeHistory?: UpgradeDowngradeHistoryJson;
}

/*
export interface QuoteSummaryResult extends Omit<QuoteSummaryResultJson,
"assetProfile"|"earningsTrend"|"price"|"secFilings"|"summaryDetail"> {
assetProfile?: AssetProfileJson;
earningsTrend?: EarningsTrend;
price: Price;
secFilings?: SECFilings;
summaryDetail: SummaryDetail;
}
*/

export interface QuoteSummaryResult {
assetProfile?: AssetProfile;
balanceSheetHistory?: BalanceSheetHistory;
balanceSheetHistoryQuarterly?: BalanceSheetHistory;
calendarEvents?: CalendarEvents;
Expand All @@ -34,25 +78,16 @@ export interface QuoteSummaryResultJson {
majorDirectHolders?: Holders;
majorHoldersBreakdown?: MajorHoldersBreakdown;
netSharePurchaseActivity?: NetSharePurchaseActivity;
price?: PriceJson;
price?: Price;
quoteType?: QuoteType;
recommendationTrend?: RecommendationTrend;
secFilings?: SECFilingsJson;
secFilings?: SECFilings;
sectorTrend?: Trend;
summaryDetail?: SummaryDetailJson;
summaryDetail?: SummaryDetail;
summaryProfile?: SummaryProfile;
upgradeDowngradeHistory?: UpgradeDowngradeHistory;
}

export interface QuoteSummaryResult extends Omit<QuoteSummaryResultJson,
"assetProfile"|"earningsTrend"|"price"|"secFilings"|"summaryDetail"> {
assetProfile?: AssetProfileJson;
earningsTrend?: EarningsTrend;
price: Price;
secFilings?: SECFilings;
summaryDetail: SummaryDetail;
}

export interface AssetProfileJson {
address1: string;
city: string;
Expand Down Expand Up @@ -101,12 +136,15 @@ export interface CompanyOfficer extends Omit<CompanyOfficerJson,"totalPay"|"exer
unexercisedValue?: number|null;
}

export interface BalanceSheetHistory {
balanceSheetStatements: BalanceSheetStatement[];
export interface BalanceSheetHistoryJson {
balanceSheetStatements: BalanceSheetStatementJson[];
maxAge: number;
}
export interface BalanceSheetHistory extends Omit<BalanceSheetHistoryJson,"balanceSheetStatements"> {
balanceSheetStatements: BalanceSheetStatement[];
}

export interface BalanceSheetStatement {
export interface BalanceSheetStatementJson {
maxAge: number;
endDate: RawNumberObj;
cash: RawNumberObj;
Expand Down Expand Up @@ -139,21 +177,59 @@ export interface BalanceSheetStatement {
minorityInterest?: RawNumberObj;
capitalSurplus?: RawNumberObj;
}
export interface BalanceSheetStatement {
maxAge: number;
endDate: number;
cash: number;
shortTermInvestments?: number;
netReceivables: number;
inventory: number;
otherCurrentAssets: number;
totalCurrentAssets: number;
longTermInvestments: number;
propertyPlantEquipment: number;
otherAssets: number;
totalAssets: number;
accountsPayable: number;
shortLongTermDebt?: number;
otherCurrentLiab: number;
longTermDebt: number;
otherLiab: number;
totalCurrentLiabilities: number;
totalLiab: number;
commonStock?: number;
retainedEarnings: number;
treasuryStock: number;
otherStockholderEquity: number;
totalStockholderEquity: number;
netTangibleAssets: number;
goodWill?: number;
intangibleAssets?: number;
deferredLongTermAssetCharges?: number;
deferredLongTermLiab?: number;
minorityInterest?: number;
capitalSurplus?: number;
}

export interface RawNumberObj {
raw?: number;
fmt?: null | string;
longFmt?: string;
}

export interface CalendarEvents {
export interface CalendarEventsJson {
maxAge: number;
earnings: CalendarEventsEarnings;
earnings: CalendarEventsEarningsJson;
exDividendDate?: number;
dividendDate?: number;
}
export interface CalendarEvents extends Omit<CalendarEventsJson,"earnigs"|"exDividendDate"|"dividentDate"> {
earnings: CalendarEventsEarnings;
exDividendDate?: Date;
dividendDate?: Date;
}

export interface CalendarEventsEarnings {
export interface CalendarEventsEarningsJson {
earningsDate: number[];
earningsAverage?: number;
earningsLow?: number;
Expand All @@ -162,13 +238,19 @@ export interface CalendarEventsEarnings {
revenueLow?: number;
revenueHigh?: number;
}
export interface CalendarEventsEarnings extends Omit<CalendarEventsEarningsJson, "earningsDate"> {
earningsDate: Date[];
}

export interface CashflowStatementHistory {
cashflowStatements: CashflowStatement[];
export interface CashflowStatementHistoryJson {
cashflowStatements: CashflowStatementJson[];
maxAge: number;
}
export interface CashflowStatementHistory extends Omit<CashflowStatementHistoryJson,"cashflowStatements"> {
cashflowStatements: CashflowStatement[];
}

export interface CashflowStatement {
export interface CashflowStatementJson {
maxAge: number;
endDate: RawNumberObj;
netIncome: RawNumberObj;
Expand All @@ -192,6 +274,30 @@ export interface CashflowStatement {
issuanceOfStock?: RawNumberObj;
effectOfExchangeRate?: RawNumberObj;
}
export interface CashflowStatement {
maxAge: number;
endDate: number;
netIncome: number;
depreciation: number;
changeToNetincome: number;
changeToAccountReceivables?: number;
changeToLiabilities: number;
changeToInventory?: number;
changeToOperatingActivities?: number;
totalCashFromOperatingActivities: number;
capitalExpenditures: number;
investments?: number;
otherCashflowsFromInvestingActivities: number;
totalCashflowsFromInvestingActivities: number;
dividendsPaid?: number;
netBorrowings: number;
otherCashflowsFromFinancingActivities: number;
totalCashFromFinancingActivities: number;
changeInCash: number;
repurchaseOfStock?: number;
issuanceOfStock?: number;
effectOfExchangeRate?: number;
}

export interface DefaultKeyStatistics {
maxAge: number;
Expand Down
18 changes: 12 additions & 6 deletions src/modules/quoteSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import validate from '../lib/validate';
import transformField from '../lib/transformField';
import mutateJson from '../lib/mutateJson';

/*
const schema = require('../../schema.json');
const qsSchema = schema.
*/

//import { SummaryDetail, SummaryDetailJson } from './quoteSummary/summaryDetail';
//import { Price, PriceJson } from './quoteSummary/price';

Expand Down Expand Up @@ -101,12 +106,8 @@ export const fieldTransformMap = {
]
},
balanceSheetHistory: {
balanceSheetStatements: [ { endDate: 'dateObj' } ],
earningsTrend: {
trend: {
endDate: 'dateStr' // not dateObj like other endDates!
}
}
balanceSheetStatements: [ {
endDate: 'dateObj' } ],
},
balanceSheetHistoryQuarterly: {
balanceSheetStatements: [ { endDate: 'dateObj' } ]
Expand Down Expand Up @@ -139,6 +140,11 @@ export const fieldTransformMap = {
earnings: {
earningsDate: [ 'epoch' ]
},
earningsTrend: {
trend: {
endDate: 'dateStr' // not dateObj like other endDates!
}
},
fundOwnership: {
ownershipList: {
reportDate: 'dateObj',
Expand Down

0 comments on commit 3206146

Please sign in to comment.