laplace-api 3.1.0 → 4.1.0
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/.github/workflows/publish.yml +37 -0
- package/.github/workflows/test.yml +25 -0
- package/README.md +461 -2
- package/package.json +1 -1
- package/src/client/broker.ts +79 -99
- package/src/client/capital_increase.ts +17 -22
- package/src/client/collections.ts +61 -40
- package/src/client/financial_fundamentals.ts +40 -35
- package/src/client/financial_ratios.ts +168 -128
- package/src/client/funds.ts +139 -0
- package/src/client/key-insights.ts +17 -0
- package/src/client/live-price-web-socket.ts +84 -11
- package/src/client/live-price.ts +210 -58
- package/src/client/politician.ts +75 -0
- package/src/client/stocks.ts +85 -2
- package/src/test/broker.test.ts +581 -170
- package/src/test/capital_increase.test.ts +266 -15
- package/src/test/collections.test.ts +460 -17
- package/src/test/custom_theme.test.ts +256 -65
- package/src/test/financial_fundamentals.test.ts +301 -45
- package/src/test/financial_ratios.test.ts +376 -75
- package/src/test/funds.test.ts +317 -0
- package/src/test/helpers.ts +58 -0
- package/src/test/key-insight.test.ts +110 -0
- package/src/test/live-price.test.ts +427 -67
- package/src/test/politician.test.ts +253 -0
- package/src/test/readme.test.ts +483 -0
- package/src/test/search.test.ts +308 -23
- package/src/test/stocks.test.ts +800 -70
- package/src/utilities/configuration.ts +23 -10
- package/src/utilities/test.env +2 -2
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import { Client } from
|
|
2
|
-
import { Region, Locale } from
|
|
1
|
+
import { Client } from "./client";
|
|
2
|
+
import { Region, Locale } from "./collections";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export enum RatioComparisonPeerType {
|
|
5
|
+
Industry = "industry",
|
|
6
|
+
Sector = "sector",
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface StockPeerFinancialRatioComparison {
|
|
10
|
+
metricName: string;
|
|
6
11
|
normalizedValue: number;
|
|
7
|
-
|
|
12
|
+
data: StockPeerFinancialRatioComparisonData[];
|
|
8
13
|
}
|
|
9
14
|
|
|
10
|
-
export interface
|
|
15
|
+
export interface StockPeerFinancialRatioComparisonData {
|
|
11
16
|
slug: string;
|
|
12
17
|
value: number;
|
|
13
|
-
|
|
18
|
+
average: number;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export interface StockHistoricalRatios {
|
|
@@ -22,7 +27,7 @@ export interface StockHistoricalRatios {
|
|
|
22
27
|
currency: Currency;
|
|
23
28
|
format: HistoricalRatiosFormat;
|
|
24
29
|
name: string;
|
|
25
|
-
items: StockHistoricalRatiosData[]
|
|
30
|
+
items: StockHistoricalRatiosData[];
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
export interface StockHistoricalRatiosData {
|
|
@@ -34,95 +39,96 @@ export interface StockHistoricalRatiosData {
|
|
|
34
39
|
export enum HistoricalRatiosFormat {
|
|
35
40
|
CURRENCY = "currency",
|
|
36
41
|
PERCENTAGE = "percentage",
|
|
37
|
-
DECIMAL = "decimal"
|
|
42
|
+
DECIMAL = "decimal",
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export enum HistoricalRatiosKey {
|
|
41
|
-
Revenue =
|
|
42
|
-
EBITDA =
|
|
43
|
-
NetProfit =
|
|
44
|
-
GrossMargin =
|
|
45
|
-
NetMargin =
|
|
46
|
-
ReturnOnAssets =
|
|
47
|
-
ReturnOnEquity =
|
|
48
|
-
ReturnOnCapitalEmployed =
|
|
49
|
-
ReturnOnInvestedCapital =
|
|
50
|
-
PriceToEarningsRatio =
|
|
51
|
-
PriceToEarnings =
|
|
52
|
-
PriceToBookRatio =
|
|
53
|
-
EnterpriseValueToEBITDA =
|
|
54
|
-
EnterpriseValueToInvestedCapital =
|
|
55
|
-
InterestCoverage =
|
|
56
|
-
QuickRatio =
|
|
57
|
-
LeverageRatio =
|
|
58
|
-
DebtToEquity =
|
|
59
|
-
RevenueGrowth =
|
|
60
|
-
EBITDAGrowth =
|
|
61
|
-
NetProfitGrowth =
|
|
62
|
-
FreeCashFlowGrowth =
|
|
63
|
-
CashConversionCycle =
|
|
64
|
-
DaysSalesOutstanding =
|
|
65
|
-
DaysPayable =
|
|
66
|
-
DaysInventory =
|
|
67
|
-
|
|
68
|
-
EBITDAMargin =
|
|
69
|
-
InventoryTurnover =
|
|
70
|
-
DepositGrowth =
|
|
71
|
-
NetInterestMargin =
|
|
72
|
-
CompensationGrowth =
|
|
73
|
-
PremiumPerCompensation =
|
|
74
|
-
EnterpriseValueToOperatingCashFlow =
|
|
75
|
-
EarningsBeforeTax =
|
|
76
|
-
CapitalExpenditure =
|
|
77
|
-
FinancialInvestments =
|
|
78
|
-
RealtimeEarningsPerShare =
|
|
79
|
-
RealtimeMarketValue =
|
|
80
|
-
RealtimePriceToBookRatio =
|
|
81
|
-
RealtimePriceToEarningsRatio =
|
|
82
|
-
CurrentRatio =
|
|
83
|
-
AssetTurnover =
|
|
84
|
-
TotalOperationalExpense =
|
|
85
|
-
TotalOperationalExpenseToGrossProfit =
|
|
86
|
-
CashAndCashEquivalents =
|
|
87
|
-
CashToAssets =
|
|
88
|
-
CapexToNetProfit =
|
|
89
|
-
RealtimeEnterpriseValueToEBITDA =
|
|
90
|
-
ReceivablesTurnover =
|
|
91
|
-
EarningsPerShare =
|
|
92
|
-
CreditToAssetRatio =
|
|
93
|
-
CreditToDepositRatio =
|
|
94
|
-
TechnicalProfitGrowth =
|
|
95
|
-
NetEarnedPremiumGrowth =
|
|
96
|
-
EBITGrowth =
|
|
97
|
-
CashReturnOnInvestedCapital =
|
|
98
|
-
MarketCapitalization =
|
|
99
|
-
ShortTermToLongTermObligations =
|
|
100
|
-
RetainedEarnings =
|
|
101
|
-
ThreeYearCAGRFreeCashFlow =
|
|
102
|
-
LongTermLoansToPeriodicProfitRatio =
|
|
103
|
-
LongTermLoans =
|
|
104
|
-
CommercialReceivablesToTotalCurrentAssets =
|
|
105
|
-
StockGrowth =
|
|
106
|
-
FiveYearRetainedEarningsChange =
|
|
107
|
-
ThreeYearCAGRRetainedEarnings =
|
|
108
|
-
PotentialOperatingCashFlow =
|
|
109
|
-
FreeCashFlowToEnterpriseValue =
|
|
110
|
-
DebtToDeposit =
|
|
111
|
-
NetDebt =
|
|
112
|
-
PaidCapital =
|
|
113
|
-
FinancialExpensesToEBIT =
|
|
46
|
+
Revenue = "satislar",
|
|
47
|
+
EBITDA = "ebitda",
|
|
48
|
+
NetProfit = "net_kar",
|
|
49
|
+
GrossMargin = "gross-margin",
|
|
50
|
+
NetMargin = "net-margin",
|
|
51
|
+
ReturnOnAssets = "roa",
|
|
52
|
+
ReturnOnEquity = "roe",
|
|
53
|
+
ReturnOnCapitalEmployed = "roce",
|
|
54
|
+
ReturnOnInvestedCapital = "roic",
|
|
55
|
+
PriceToEarningsRatio = "pe-ratio",
|
|
56
|
+
PriceToEarnings = "poe",
|
|
57
|
+
PriceToBookRatio = "pb-ratio",
|
|
58
|
+
EnterpriseValueToEBITDA = "ev-to-ebitda",
|
|
59
|
+
EnterpriseValueToInvestedCapital = "evic",
|
|
60
|
+
InterestCoverage = "interestCoverage",
|
|
61
|
+
QuickRatio = "quick-ratio",
|
|
62
|
+
LeverageRatio = "leverage-ratio",
|
|
63
|
+
DebtToEquity = "debt-to-equity",
|
|
64
|
+
RevenueGrowth = "satis_buyumesi",
|
|
65
|
+
EBITDAGrowth = "favok_buyumesi",
|
|
66
|
+
NetProfitGrowth = "net_kar_buyumesi",
|
|
67
|
+
FreeCashFlowGrowth = "serbest_nakit_akisi_buyumesi",
|
|
68
|
+
CashConversionCycle = "cash-conversion-cycle",
|
|
69
|
+
DaysSalesOutstanding = "days-sales-outstanding",
|
|
70
|
+
DaysPayable = "days-payable",
|
|
71
|
+
DaysInventory = "days-inventory",
|
|
72
|
+
|
|
73
|
+
EBITDAMargin = "favok_marji",
|
|
74
|
+
InventoryTurnover = "inventory-turnover",
|
|
75
|
+
DepositGrowth = "mevduat_buyumesi",
|
|
76
|
+
NetInterestMargin = "net_faiz_marji",
|
|
77
|
+
CompensationGrowth = "gerceklesen_tazminatlar_buyumesi",
|
|
78
|
+
PremiumPerCompensation = "prim_basina_tazminat_orani",
|
|
79
|
+
EnterpriseValueToOperatingCashFlow = "evOcf",
|
|
80
|
+
EarningsBeforeTax = "ebt",
|
|
81
|
+
CapitalExpenditure = "capex",
|
|
82
|
+
FinancialInvestments = "financial_investments",
|
|
83
|
+
RealtimeEarningsPerShare = "realtime_eps-basic",
|
|
84
|
+
RealtimeMarketValue = "realtime_piyasa_degeri",
|
|
85
|
+
RealtimePriceToBookRatio = "realtime_pb-ratio",
|
|
86
|
+
RealtimePriceToEarningsRatio = "realtime_pe-ratio",
|
|
87
|
+
CurrentRatio = "current-ratio",
|
|
88
|
+
AssetTurnover = "asset-turnover",
|
|
89
|
+
TotalOperationalExpense = "total_operational_expense",
|
|
90
|
+
TotalOperationalExpenseToGrossProfit = "total_operational_expense_gross_profit_ratio",
|
|
91
|
+
CashAndCashEquivalents = "cash_and_cash_equivalents",
|
|
92
|
+
CashToAssets = "cash_to_assets",
|
|
93
|
+
CapexToNetProfit = "capex_to_net_profit",
|
|
94
|
+
RealtimeEnterpriseValueToEBITDA = "realtime_ev-to-ebitda",
|
|
95
|
+
ReceivablesTurnover = "alacak_devir_hizi",
|
|
96
|
+
EarningsPerShare = "eps-basic",
|
|
97
|
+
CreditToAssetRatio = "kredi_aktif_orani",
|
|
98
|
+
CreditToDepositRatio = "kredi_mevduat_orani",
|
|
99
|
+
TechnicalProfitGrowth = "teknik_kar_buyumesi",
|
|
100
|
+
NetEarnedPremiumGrowth = "net_kazanilan_prim_buyumesi",
|
|
101
|
+
EBITGrowth = "ebitGrowth",
|
|
102
|
+
CashReturnOnInvestedCapital = "croic",
|
|
103
|
+
MarketCapitalization = "piyasa_degeri",
|
|
104
|
+
ShortTermToLongTermObligations = "short_term_obligations_long_term_obligations",
|
|
105
|
+
RetainedEarnings = "retained_earnings",
|
|
106
|
+
ThreeYearCAGRFreeCashFlow = "three_year_cagr_free_cash_flow",
|
|
107
|
+
LongTermLoansToPeriodicProfitRatio = "long_term_loans_period_profit_ratio",
|
|
108
|
+
LongTermLoans = "long_term_loans",
|
|
109
|
+
CommercialReceivablesToTotalCurrentAssets = "commercial_receivables_total_current_assets",
|
|
110
|
+
StockGrowth = "stock_growth",
|
|
111
|
+
FiveYearRetainedEarningsChange = "five_year_retained_earnings_change",
|
|
112
|
+
ThreeYearCAGRRetainedEarnings = "three_year_cagr_retained_earnings",
|
|
113
|
+
PotentialOperatingCashFlow = "pocf",
|
|
114
|
+
FreeCashFlowToEnterpriseValue = "fcfEv",
|
|
115
|
+
DebtToDeposit = "dd",
|
|
116
|
+
NetDebt = "net_borc",
|
|
117
|
+
PaidCapital = "odenmis_sermaye",
|
|
118
|
+
FinancialExpensesToEBIT = "financial_expenses_ebit_ratio",
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
export interface StockHistoricalRatiosDescription {
|
|
122
|
+
id: number;
|
|
123
|
+
format: string;
|
|
124
|
+
currency: string;
|
|
117
125
|
slug: string;
|
|
126
|
+
createdAt: string;
|
|
127
|
+
updatedAt: string;
|
|
118
128
|
name: string;
|
|
119
|
-
suffix: string;
|
|
120
|
-
prefix: string;
|
|
121
|
-
display: boolean;
|
|
122
|
-
precision: number;
|
|
123
|
-
multiplier: number;
|
|
124
129
|
description: string;
|
|
125
|
-
|
|
130
|
+
locale: string;
|
|
131
|
+
isRealtime: boolean;
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
export interface HistoricalFinancialSheets {
|
|
@@ -139,26 +145,24 @@ export interface HistoricalFinancialSheetRow {
|
|
|
139
145
|
value: number;
|
|
140
146
|
lineCodeId: number;
|
|
141
147
|
indentLevel: number;
|
|
142
|
-
firstAncestorLineCodeId: number;
|
|
143
|
-
sectionLineCodeId: number;
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
export enum FinancialSheetType {
|
|
147
|
-
IncomeStatement =
|
|
148
|
-
BalanceSheet =
|
|
149
|
-
CashFlow =
|
|
151
|
+
IncomeStatement = "incomeStatement",
|
|
152
|
+
BalanceSheet = "balanceSheet",
|
|
153
|
+
CashFlow = "cashFlowStatement",
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
export enum FinancialSheetPeriod {
|
|
153
|
-
Annual =
|
|
154
|
-
Quarterly =
|
|
155
|
-
Cumulative =
|
|
157
|
+
Annual = "annual",
|
|
158
|
+
Quarterly = "quarterly",
|
|
159
|
+
Cumulative = "cumulative",
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
export enum Currency {
|
|
159
|
-
USD =
|
|
160
|
-
TRY =
|
|
161
|
-
EUR =
|
|
163
|
+
USD = "USD",
|
|
164
|
+
TRY = "TRY",
|
|
165
|
+
EUR = "EUR",
|
|
162
166
|
}
|
|
163
167
|
|
|
164
168
|
export interface FinancialSheetDate {
|
|
@@ -167,38 +171,55 @@ export interface FinancialSheetDate {
|
|
|
167
171
|
year: number;
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
export class FinancialClient extends Client
|
|
171
|
-
async getFinancialRatioComparison(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
export class FinancialClient extends Client {
|
|
175
|
+
async getFinancialRatioComparison(
|
|
176
|
+
symbol: string,
|
|
177
|
+
region: Region,
|
|
178
|
+
peerType: RatioComparisonPeerType
|
|
179
|
+
): Promise<StockPeerFinancialRatioComparison[]> {
|
|
180
|
+
const url = new URL(
|
|
181
|
+
`${this["baseUrl"]}/api/v2/stock/financial-ratio-comparison`
|
|
182
|
+
);
|
|
183
|
+
url.searchParams.append("symbol", symbol);
|
|
184
|
+
url.searchParams.append("region", region);
|
|
185
|
+
url.searchParams.append("peerType", peerType);
|
|
175
186
|
|
|
176
|
-
return this.sendRequest<
|
|
177
|
-
method:
|
|
187
|
+
return this.sendRequest<StockPeerFinancialRatioComparison[]>({
|
|
188
|
+
method: "GET",
|
|
178
189
|
url: url.toString(),
|
|
179
190
|
});
|
|
180
191
|
}
|
|
181
192
|
|
|
182
|
-
async getHistoricalRatios(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
193
|
+
async getHistoricalRatios(
|
|
194
|
+
symbol: string,
|
|
195
|
+
keys: HistoricalRatiosKey[],
|
|
196
|
+
region: Region,
|
|
197
|
+
locale: Locale
|
|
198
|
+
): Promise<StockHistoricalRatios[]> {
|
|
199
|
+
const url = new URL(`${this["baseUrl"]}/api/v2/stock/historical-ratios`);
|
|
200
|
+
url.searchParams.append("symbol", symbol);
|
|
201
|
+
url.searchParams.append("region", region);
|
|
202
|
+
url.searchParams.append("locale", locale);
|
|
203
|
+
url.searchParams.append("slugs", keys.join(","));
|
|
188
204
|
|
|
189
205
|
return this.sendRequest<StockHistoricalRatios[]>({
|
|
190
|
-
method:
|
|
206
|
+
method: "GET",
|
|
191
207
|
url: url.toString(),
|
|
192
208
|
});
|
|
193
209
|
}
|
|
194
210
|
|
|
195
|
-
async getHistoricalRatiosDescriptions(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
async getHistoricalRatiosDescriptions(
|
|
212
|
+
locale: Locale,
|
|
213
|
+
region: Region
|
|
214
|
+
): Promise<StockHistoricalRatiosDescription[]> {
|
|
215
|
+
const url = new URL(
|
|
216
|
+
`${this["baseUrl"]}/api/v2/stock/historical-ratios/descriptions`
|
|
217
|
+
);
|
|
218
|
+
url.searchParams.append("locale", locale);
|
|
219
|
+
url.searchParams.append("region", region);
|
|
199
220
|
|
|
200
221
|
return this.sendRequest<StockHistoricalRatiosDescription[]>({
|
|
201
|
-
method:
|
|
222
|
+
method: "GET",
|
|
202
223
|
url: url.toString(),
|
|
203
224
|
});
|
|
204
225
|
}
|
|
@@ -212,18 +233,37 @@ export class FinancialClient extends Client {
|
|
|
212
233
|
currency: Currency,
|
|
213
234
|
region: Region
|
|
214
235
|
): Promise<HistoricalFinancialSheets> {
|
|
215
|
-
const url = new URL(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
url.searchParams.append(
|
|
219
|
-
url.searchParams.append(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
236
|
+
const url = new URL(
|
|
237
|
+
`${this["baseUrl"]}/api/v3/stock/historical-financial-sheets`
|
|
238
|
+
);
|
|
239
|
+
url.searchParams.append("symbol", symbol);
|
|
240
|
+
url.searchParams.append(
|
|
241
|
+
"from",
|
|
242
|
+
`${from.year.toString().padStart(4, "0")}-${from.month
|
|
243
|
+
.toString()
|
|
244
|
+
.padStart(2, "0")}-${from.day.toString().padStart(2, "0")}`
|
|
245
|
+
);
|
|
246
|
+
url.searchParams.append(
|
|
247
|
+
"to",
|
|
248
|
+
`${to.year.toString().padStart(4, "0")}-${to.month
|
|
249
|
+
.toString()
|
|
250
|
+
.padStart(2, "0")}-${to.day.toString().padStart(2, "0")}`
|
|
251
|
+
);
|
|
252
|
+
url.searchParams.append("sheetType", sheetType);
|
|
253
|
+
url.searchParams.append("periodType", period);
|
|
254
|
+
url.searchParams.append("currency", currency);
|
|
255
|
+
url.searchParams.append("region", region);
|
|
256
|
+
|
|
257
|
+
if (
|
|
258
|
+
sheetType === FinancialSheetType.BalanceSheet &&
|
|
259
|
+
period !== FinancialSheetPeriod.Cumulative
|
|
260
|
+
) {
|
|
261
|
+
throw new Error("balance sheet is only available for cumulative period");
|
|
262
|
+
}
|
|
223
263
|
|
|
224
264
|
return this.sendRequest<HistoricalFinancialSheets>({
|
|
225
|
-
method:
|
|
265
|
+
method: "GET",
|
|
226
266
|
url: url.toString(),
|
|
227
267
|
});
|
|
228
268
|
}
|
|
229
|
-
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Client } from "./client";
|
|
2
|
+
import { Region } from "./collections";
|
|
3
|
+
import { AssetType } from "./stocks";
|
|
4
|
+
|
|
5
|
+
export enum FundType {
|
|
6
|
+
STOCK_UMBRELLA_FUND = "STOCK_UMBRELLA_FUND",
|
|
7
|
+
VARIABLE_UMBRELLA_FUND = "VARIABLE_UMBRELLA_FUND",
|
|
8
|
+
PARTICIPATION_UMBRELLA_FUND = "PARTICIPATION_UMBRELLA_FUND",
|
|
9
|
+
FLEXIBLE_UMBRELLA_FUND = "FLEXIBLE_UMBRELLA_FUND",
|
|
10
|
+
FUND_BASKET_UMBRELLA_FUND = "FUND_BASKET_UMBRELLA_FUND",
|
|
11
|
+
MONEY_MARKET_UMBRELLA_FUND = "MONEY_MARKET_UMBRELLA_FUND",
|
|
12
|
+
PRECIOUS_METALS_UMBRELLA_FUND = "PRECIOUS_METALS_UMBRELLA_FUND",
|
|
13
|
+
DEBT_INSTRUMENTS_UMBRELLA_FUND = "DEBT_INSTRUMENTS_UMBRELLA_FUND",
|
|
14
|
+
MIXED_UMBRELLA_FUND = "MIXED_UMBRELLA_FUND",
|
|
15
|
+
UNKNOWN_FUND_TYPE = "UNKNOWN_FUND_TYPE",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Fund {
|
|
19
|
+
assetType: AssetType;
|
|
20
|
+
name: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
active: boolean;
|
|
23
|
+
managementFee: number;
|
|
24
|
+
riskLevel: number;
|
|
25
|
+
fundType: FundType;
|
|
26
|
+
ownerSymbol: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface FundStats {
|
|
30
|
+
yearBeta: number;
|
|
31
|
+
yearStdev: number;
|
|
32
|
+
ytdReturn: number;
|
|
33
|
+
yearMomentum: number;
|
|
34
|
+
yearlyReturn: number;
|
|
35
|
+
monthlyReturn: number;
|
|
36
|
+
fiveYearReturn: number;
|
|
37
|
+
sixMonthReturn: number;
|
|
38
|
+
threeYearReturn: number;
|
|
39
|
+
threeMonthReturn: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export enum FundContentType {
|
|
43
|
+
BIST_STOCK = "BIST_STOCK",
|
|
44
|
+
OTHER_STOCK = "OTHER_STOCK",
|
|
45
|
+
UNKNOWN = "UNKNOWN",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export enum FundAssetCategory {
|
|
49
|
+
OTHER = "OTHER",
|
|
50
|
+
EQUITY = "EQUITY",
|
|
51
|
+
LIQUID_DEPOSIT = "LIQUID_DEPOSIT",
|
|
52
|
+
FUTURES_CASH_COLLATERAL = "FUTURES_CASH_COLLATERAL",
|
|
53
|
+
INVESTMENT_FUNDS = "INVESTMENT_FUNDS",
|
|
54
|
+
PARTICIPATION_ACCOUNT = "PARTICIPATION_ACCOUNT",
|
|
55
|
+
PRECIOUS_METALS = "PRECIOUS_METALS",
|
|
56
|
+
CORPORATE_BOND = "CORPORATE_BOND",
|
|
57
|
+
CURRENCY = "CURRENCY",
|
|
58
|
+
PUBLIC_EXTERNAL_DEBT_SECURITIES = "PUBLIC_EXTERNAL_DEBT_SECURITIES",
|
|
59
|
+
PRIVATE_SECTOR_EXTERNAL_DEBT_SECURITIES = "PRIVATE_SECTOR_EXTERNAL_DEBT_SECURITIES",
|
|
60
|
+
PUBLIC_LEASE_CERTIFICATES = "PUBLIC_LEASE_CERTIFICATES",
|
|
61
|
+
PRIVATE_SECTOR_LEASE_CERTIFICATES = "PRIVATE_SECTOR_LEASE_CERTIFICATES",
|
|
62
|
+
FOREIGN_EXCHANGE_TRADED_FUNDS = "FOREIGN_EXCHANGE_TRADED_FUNDS",
|
|
63
|
+
PUBLIC_LEASE_CERTIFICATES_CURRENCY = "PUBLIC_LEASE_CERTIFICATES_CURRENCY",
|
|
64
|
+
GOVERNMENT_BOND = "GOVERNMENT_BOND",
|
|
65
|
+
PRIVATE_SECTOR_LEASE_CERTIFICATES_CURRENCY = "PRIVATE_SECTOR_LEASE_CERTIFICATES_CURRENCY",
|
|
66
|
+
UNKNOWN = "UNKNOWN",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface FundAsset {
|
|
70
|
+
type: FundContentType;
|
|
71
|
+
symbol: string;
|
|
72
|
+
wholePercentage: number;
|
|
73
|
+
categoryPercentage: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface FundDistribution {
|
|
77
|
+
categories: FundCategoryDistribution[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface FundCategoryDistribution {
|
|
81
|
+
category: FundAssetCategory;
|
|
82
|
+
percentage: number;
|
|
83
|
+
assets?: FundAsset[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export enum HistoricalFundPricePeriod {
|
|
87
|
+
OneWeek = "1H",
|
|
88
|
+
OneMonth = "1A",
|
|
89
|
+
ThreeMonth = "3A",
|
|
90
|
+
OneYear = "1Y",
|
|
91
|
+
ThreeYear = "3Y",
|
|
92
|
+
FiveYear = "5Y",
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FundHistoricalPrice {
|
|
96
|
+
aum: number;
|
|
97
|
+
date: string;
|
|
98
|
+
price: number;
|
|
99
|
+
shareCount: number;
|
|
100
|
+
investorCount: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export class FundsClient extends Client {
|
|
104
|
+
async getFunds(region: Region, page: number, pageSize: number) {
|
|
105
|
+
return this.sendRequest<Fund[]>({
|
|
106
|
+
method: "GET",
|
|
107
|
+
url: `/api/v1/fund`,
|
|
108
|
+
params: { region, page, pageSize },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async getFundStats(symbol: string, region: Region) {
|
|
113
|
+
return this.sendRequest<FundStats>({
|
|
114
|
+
method: "GET",
|
|
115
|
+
url: `/api/v1/fund/stats`,
|
|
116
|
+
params: { symbol, region },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async getFundDistribution(symbol: string, region: Region) {
|
|
121
|
+
return this.sendRequest<FundDistribution>({
|
|
122
|
+
method: "GET",
|
|
123
|
+
url: `/api/v1/fund/distribution`,
|
|
124
|
+
params: { symbol, region },
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async getHistoricalFundPrices(
|
|
129
|
+
symbol: string,
|
|
130
|
+
region: Region,
|
|
131
|
+
period: HistoricalFundPricePeriod
|
|
132
|
+
) {
|
|
133
|
+
return this.sendRequest<FundHistoricalPrice[]>({
|
|
134
|
+
method: "GET",
|
|
135
|
+
url: `/api/v1/fund/price`,
|
|
136
|
+
params: { symbol, region, period },
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Client } from "./client";
|
|
2
|
+
import { Region } from "./collections";
|
|
3
|
+
|
|
4
|
+
export interface KeyInsight {
|
|
5
|
+
symbol: string;
|
|
6
|
+
insight: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class KeyInsightClient extends Client {
|
|
10
|
+
async getKeyInsights(symbol: string, region: Region) {
|
|
11
|
+
return this.sendRequest<KeyInsight>({
|
|
12
|
+
method: "GET",
|
|
13
|
+
url: "/api/v1/key-insight",
|
|
14
|
+
params: { symbol, region },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|