tn-financial-data 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/cli.js +2054 -0
- package/dist/client/index.d.ts +747 -0
- package/dist/client/index.js +228 -0
- package/package.json +50 -0
- package/skills/tn-financial-data/SKILL.md +91 -0
- package/skills/tn-financial-data/agents/claude.md +8 -0
- package/skills/tn-financial-data/agents/openai.yaml +7 -0
- package/skills/tn-financial-data/agents/opencode.md +11 -0
- package/skills/tn-financial-data/references/cli.md +326 -0
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
declare const FINANCIAL_PERIODS: readonly ["annual", "quarterly", "ttm"];
|
|
2
|
+
type FinancialPeriod = (typeof FINANCIAL_PERIODS)[number];
|
|
3
|
+
declare const PRICE_INTERVALS: readonly ["day", "1h"];
|
|
4
|
+
type PriceInterval = (typeof PRICE_INTERVALS)[number];
|
|
5
|
+
declare const INSIDER_TRADE_SECURITY_TYPES: readonly ["all", "non_derivative", "derivative"];
|
|
6
|
+
type InsiderTradeSecurityType = (typeof INSIDER_TRADE_SECURITY_TYPES)[number];
|
|
7
|
+
declare const SCREENER_API_OPERATORS: readonly ["lt", "gt", "lte", "gte", "eq", "in"];
|
|
8
|
+
type ScreenerApiOperator = (typeof SCREENER_API_OPERATORS)[number];
|
|
9
|
+
declare const SCREENER_CLI_OPERATORS: readonly ["<", ">", "<=", ">=", "=", "in"];
|
|
10
|
+
type ScreenerCliOperator = (typeof SCREENER_CLI_OPERATORS)[number];
|
|
11
|
+
declare const SCREENER_NUMERIC_API_OPERATORS: readonly ["lt", "gt", "lte", "gte", "eq"];
|
|
12
|
+
type ScreenerNumericOperator = (typeof SCREENER_NUMERIC_API_OPERATORS)[number];
|
|
13
|
+
type ScreenerFieldType = "numeric" | "string";
|
|
14
|
+
type ScreenerFieldSource = "companies" | "key_statistics" | "analyst_price_targets";
|
|
15
|
+
type ScreenerFieldValueEncoding = "decimal_ratio";
|
|
16
|
+
interface ScreenerNumericFilter {
|
|
17
|
+
field: string;
|
|
18
|
+
operator: ScreenerNumericOperator;
|
|
19
|
+
value: number;
|
|
20
|
+
}
|
|
21
|
+
interface ScreenerStringEqFilter {
|
|
22
|
+
field: string;
|
|
23
|
+
operator: "eq";
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
interface ScreenerStringInFilter {
|
|
27
|
+
field: string;
|
|
28
|
+
operator: "in";
|
|
29
|
+
value: string[];
|
|
30
|
+
}
|
|
31
|
+
type ScreenerFilter = ScreenerNumericFilter | ScreenerStringEqFilter | ScreenerStringInFilter;
|
|
32
|
+
declare const GLOBAL_INTEREST_RATE_SERIES_KEYS: readonly ["ecb_refi", "ecb_deposit", "boj_call_money", "boe_sonia", "boc_call_money", "rba_3m", "snb_call_money"];
|
|
33
|
+
type GlobalInterestRateSeriesKey = (typeof GLOBAL_INTEREST_RATE_SERIES_KEYS)[number];
|
|
34
|
+
|
|
35
|
+
interface IncomeStatementData {
|
|
36
|
+
ticker: string;
|
|
37
|
+
reportPeriod: string;
|
|
38
|
+
fiscalPeriod: string;
|
|
39
|
+
period: string;
|
|
40
|
+
currency: string;
|
|
41
|
+
source: string | null;
|
|
42
|
+
sourceAccession: string | null;
|
|
43
|
+
sourceFiledAt: string | null;
|
|
44
|
+
sourceForm: string | null;
|
|
45
|
+
sourceFrame: string | null;
|
|
46
|
+
sourceUrl: string | null;
|
|
47
|
+
refreshedAt: string;
|
|
48
|
+
revenue: number | null;
|
|
49
|
+
costOfRevenue: number | null;
|
|
50
|
+
grossProfit: number | null;
|
|
51
|
+
operatingExpense: number | null;
|
|
52
|
+
sellingGeneralAndAdministrativeExpenses: number | null;
|
|
53
|
+
researchAndDevelopment: number | null;
|
|
54
|
+
operatingIncome: number | null;
|
|
55
|
+
interestExpense: number | null;
|
|
56
|
+
ebit: number | null;
|
|
57
|
+
incomeTaxExpense: number | null;
|
|
58
|
+
netIncomeDiscontinuedOperations: number | null;
|
|
59
|
+
netIncomeNonControllingInterests: number | null;
|
|
60
|
+
netIncome: number | null;
|
|
61
|
+
netIncomeCommonStock: number | null;
|
|
62
|
+
earningsPerShare: number | null;
|
|
63
|
+
earningsPerShareDiluted: number | null;
|
|
64
|
+
weightedAverageShares: number | null;
|
|
65
|
+
weightedAverageSharesDiluted: number | null;
|
|
66
|
+
dividendsPerCommonShare: number | null;
|
|
67
|
+
preferredDividendsImpact: number | null;
|
|
68
|
+
consolidatedIncome: number | null;
|
|
69
|
+
consensusActualEps: number | null;
|
|
70
|
+
consensusEstimateEps: number | null;
|
|
71
|
+
consensusEpsDifference: number | null;
|
|
72
|
+
consensusEpsSurprisePct: number | null;
|
|
73
|
+
}
|
|
74
|
+
interface BalanceSheetData {
|
|
75
|
+
ticker: string;
|
|
76
|
+
reportPeriod: string;
|
|
77
|
+
fiscalPeriod: string;
|
|
78
|
+
period: string;
|
|
79
|
+
currency: string;
|
|
80
|
+
source: string | null;
|
|
81
|
+
sourceAccession: string | null;
|
|
82
|
+
sourceFiledAt: string | null;
|
|
83
|
+
sourceForm: string | null;
|
|
84
|
+
sourceFrame: string | null;
|
|
85
|
+
sourceUrl: string | null;
|
|
86
|
+
refreshedAt: string;
|
|
87
|
+
totalAssets: number | null;
|
|
88
|
+
currentAssets: number | null;
|
|
89
|
+
cashAndEquivalents: number | null;
|
|
90
|
+
cashAndShortTermInvestments: number | null;
|
|
91
|
+
inventory: number | null;
|
|
92
|
+
currentInvestments: number | null;
|
|
93
|
+
tradeAndNonTradeReceivables: number | null;
|
|
94
|
+
accountsReceivable: number | null;
|
|
95
|
+
nonCurrentAssets: number | null;
|
|
96
|
+
propertyPlantAndEquipment: number | null;
|
|
97
|
+
goodwillAndIntangibleAssets: number | null;
|
|
98
|
+
investments: number | null;
|
|
99
|
+
totalLiabilities: number | null;
|
|
100
|
+
currentLiabilities: number | null;
|
|
101
|
+
currentDebt: number | null;
|
|
102
|
+
tradeAndNonTradePayables: number | null;
|
|
103
|
+
accountsPayable: number | null;
|
|
104
|
+
nonCurrentLiabilities: number | null;
|
|
105
|
+
nonCurrentDebt: number | null;
|
|
106
|
+
totalDebt: number | null;
|
|
107
|
+
shareholdersEquity: number | null;
|
|
108
|
+
minorityInterest: number | null;
|
|
109
|
+
retainedEarnings: number | null;
|
|
110
|
+
accumulatedOtherComprehensiveIncomeLoss: number | null;
|
|
111
|
+
treasuryStock: number | null;
|
|
112
|
+
outstandingShares: number | null;
|
|
113
|
+
}
|
|
114
|
+
interface CashFlowData {
|
|
115
|
+
ticker: string;
|
|
116
|
+
reportPeriod: string;
|
|
117
|
+
fiscalPeriod: string;
|
|
118
|
+
period: string;
|
|
119
|
+
currency: string;
|
|
120
|
+
source: string | null;
|
|
121
|
+
sourceAccession: string | null;
|
|
122
|
+
sourceFiledAt: string | null;
|
|
123
|
+
sourceForm: string | null;
|
|
124
|
+
sourceFrame: string | null;
|
|
125
|
+
sourceUrl: string | null;
|
|
126
|
+
refreshedAt: string;
|
|
127
|
+
netIncome: number | null;
|
|
128
|
+
depreciationAndAmortization: number | null;
|
|
129
|
+
shareBasedCompensation: number | null;
|
|
130
|
+
netCashFlowFromOperations: number | null;
|
|
131
|
+
capitalExpenditure: number | null;
|
|
132
|
+
businessAcquisitionsAndDisposals: number | null;
|
|
133
|
+
investmentAcquisitionsAndDisposals: number | null;
|
|
134
|
+
netCashFlowFromInvesting: number | null;
|
|
135
|
+
issuanceOrRepaymentOfDebtSecurities: number | null;
|
|
136
|
+
issuanceOrPurchaseOfEquityShares: number | null;
|
|
137
|
+
dividendsAndOtherCashDistributions: number | null;
|
|
138
|
+
netCashFlowFromFinancing: number | null;
|
|
139
|
+
changeInCashAndEquivalents: number | null;
|
|
140
|
+
effectOfExchangeRateChanges: number | null;
|
|
141
|
+
endingCashBalance: number | null;
|
|
142
|
+
freeCashFlow: number | null;
|
|
143
|
+
}
|
|
144
|
+
interface PriceData {
|
|
145
|
+
ticker: string;
|
|
146
|
+
interval: PriceInterval;
|
|
147
|
+
time: string;
|
|
148
|
+
refreshedAt: string;
|
|
149
|
+
open: number;
|
|
150
|
+
high: number;
|
|
151
|
+
low: number;
|
|
152
|
+
close: number;
|
|
153
|
+
volume: number;
|
|
154
|
+
}
|
|
155
|
+
interface CompanyFactsData {
|
|
156
|
+
ticker: string;
|
|
157
|
+
name: string;
|
|
158
|
+
cik: string | null;
|
|
159
|
+
isActive: boolean;
|
|
160
|
+
sicCode: string | null;
|
|
161
|
+
location: string | null;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
refreshedAt: string;
|
|
164
|
+
}
|
|
165
|
+
interface KeyStatisticsData {
|
|
166
|
+
ticker: string;
|
|
167
|
+
marketCap: number | null;
|
|
168
|
+
enterpriseValue: number | null;
|
|
169
|
+
trailingPe: number | null;
|
|
170
|
+
forwardPe: number | null;
|
|
171
|
+
pegRatio: number | null;
|
|
172
|
+
priceToSales: number | null;
|
|
173
|
+
priceToBook: number | null;
|
|
174
|
+
evToRevenue: number | null;
|
|
175
|
+
evToEbitda: number | null;
|
|
176
|
+
ebitda: number | null;
|
|
177
|
+
revenuePerShare: number | null;
|
|
178
|
+
profitMargin: number | null;
|
|
179
|
+
operatingMargin: number | null;
|
|
180
|
+
returnOnAssets: number | null;
|
|
181
|
+
returnOnEquity: number | null;
|
|
182
|
+
quarterlyRevenueGrowth: number | null;
|
|
183
|
+
quarterlyEarningsGrowth: number | null;
|
|
184
|
+
beta: number | null;
|
|
185
|
+
sharesOutstanding: number | null;
|
|
186
|
+
floatShares: number | null;
|
|
187
|
+
shortRatio: number | null;
|
|
188
|
+
currentRatio: number | null;
|
|
189
|
+
debtToEquity: number | null;
|
|
190
|
+
totalCash: number | null;
|
|
191
|
+
totalCashPerShare: number | null;
|
|
192
|
+
totalDebt: number | null;
|
|
193
|
+
quickRatio: number | null;
|
|
194
|
+
bookValue: number | null;
|
|
195
|
+
operatingCashflow: number | null;
|
|
196
|
+
freeCashflow: number | null;
|
|
197
|
+
grossMargins: number | null;
|
|
198
|
+
ebitdaMargins: number | null;
|
|
199
|
+
grossProfits: number | null;
|
|
200
|
+
trailingEps: number | null;
|
|
201
|
+
forwardEps: number | null;
|
|
202
|
+
payoutRatio: number | null;
|
|
203
|
+
sharesShort: number | null;
|
|
204
|
+
shortPercentOfFloat: number | null;
|
|
205
|
+
refreshedAt: string;
|
|
206
|
+
}
|
|
207
|
+
interface AnalystEstimateData {
|
|
208
|
+
ticker: string;
|
|
209
|
+
periodLabel: string;
|
|
210
|
+
endDate: string | null;
|
|
211
|
+
epsAvg: number | null;
|
|
212
|
+
epsLow: number | null;
|
|
213
|
+
epsHigh: number | null;
|
|
214
|
+
epsYearAgo: number | null;
|
|
215
|
+
epsGrowth: number | null;
|
|
216
|
+
numberOfEpsAnalysts: number | null;
|
|
217
|
+
revenueAvg: number | null;
|
|
218
|
+
revenueLow: number | null;
|
|
219
|
+
revenueHigh: number | null;
|
|
220
|
+
revenueYearAgo: number | null;
|
|
221
|
+
revenueGrowth: number | null;
|
|
222
|
+
numberOfRevenueAnalysts: number | null;
|
|
223
|
+
epsTrendCurrent: number | null;
|
|
224
|
+
epsTrend7dAgo: number | null;
|
|
225
|
+
epsTrend30dAgo: number | null;
|
|
226
|
+
epsTrend60dAgo: number | null;
|
|
227
|
+
epsTrend90dAgo: number | null;
|
|
228
|
+
epsRevisionsUp7d: number | null;
|
|
229
|
+
epsRevisionsUp30d: number | null;
|
|
230
|
+
epsRevisionsDown7d: number | null;
|
|
231
|
+
epsRevisionsDown30d: number | null;
|
|
232
|
+
growthEstimateStock: number | null;
|
|
233
|
+
growthEstimateIndex: number | null;
|
|
234
|
+
refreshedAt: string;
|
|
235
|
+
}
|
|
236
|
+
interface AnalystPriceTargetData {
|
|
237
|
+
ticker: string;
|
|
238
|
+
targetHigh: number | null;
|
|
239
|
+
targetLow: number | null;
|
|
240
|
+
targetMean: number | null;
|
|
241
|
+
targetMedian: number | null;
|
|
242
|
+
numberOfAnalysts: number | null;
|
|
243
|
+
recommendationKey: string | null;
|
|
244
|
+
recommendationMean: number | null;
|
|
245
|
+
refreshedAt: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface ClientOptions {
|
|
249
|
+
apiKey: string;
|
|
250
|
+
baseUrl?: string;
|
|
251
|
+
fetch?: typeof fetch;
|
|
252
|
+
}
|
|
253
|
+
type SnakeCase<T extends string> = T extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${SnakeCase<Tail>}` : `${Lowercase<Head>}_${SnakeCase<Tail>}` : T;
|
|
254
|
+
type SnakeCasedProperties<T> = {
|
|
255
|
+
[Key in keyof T as Key extends string ? SnakeCase<Key> : Key]: T[Key];
|
|
256
|
+
};
|
|
257
|
+
type IncomeStatement = SnakeCasedProperties<IncomeStatementData>;
|
|
258
|
+
type BalanceSheet = SnakeCasedProperties<BalanceSheetData>;
|
|
259
|
+
type CashFlowStatement = SnakeCasedProperties<CashFlowData>;
|
|
260
|
+
type PriceBar = Omit<SnakeCasedProperties<PriceData>, "ticker">;
|
|
261
|
+
type CompanyFacts = SnakeCasedProperties<CompanyFactsData>;
|
|
262
|
+
type KeyStatistics = SnakeCasedProperties<KeyStatisticsData>;
|
|
263
|
+
type DataAvailability = "ready" | "no_data";
|
|
264
|
+
type ConsensusSurprise = "BEAT" | "MISS" | "MEET";
|
|
265
|
+
interface FinancialMetricData {
|
|
266
|
+
ticker: string;
|
|
267
|
+
reportPeriod: string;
|
|
268
|
+
fiscalPeriod: string;
|
|
269
|
+
period: FinancialPeriod;
|
|
270
|
+
currency: string;
|
|
271
|
+
refreshedAt: string;
|
|
272
|
+
grossMargin: number | null;
|
|
273
|
+
operatingMargin: number | null;
|
|
274
|
+
netMargin: number | null;
|
|
275
|
+
ebitMargin: number | null;
|
|
276
|
+
ebitdaMargin: number | null;
|
|
277
|
+
freeCashFlowMargin: number | null;
|
|
278
|
+
operatingCashFlowMargin: number | null;
|
|
279
|
+
returnOnAssets: number | null;
|
|
280
|
+
returnOnEquity: number | null;
|
|
281
|
+
returnOnInvestedCapital: number | null;
|
|
282
|
+
assetTurnover: number | null;
|
|
283
|
+
currentRatio: number | null;
|
|
284
|
+
quickRatio: number | null;
|
|
285
|
+
cashRatio: number | null;
|
|
286
|
+
debtToEquity: number | null;
|
|
287
|
+
debtToAssets: number | null;
|
|
288
|
+
netDebtToEbitda: number | null;
|
|
289
|
+
interestCoverage: number | null;
|
|
290
|
+
bookValuePerShare: number | null;
|
|
291
|
+
tangibleBookValuePerShare: number | null;
|
|
292
|
+
earningsPerShare: number | null;
|
|
293
|
+
freeCashFlowPerShare: number | null;
|
|
294
|
+
revenuePerShare: number | null;
|
|
295
|
+
netCash: number | null;
|
|
296
|
+
workingCapital: number | null;
|
|
297
|
+
revenueGrowthYoy: number | null;
|
|
298
|
+
earningsGrowthYoy: number | null;
|
|
299
|
+
bookValueGrowthYoy: number | null;
|
|
300
|
+
epsGrowthYoy: number | null;
|
|
301
|
+
freeCashFlowGrowthYoy: number | null;
|
|
302
|
+
ebitdaGrowthYoy: number | null;
|
|
303
|
+
}
|
|
304
|
+
interface EarningsRowData {
|
|
305
|
+
ticker: string;
|
|
306
|
+
reportPeriod: string;
|
|
307
|
+
fiscalPeriod: string | null;
|
|
308
|
+
period: FinancialPeriod;
|
|
309
|
+
currency: string;
|
|
310
|
+
refreshedAt: string;
|
|
311
|
+
earningsReleaseAt: string | null;
|
|
312
|
+
earningsCallAt: string | null;
|
|
313
|
+
earningsReleaseSourceUrl: string | null;
|
|
314
|
+
earningsCallSourceUrl: string | null;
|
|
315
|
+
revenue: number | null;
|
|
316
|
+
netIncome: number | null;
|
|
317
|
+
netIncomeCommonStock: number | null;
|
|
318
|
+
ebitda: number | null;
|
|
319
|
+
freeCashFlow: number | null;
|
|
320
|
+
reportedEps: number | null;
|
|
321
|
+
reportedEpsDiluted: number | null;
|
|
322
|
+
consensusActualEps: number | null;
|
|
323
|
+
consensusEstimateEps: number | null;
|
|
324
|
+
consensusEpsDifference: number | null;
|
|
325
|
+
consensusEpsSurprisePct: number | null;
|
|
326
|
+
consensusSurprise: ConsensusSurprise | null;
|
|
327
|
+
revenueGrowthYoy: number | null;
|
|
328
|
+
earningsGrowthYoy: number | null;
|
|
329
|
+
epsGrowthYoy: number | null;
|
|
330
|
+
freeCashFlowGrowthYoy: number | null;
|
|
331
|
+
ebitdaGrowthYoy: number | null;
|
|
332
|
+
}
|
|
333
|
+
type FinancialMetric = SnakeCasedProperties<FinancialMetricData>;
|
|
334
|
+
type EarningsRow = SnakeCasedProperties<EarningsRowData>;
|
|
335
|
+
interface NewsArticle {
|
|
336
|
+
uuid: string;
|
|
337
|
+
title: string;
|
|
338
|
+
publisher: string | null;
|
|
339
|
+
report_date: string;
|
|
340
|
+
published_at: string | null;
|
|
341
|
+
related_tickers: string[];
|
|
342
|
+
type: string | null;
|
|
343
|
+
link: string | null;
|
|
344
|
+
summary: string | null;
|
|
345
|
+
refreshed_at: string;
|
|
346
|
+
}
|
|
347
|
+
interface ReadMetadata {
|
|
348
|
+
ticker: string;
|
|
349
|
+
availability: DataAvailability;
|
|
350
|
+
as_of: string | null;
|
|
351
|
+
}
|
|
352
|
+
interface PriceSnapshot {
|
|
353
|
+
ticker: string;
|
|
354
|
+
interval: PriceInterval;
|
|
355
|
+
refreshed_at: string;
|
|
356
|
+
price: number;
|
|
357
|
+
time: string;
|
|
358
|
+
open: number;
|
|
359
|
+
high: number;
|
|
360
|
+
low: number;
|
|
361
|
+
close: number;
|
|
362
|
+
volume: number;
|
|
363
|
+
}
|
|
364
|
+
interface ReportPeriodFilterOpts {
|
|
365
|
+
reportPeriod?: string;
|
|
366
|
+
reportPeriodGte?: string;
|
|
367
|
+
reportPeriodLte?: string;
|
|
368
|
+
reportPeriodGt?: string;
|
|
369
|
+
reportPeriodLt?: string;
|
|
370
|
+
}
|
|
371
|
+
interface FinancialOpts extends ReportPeriodFilterOpts {
|
|
372
|
+
period: FinancialPeriod;
|
|
373
|
+
limit?: number;
|
|
374
|
+
}
|
|
375
|
+
interface PriceOpts {
|
|
376
|
+
interval: PriceInterval;
|
|
377
|
+
startDate: string;
|
|
378
|
+
endDate: string;
|
|
379
|
+
}
|
|
380
|
+
interface NewsOpts {
|
|
381
|
+
limit?: number;
|
|
382
|
+
startDate?: string;
|
|
383
|
+
endDate?: string;
|
|
384
|
+
publisher?: string;
|
|
385
|
+
}
|
|
386
|
+
interface InsiderTradesOpts {
|
|
387
|
+
limit?: number;
|
|
388
|
+
startDate?: string;
|
|
389
|
+
endDate?: string;
|
|
390
|
+
reportingOwnerCik?: string;
|
|
391
|
+
transactionCodes?: readonly string[];
|
|
392
|
+
securityType?: InsiderTradeSecurityType;
|
|
393
|
+
}
|
|
394
|
+
interface OptionalFinancialQueryOpts extends ReportPeriodFilterOpts {
|
|
395
|
+
period?: FinancialPeriod;
|
|
396
|
+
limit?: number;
|
|
397
|
+
}
|
|
398
|
+
interface FinancialMetricsOpts extends OptionalFinancialQueryOpts {
|
|
399
|
+
}
|
|
400
|
+
interface EarningsOpts extends OptionalFinancialQueryOpts {
|
|
401
|
+
}
|
|
402
|
+
interface QuarterlyHighlightsOpts {
|
|
403
|
+
reportPeriod?: string;
|
|
404
|
+
}
|
|
405
|
+
interface GeneralOverviewOpts {
|
|
406
|
+
period?: FinancialPeriod;
|
|
407
|
+
financialLimit?: number;
|
|
408
|
+
newsLimit?: number;
|
|
409
|
+
}
|
|
410
|
+
interface InstitutionalOwnershipOpts {
|
|
411
|
+
limit?: number;
|
|
412
|
+
}
|
|
413
|
+
interface InvestorPortfolioOpts {
|
|
414
|
+
cik?: string;
|
|
415
|
+
investor?: string;
|
|
416
|
+
limit?: number;
|
|
417
|
+
}
|
|
418
|
+
interface GlobalInterestRatesOpts {
|
|
419
|
+
limit?: number;
|
|
420
|
+
startDate?: string;
|
|
421
|
+
endDate?: string;
|
|
422
|
+
series?: readonly GlobalInterestRateSeriesKey[];
|
|
423
|
+
}
|
|
424
|
+
interface IncomeStatementsResponse extends ReadMetadata {
|
|
425
|
+
period: FinancialPeriod;
|
|
426
|
+
income_statements: IncomeStatement[];
|
|
427
|
+
}
|
|
428
|
+
interface BalanceSheetsResponse extends ReadMetadata {
|
|
429
|
+
period: FinancialPeriod;
|
|
430
|
+
balance_sheets: BalanceSheet[];
|
|
431
|
+
}
|
|
432
|
+
interface CashFlowStatementsResponse extends ReadMetadata {
|
|
433
|
+
period: FinancialPeriod;
|
|
434
|
+
cash_flow_statements: CashFlowStatement[];
|
|
435
|
+
}
|
|
436
|
+
interface FinancialsResponse extends ReadMetadata {
|
|
437
|
+
period: FinancialPeriod;
|
|
438
|
+
financials: {
|
|
439
|
+
income_statements: IncomeStatement[];
|
|
440
|
+
balance_sheets: BalanceSheet[];
|
|
441
|
+
cash_flow_statements: CashFlowStatement[];
|
|
442
|
+
key_statistics: KeyStatistics | null;
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
interface FinancialMetricsResponse extends ReadMetadata {
|
|
446
|
+
period: FinancialPeriod;
|
|
447
|
+
financial_metrics: FinancialMetric[];
|
|
448
|
+
}
|
|
449
|
+
interface FinancialMetricsSnapshotResponse extends ReadMetadata {
|
|
450
|
+
period: FinancialPeriod;
|
|
451
|
+
snapshot: {
|
|
452
|
+
metrics: FinancialMetric | null;
|
|
453
|
+
price_snapshot: PriceSnapshot | null;
|
|
454
|
+
key_statistics: KeyStatistics | null;
|
|
455
|
+
} | null;
|
|
456
|
+
}
|
|
457
|
+
interface EarningsResponse extends ReadMetadata {
|
|
458
|
+
period: FinancialPeriod;
|
|
459
|
+
earnings: EarningsRow[];
|
|
460
|
+
}
|
|
461
|
+
interface KeyStatisticsResponse {
|
|
462
|
+
ticker: string;
|
|
463
|
+
availability: DataAvailability;
|
|
464
|
+
as_of: string | null;
|
|
465
|
+
key_statistics: KeyStatistics | null;
|
|
466
|
+
}
|
|
467
|
+
interface AvailableTicker {
|
|
468
|
+
ticker: string;
|
|
469
|
+
name: string;
|
|
470
|
+
financials_updated_at: string | null;
|
|
471
|
+
news_updated_at: string | null;
|
|
472
|
+
updated_at: string;
|
|
473
|
+
}
|
|
474
|
+
interface AvailableTickersResponse {
|
|
475
|
+
as_of: string | null;
|
|
476
|
+
tickers: AvailableTicker[];
|
|
477
|
+
}
|
|
478
|
+
interface PriceHistoryResponse extends ReadMetadata {
|
|
479
|
+
interval: PriceInterval;
|
|
480
|
+
prices: PriceBar[];
|
|
481
|
+
}
|
|
482
|
+
interface NewsResponse extends ReadMetadata {
|
|
483
|
+
news: NewsArticle[];
|
|
484
|
+
}
|
|
485
|
+
interface InsiderTrade {
|
|
486
|
+
filing_accession: string;
|
|
487
|
+
filing_date: string;
|
|
488
|
+
filing_accepted_at: string | null;
|
|
489
|
+
filing_url: string;
|
|
490
|
+
document_type: string;
|
|
491
|
+
is_amendment: boolean;
|
|
492
|
+
date_of_original_submission: string | null;
|
|
493
|
+
period_of_report: string;
|
|
494
|
+
reporting_owner_cik: string | null;
|
|
495
|
+
reporting_owner_name: string;
|
|
496
|
+
is_director: boolean;
|
|
497
|
+
is_officer: boolean;
|
|
498
|
+
is_ten_percent_owner: boolean;
|
|
499
|
+
is_other: boolean;
|
|
500
|
+
officer_title: string | null;
|
|
501
|
+
other_text: string | null;
|
|
502
|
+
security_type: "non_derivative" | "derivative";
|
|
503
|
+
filing_section_row_number: number;
|
|
504
|
+
security_title: string;
|
|
505
|
+
transaction_date: string;
|
|
506
|
+
deemed_execution_date: string | null;
|
|
507
|
+
transaction_code: string;
|
|
508
|
+
transaction_shares: number;
|
|
509
|
+
transaction_price_per_share: number | null;
|
|
510
|
+
transaction_acquired_disposed_code: string;
|
|
511
|
+
shares_owned_following_transaction: number | null;
|
|
512
|
+
direct_or_indirect_ownership: string | null;
|
|
513
|
+
nature_of_ownership: string | null;
|
|
514
|
+
conversion_or_exercise_price: number | null;
|
|
515
|
+
exercise_date: string | null;
|
|
516
|
+
expiration_date: string | null;
|
|
517
|
+
underlying_security_title: string | null;
|
|
518
|
+
underlying_security_shares: number | null;
|
|
519
|
+
remarks: string | null;
|
|
520
|
+
footnotes: string[];
|
|
521
|
+
supersedes_key: string;
|
|
522
|
+
refreshed_at: string;
|
|
523
|
+
}
|
|
524
|
+
interface InsiderTradesResponse extends ReadMetadata {
|
|
525
|
+
count: number;
|
|
526
|
+
limit: number;
|
|
527
|
+
insider_trades: InsiderTrade[];
|
|
528
|
+
}
|
|
529
|
+
interface GeneralOverviewFinancials {
|
|
530
|
+
availability: DataAvailability;
|
|
531
|
+
as_of: string | null;
|
|
532
|
+
income_statements: IncomeStatement[];
|
|
533
|
+
balance_sheets: BalanceSheet[];
|
|
534
|
+
cash_flow_statements: CashFlowStatement[];
|
|
535
|
+
key_statistics: KeyStatistics | null;
|
|
536
|
+
}
|
|
537
|
+
interface GeneralOverviewPriceSnapshot {
|
|
538
|
+
availability: DataAvailability;
|
|
539
|
+
as_of: string | null;
|
|
540
|
+
snapshot: PriceSnapshot | null;
|
|
541
|
+
}
|
|
542
|
+
interface GeneralOverviewNews {
|
|
543
|
+
availability: DataAvailability;
|
|
544
|
+
as_of: string | null;
|
|
545
|
+
articles: NewsArticle[];
|
|
546
|
+
}
|
|
547
|
+
interface GeneralOverviewResponse extends ReadMetadata {
|
|
548
|
+
period: FinancialPeriod;
|
|
549
|
+
company_facts: CompanyFacts;
|
|
550
|
+
financials: GeneralOverviewFinancials;
|
|
551
|
+
price_snapshot: GeneralOverviewPriceSnapshot;
|
|
552
|
+
news: GeneralOverviewNews;
|
|
553
|
+
}
|
|
554
|
+
interface InstitutionalOwnershipEntry {
|
|
555
|
+
holder_name: string;
|
|
556
|
+
reported_at: string | null;
|
|
557
|
+
shares: number | null;
|
|
558
|
+
value: number | null;
|
|
559
|
+
pct_held: number | null;
|
|
560
|
+
pct_change: number | null;
|
|
561
|
+
}
|
|
562
|
+
interface InstitutionalOwnershipResponse extends ReadMetadata {
|
|
563
|
+
source: "yahoo_finance";
|
|
564
|
+
ownership: InstitutionalOwnershipEntry[];
|
|
565
|
+
}
|
|
566
|
+
interface InvestorPortfolioInvestor {
|
|
567
|
+
cik: string;
|
|
568
|
+
name: string;
|
|
569
|
+
}
|
|
570
|
+
interface InvestorPortfolioSummary {
|
|
571
|
+
accession_number: string | null;
|
|
572
|
+
holdings_reported: number | null;
|
|
573
|
+
holdings_returned: number;
|
|
574
|
+
total_value: number | null;
|
|
575
|
+
}
|
|
576
|
+
interface InvestorPortfolioHolding {
|
|
577
|
+
issuer: string;
|
|
578
|
+
class_title: string | null;
|
|
579
|
+
cusip: string | null;
|
|
580
|
+
value: number | null;
|
|
581
|
+
shares: number | null;
|
|
582
|
+
share_type: string | null;
|
|
583
|
+
put_call: string | null;
|
|
584
|
+
investment_discretion: string | null;
|
|
585
|
+
voting_authority_sole: number | null;
|
|
586
|
+
voting_authority_shared: number | null;
|
|
587
|
+
voting_authority_none: number | null;
|
|
588
|
+
}
|
|
589
|
+
interface InvestorPortfolioResponse {
|
|
590
|
+
source: "sec_13f";
|
|
591
|
+
availability: DataAvailability;
|
|
592
|
+
as_of: string | null;
|
|
593
|
+
investor: InvestorPortfolioInvestor;
|
|
594
|
+
report_period: string | null;
|
|
595
|
+
filing_date: string | null;
|
|
596
|
+
summary: InvestorPortfolioSummary;
|
|
597
|
+
holdings: InvestorPortfolioHolding[];
|
|
598
|
+
}
|
|
599
|
+
interface GlobalInterestRateObservation {
|
|
600
|
+
date: string;
|
|
601
|
+
value: number;
|
|
602
|
+
}
|
|
603
|
+
interface GlobalInterestRateSeries {
|
|
604
|
+
key: GlobalInterestRateSeriesKey;
|
|
605
|
+
series_id: string;
|
|
606
|
+
label: string;
|
|
607
|
+
region: string;
|
|
608
|
+
country_code: string;
|
|
609
|
+
frequency: "daily" | "monthly";
|
|
610
|
+
latest: GlobalInterestRateObservation | null;
|
|
611
|
+
observations: GlobalInterestRateObservation[];
|
|
612
|
+
}
|
|
613
|
+
interface GlobalInterestRatesResponse {
|
|
614
|
+
source: "fred";
|
|
615
|
+
availability: DataAvailability;
|
|
616
|
+
as_of: string | null;
|
|
617
|
+
rates: GlobalInterestRateSeries[];
|
|
618
|
+
}
|
|
619
|
+
type AnalystEstimate = SnakeCasedProperties<Omit<AnalystEstimateData, "ticker">>;
|
|
620
|
+
type AnalystPriceTarget = SnakeCasedProperties<AnalystPriceTargetData>;
|
|
621
|
+
interface AnalystEstimatesResponse {
|
|
622
|
+
ticker: string;
|
|
623
|
+
availability: DataAvailability;
|
|
624
|
+
as_of: string | null;
|
|
625
|
+
analyst_estimates: AnalystEstimate[];
|
|
626
|
+
price_targets: AnalystPriceTarget | null;
|
|
627
|
+
}
|
|
628
|
+
interface PriceSnapshotResponse extends ReadMetadata {
|
|
629
|
+
snapshot: PriceSnapshot | null;
|
|
630
|
+
}
|
|
631
|
+
interface SegmentedRevenueItem {
|
|
632
|
+
name: string;
|
|
633
|
+
amount: number | null;
|
|
634
|
+
segments: Array<{
|
|
635
|
+
label: string;
|
|
636
|
+
type: string;
|
|
637
|
+
}>;
|
|
638
|
+
}
|
|
639
|
+
interface SegmentedRevenuePeriod {
|
|
640
|
+
ticker: string;
|
|
641
|
+
report_period: string;
|
|
642
|
+
period: string;
|
|
643
|
+
items: SegmentedRevenueItem[];
|
|
644
|
+
}
|
|
645
|
+
interface SegmentedRevenuesResponse extends ReadMetadata {
|
|
646
|
+
period: FinancialPeriod;
|
|
647
|
+
segmented_revenues: SegmentedRevenuePeriod[];
|
|
648
|
+
}
|
|
649
|
+
interface QuarterlyHighlightsMetric {
|
|
650
|
+
key: string;
|
|
651
|
+
label: string;
|
|
652
|
+
category: string;
|
|
653
|
+
unit: "usd" | "count" | "decimal_ratio";
|
|
654
|
+
value: number;
|
|
655
|
+
yoy_change: number | null;
|
|
656
|
+
}
|
|
657
|
+
interface QuarterlyHighlightsPayload {
|
|
658
|
+
ticker: string;
|
|
659
|
+
report_period: string;
|
|
660
|
+
period: "quarterly";
|
|
661
|
+
source_quarter_label: string | null;
|
|
662
|
+
source_url: string;
|
|
663
|
+
refreshed_at: string;
|
|
664
|
+
metrics: QuarterlyHighlightsMetric[];
|
|
665
|
+
}
|
|
666
|
+
interface QuarterlyHighlightsResponse extends ReadMetadata {
|
|
667
|
+
quarterly_highlights: QuarterlyHighlightsPayload | null;
|
|
668
|
+
}
|
|
669
|
+
interface SegmentedRevenuesOpts extends ReportPeriodFilterOpts {
|
|
670
|
+
period: FinancialPeriod;
|
|
671
|
+
limit?: number;
|
|
672
|
+
segmentType?: string;
|
|
673
|
+
}
|
|
674
|
+
interface ScreenerFieldMetadata {
|
|
675
|
+
name: string;
|
|
676
|
+
type: ScreenerFieldType;
|
|
677
|
+
source: ScreenerFieldSource;
|
|
678
|
+
operators: ScreenerApiOperator[];
|
|
679
|
+
cli_operators: ScreenerCliOperator[];
|
|
680
|
+
value_encoding?: ScreenerFieldValueEncoding;
|
|
681
|
+
value_example?: string;
|
|
682
|
+
}
|
|
683
|
+
interface ScreenerFieldsResponse {
|
|
684
|
+
fields: ScreenerFieldMetadata[];
|
|
685
|
+
}
|
|
686
|
+
interface ScreenerRequest {
|
|
687
|
+
filters: ScreenerFilter[];
|
|
688
|
+
limit?: number;
|
|
689
|
+
}
|
|
690
|
+
interface ScreenerResultRow {
|
|
691
|
+
ticker: string;
|
|
692
|
+
name: string;
|
|
693
|
+
market_cap: number | null;
|
|
694
|
+
[key: string]: string | number | null;
|
|
695
|
+
}
|
|
696
|
+
interface ScreenerResponse {
|
|
697
|
+
as_of: string | null;
|
|
698
|
+
count: number;
|
|
699
|
+
limit: number;
|
|
700
|
+
has_more: boolean;
|
|
701
|
+
filters_applied: ScreenerFilter[];
|
|
702
|
+
results: ScreenerResultRow[];
|
|
703
|
+
}
|
|
704
|
+
declare const DEFAULT_API_BASE_URL = "https://api.truenorth-financial.ai/v1";
|
|
705
|
+
declare class TnFinancialData {
|
|
706
|
+
private apiKey;
|
|
707
|
+
private baseUrl;
|
|
708
|
+
private fetchFn;
|
|
709
|
+
constructor(opts: ClientOptions);
|
|
710
|
+
private request;
|
|
711
|
+
private extractErrorMessage;
|
|
712
|
+
private appendLimitParam;
|
|
713
|
+
private appendReportPeriodParams;
|
|
714
|
+
private buildFinancialParams;
|
|
715
|
+
private buildGeneralOverviewParams;
|
|
716
|
+
private buildOptionalFinancialParams;
|
|
717
|
+
private buildSegmentedRevenueParams;
|
|
718
|
+
private buildQuarterlyHighlightsParams;
|
|
719
|
+
private buildInsiderTradeParams;
|
|
720
|
+
getIncomeStatements(ticker: string, opts: FinancialOpts): Promise<IncomeStatementsResponse>;
|
|
721
|
+
getBalanceSheets(ticker: string, opts: FinancialOpts): Promise<BalanceSheetsResponse>;
|
|
722
|
+
getCashFlowStatements(ticker: string, opts: FinancialOpts): Promise<CashFlowStatementsResponse>;
|
|
723
|
+
getFinancials(ticker: string, opts: FinancialOpts): Promise<FinancialsResponse>;
|
|
724
|
+
getFinancialMetrics(ticker: string, opts?: FinancialMetricsOpts): Promise<FinancialMetricsResponse>;
|
|
725
|
+
getFinancialMetricsSnapshot(ticker: string, opts?: Pick<FinancialMetricsOpts, "period">): Promise<FinancialMetricsSnapshotResponse>;
|
|
726
|
+
getEarnings(ticker: string, opts?: EarningsOpts): Promise<EarningsResponse>;
|
|
727
|
+
getGeneralOverview(ticker: string, opts?: GeneralOverviewOpts): Promise<GeneralOverviewResponse>;
|
|
728
|
+
getKeyStatistics(ticker: string): Promise<KeyStatisticsResponse>;
|
|
729
|
+
getAvailableTickers(): Promise<AvailableTickersResponse>;
|
|
730
|
+
getPrices(ticker: string, opts: PriceOpts): Promise<PriceHistoryResponse>;
|
|
731
|
+
getPriceSnapshot(ticker: string): Promise<PriceSnapshotResponse>;
|
|
732
|
+
getNews(ticker: string, opts?: NewsOpts): Promise<NewsResponse>;
|
|
733
|
+
getInsiderTrades(ticker: string, opts?: InsiderTradesOpts): Promise<InsiderTradesResponse>;
|
|
734
|
+
getInstitutionalOwnership(ticker: string, opts?: InstitutionalOwnershipOpts): Promise<InstitutionalOwnershipResponse>;
|
|
735
|
+
getInvestorPortfolio(opts: InvestorPortfolioOpts): Promise<InvestorPortfolioResponse>;
|
|
736
|
+
getGlobalInterestRates(opts?: GlobalInterestRatesOpts): Promise<GlobalInterestRatesResponse>;
|
|
737
|
+
getAnalystEstimates(ticker: string): Promise<AnalystEstimatesResponse>;
|
|
738
|
+
getCompanyFacts(ticker: string): Promise<{
|
|
739
|
+
company_facts: CompanyFacts;
|
|
740
|
+
}>;
|
|
741
|
+
getSegmentedRevenues(ticker: string, opts: SegmentedRevenuesOpts): Promise<SegmentedRevenuesResponse>;
|
|
742
|
+
getQuarterlyHighlights(ticker: string, opts?: QuarterlyHighlightsOpts): Promise<QuarterlyHighlightsResponse>;
|
|
743
|
+
getScreenerFields(): Promise<ScreenerFieldsResponse>;
|
|
744
|
+
screen(request: ScreenerRequest): Promise<ScreenerResponse>;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
export { type AnalystEstimate, type AnalystEstimatesResponse, type AnalystPriceTarget, type AvailableTicker, type AvailableTickersResponse, type BalanceSheet, type BalanceSheetsResponse, type CashFlowStatement, type CashFlowStatementsResponse, type ClientOptions, type CompanyFacts, type ConsensusSurprise, DEFAULT_API_BASE_URL, type DataAvailability, type EarningsOpts, type EarningsResponse, type EarningsRow, type FinancialMetric, type FinancialMetricsOpts, type FinancialMetricsResponse, type FinancialMetricsSnapshotResponse, type FinancialOpts, type FinancialsResponse, type GeneralOverviewFinancials, type GeneralOverviewNews, type GeneralOverviewOpts, type GeneralOverviewPriceSnapshot, type GeneralOverviewResponse, type GlobalInterestRateObservation, type GlobalInterestRateSeries, type GlobalInterestRatesOpts, type GlobalInterestRatesResponse, type IncomeStatement, type IncomeStatementsResponse, type InsiderTrade, type InsiderTradesOpts, type InsiderTradesResponse, type InstitutionalOwnershipEntry, type InstitutionalOwnershipOpts, type InstitutionalOwnershipResponse, type InvestorPortfolioHolding, type InvestorPortfolioInvestor, type InvestorPortfolioOpts, type InvestorPortfolioResponse, type InvestorPortfolioSummary, type KeyStatistics, type KeyStatisticsResponse, type NewsArticle, type NewsOpts, type NewsResponse, type OptionalFinancialQueryOpts, type PriceBar, type PriceHistoryResponse, type PriceOpts, type PriceSnapshot, type PriceSnapshotResponse, type QuarterlyHighlightsMetric, type QuarterlyHighlightsOpts, type QuarterlyHighlightsPayload, type QuarterlyHighlightsResponse, type ReadMetadata, type ReportPeriodFilterOpts, type ScreenerFieldMetadata, type ScreenerFieldsResponse, type ScreenerRequest, type ScreenerResponse, type ScreenerResultRow, type SegmentedRevenueItem, type SegmentedRevenuePeriod, type SegmentedRevenuesOpts, type SegmentedRevenuesResponse, type SnakeCase, TnFinancialData };
|