laplace-api 3.0.1 → 4.0.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/package.json +1 -1
- package/src/client/broker.ts +175 -0
- package/src/client/capital_increase.ts +11 -11
- package/src/client/collections.ts +5 -13
- package/src/client/financial_fundamentals.ts +41 -33
- package/src/client/financial_ratios.ts +56 -35
- package/src/client/funds.ts +139 -0
- package/src/client/key-insights.ts +17 -0
- package/src/client/live-price.ts +25 -0
- package/src/client/stocks.ts +12 -2
- package/src/test/broker.test.ts +238 -0
- package/src/test/capital_increase.test.ts +119 -15
- package/src/test/collections.test.ts +69 -11
- package/src/test/custom_theme.test.ts +18 -9
- package/src/test/financial_fundamentals.test.ts +23 -8
- package/src/test/financial_ratios.test.ts +67 -37
- package/src/test/funds.test.ts +110 -0
- package/src/test/helpers.ts +58 -0
- package/src/test/key-insight.test.ts +48 -0
- package/src/test/live-price.test.ts +4 -5
- package/src/test/search.test.ts +71 -22
- package/src/test/stocks.test.ts +185 -67
package/package.json
CHANGED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { PaginatedResponse } from "./capital_increase";
|
|
2
|
+
import { Client } from "./client";
|
|
3
|
+
import { Region } from "./collections";
|
|
4
|
+
import { AssetClass, AssetType } from "./stocks";
|
|
5
|
+
|
|
6
|
+
export enum BrokerSort {
|
|
7
|
+
NetAmount = "netAmount",
|
|
8
|
+
TotalAmount = "totalAmount",
|
|
9
|
+
TotalVolume = "totalVolume",
|
|
10
|
+
TotalBuyAmount = "totalBuyAmount",
|
|
11
|
+
TotalBuyVolume = "totalBuyVolume",
|
|
12
|
+
TotalSellAmount = "totalSellAmount",
|
|
13
|
+
TotalSellVolume = "totalSellVolume",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum SortDirection {
|
|
17
|
+
Desc = "desc",
|
|
18
|
+
Asc = "asc",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Broker {
|
|
22
|
+
id: number;
|
|
23
|
+
symbol: string;
|
|
24
|
+
name: string;
|
|
25
|
+
longName: string;
|
|
26
|
+
logo: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface BrokerStock {
|
|
30
|
+
symbol: string;
|
|
31
|
+
name: string;
|
|
32
|
+
id: string;
|
|
33
|
+
assetType: AssetType;
|
|
34
|
+
assetClass: AssetClass;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface BrokerStats {
|
|
38
|
+
totalBuyAmount: number;
|
|
39
|
+
totalSellAmount: number;
|
|
40
|
+
netAmount: number;
|
|
41
|
+
totalBuyVolume: number;
|
|
42
|
+
totalSellVolume: number;
|
|
43
|
+
totalVolume: number;
|
|
44
|
+
totalAmount: number;
|
|
45
|
+
averageCost?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface BrokerItem extends BrokerStats {
|
|
49
|
+
broker?: Broker;
|
|
50
|
+
stock?: BrokerStock;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface BrokerList extends PaginatedResponse<BrokerItem> {
|
|
54
|
+
totalStats: BrokerStats;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class BrokerClient extends Client {
|
|
58
|
+
private static readonly BASE = "/api/v1/brokers";
|
|
59
|
+
|
|
60
|
+
async getBrokers(
|
|
61
|
+
region: Region,
|
|
62
|
+
page: number,
|
|
63
|
+
size: number
|
|
64
|
+
): Promise<PaginatedResponse<Broker>> {
|
|
65
|
+
return this.sendRequest<PaginatedResponse<Broker>>({
|
|
66
|
+
method: "GET",
|
|
67
|
+
url: BrokerClient.BASE,
|
|
68
|
+
params: {
|
|
69
|
+
region,
|
|
70
|
+
page,
|
|
71
|
+
size,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async getMarketStocks(
|
|
77
|
+
region: Region,
|
|
78
|
+
sortBy: BrokerSort,
|
|
79
|
+
sortDirection: SortDirection,
|
|
80
|
+
fromDate: string,
|
|
81
|
+
toDate: string,
|
|
82
|
+
page: number,
|
|
83
|
+
size: number
|
|
84
|
+
): Promise<BrokerList> {
|
|
85
|
+
return this.sendRequest<BrokerList>({
|
|
86
|
+
method: "GET",
|
|
87
|
+
url: BrokerClient.BASE + "/market/stock",
|
|
88
|
+
params: {
|
|
89
|
+
region,
|
|
90
|
+
sortBy,
|
|
91
|
+
sortDirection,
|
|
92
|
+
fromDate,
|
|
93
|
+
toDate,
|
|
94
|
+
page,
|
|
95
|
+
size,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async getMarketBrokers(
|
|
101
|
+
region: Region,
|
|
102
|
+
sortBy: BrokerSort,
|
|
103
|
+
sortDirection: SortDirection,
|
|
104
|
+
fromDate: string,
|
|
105
|
+
toDate: string,
|
|
106
|
+
page: number,
|
|
107
|
+
size: number
|
|
108
|
+
): Promise<BrokerList> {
|
|
109
|
+
return this.sendRequest<BrokerList>({
|
|
110
|
+
method: "GET",
|
|
111
|
+
url: BrokerClient.BASE + "/market",
|
|
112
|
+
params: {
|
|
113
|
+
region,
|
|
114
|
+
sortBy,
|
|
115
|
+
sortDirection,
|
|
116
|
+
fromDate,
|
|
117
|
+
toDate,
|
|
118
|
+
page,
|
|
119
|
+
size,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async getBrokersByStock(
|
|
125
|
+
symbol: string,
|
|
126
|
+
region: Region,
|
|
127
|
+
sortBy: BrokerSort,
|
|
128
|
+
sortDirection: SortDirection,
|
|
129
|
+
fromDate: string,
|
|
130
|
+
toDate: string,
|
|
131
|
+
page: number,
|
|
132
|
+
size: number
|
|
133
|
+
): Promise<BrokerList> {
|
|
134
|
+
return this.sendRequest<BrokerList>({
|
|
135
|
+
method: "GET",
|
|
136
|
+
url: BrokerClient.BASE + "/" + symbol,
|
|
137
|
+
params: {
|
|
138
|
+
symbol,
|
|
139
|
+
region,
|
|
140
|
+
sortBy,
|
|
141
|
+
sortDirection,
|
|
142
|
+
fromDate,
|
|
143
|
+
toDate,
|
|
144
|
+
page,
|
|
145
|
+
size,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async getStocksByBroker(
|
|
151
|
+
symbol: string,
|
|
152
|
+
region: Region,
|
|
153
|
+
sortBy: BrokerSort,
|
|
154
|
+
sortDirection: SortDirection,
|
|
155
|
+
fromDate: string,
|
|
156
|
+
toDate: string,
|
|
157
|
+
page: number,
|
|
158
|
+
size: number
|
|
159
|
+
): Promise<BrokerList> {
|
|
160
|
+
return this.sendRequest<BrokerList>({
|
|
161
|
+
method: "GET",
|
|
162
|
+
url: BrokerClient.BASE + "/stock/" + symbol,
|
|
163
|
+
params: {
|
|
164
|
+
symbol,
|
|
165
|
+
region,
|
|
166
|
+
sortBy,
|
|
167
|
+
sortDirection,
|
|
168
|
+
fromDate,
|
|
169
|
+
toDate,
|
|
170
|
+
page,
|
|
171
|
+
size,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from './client';
|
|
2
|
-
import { Region
|
|
2
|
+
import { Region } from './collections';
|
|
3
3
|
|
|
4
4
|
// type PaginatedResponse[T any] struct {
|
|
5
5
|
// RecordCount int `json:"recordCount"`
|
|
@@ -18,23 +18,23 @@ export interface CapitalIncrease {
|
|
|
18
18
|
currentCapital: string;
|
|
19
19
|
targetCapital: string;
|
|
20
20
|
types: string[];
|
|
21
|
-
spkApplicationResult: string;
|
|
22
|
-
spkApplicationDate: string;
|
|
23
|
-
spkApprovalDate: string;
|
|
24
|
-
paymentDate: string;
|
|
25
|
-
registrationDate: string;
|
|
21
|
+
spkApplicationResult: string | null;
|
|
22
|
+
spkApplicationDate: string | null;
|
|
23
|
+
spkApprovalDate: string | null;
|
|
24
|
+
paymentDate: string | null;
|
|
25
|
+
registrationDate: string | null;
|
|
26
26
|
specifiedCurrency: string;
|
|
27
27
|
symbol: string;
|
|
28
|
-
|
|
28
|
+
relatedDisclosureIds: number[];
|
|
29
29
|
rightsRate: string;
|
|
30
30
|
rightsPrice: string;
|
|
31
31
|
rightsTotalAmount: string;
|
|
32
|
-
rightsStartDate: string;
|
|
33
|
-
rightsEndDate: string;
|
|
34
|
-
rightsLastSellDate: string;
|
|
32
|
+
rightsStartDate: string | null;
|
|
33
|
+
rightsEndDate: string | null;
|
|
34
|
+
rightsLastSellDate: string | null;
|
|
35
35
|
bonusRate: string;
|
|
36
36
|
bonusTotalAmount: string;
|
|
37
|
-
bonusStartDate: string;
|
|
37
|
+
bonusStartDate: string | null;
|
|
38
38
|
bonusDividendRate: string;
|
|
39
39
|
bonusDividendTotalAmount: string;
|
|
40
40
|
externalCapitalIncreaseAmount: string;
|
|
@@ -26,14 +26,14 @@ export enum SortBy {
|
|
|
26
26
|
export interface Collection {
|
|
27
27
|
id: string;
|
|
28
28
|
title: string;
|
|
29
|
-
description
|
|
30
|
-
region
|
|
31
|
-
assetClass
|
|
29
|
+
description?: string;
|
|
30
|
+
region?: Region[];
|
|
31
|
+
assetClass?: string;
|
|
32
32
|
imageUrl: string;
|
|
33
33
|
avatarUrl: string;
|
|
34
34
|
numStocks: number;
|
|
35
|
-
image
|
|
36
|
-
order
|
|
35
|
+
image?: string;
|
|
36
|
+
order?: number;
|
|
37
37
|
status?: string;
|
|
38
38
|
metaData?: Record<string, any>;
|
|
39
39
|
}
|
|
@@ -71,10 +71,6 @@ export class CollectionClient extends Client {
|
|
|
71
71
|
return this.getAllCollectionsPrivate(CollectionType.Theme, region, locale);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async getAllCustomThemes(region: Region, locale: Locale): Promise<Collection[]> {
|
|
75
|
-
return this.getAllCollectionsPrivate(CollectionType.CustomTheme, region, locale);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
74
|
async getAllCollections(region: Region, locale: Locale): Promise<Collection[]> {
|
|
79
75
|
return this.getAllCollectionsPrivate(CollectionType.Collection, region, locale);
|
|
80
76
|
}
|
|
@@ -91,10 +87,6 @@ export class CollectionClient extends Client {
|
|
|
91
87
|
return this.getCollectionDetailPrivate(id, CollectionType.Theme, region, locale);
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
async getCustomThemeDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
95
|
-
return this.getCollectionDetailPrivate(id, CollectionType.CustomTheme, region, locale);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
90
|
async getCollectionDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
99
91
|
return this.getCollectionDetailPrivate(id, CollectionType.Collection, region, locale);
|
|
100
92
|
}
|
|
@@ -3,37 +3,39 @@ import { Region } from './collections';
|
|
|
3
3
|
import { AssetClass, AssetType } from './stocks';
|
|
4
4
|
|
|
5
5
|
export interface StockDividend {
|
|
6
|
-
date:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
date: string;
|
|
7
|
+
netAmount: number;
|
|
8
|
+
netRatio: number;
|
|
9
|
+
grossAmount: number;
|
|
10
|
+
grossRatio: number;
|
|
11
11
|
priceThen: number;
|
|
12
|
+
stoppageRatio: number;
|
|
13
|
+
stoppageAmount: number;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface StockStats {
|
|
15
|
-
previousClose
|
|
16
|
-
marketCap
|
|
17
|
-
peRatio
|
|
18
|
-
pbRatio
|
|
19
|
-
yearLow
|
|
20
|
-
yearHigh
|
|
21
|
-
weeklyReturn
|
|
22
|
-
monthlyReturn
|
|
23
|
-
|
|
24
|
-
ytdReturn
|
|
25
|
-
yearlyReturn
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
previousClose?: number;
|
|
18
|
+
marketCap?: number;
|
|
19
|
+
peRatio?: number;
|
|
20
|
+
pbRatio?: number;
|
|
21
|
+
yearLow?: number;
|
|
22
|
+
yearHigh?: number;
|
|
23
|
+
weeklyReturn?: number;
|
|
24
|
+
monthlyReturn?: number;
|
|
25
|
+
"3MonthReturn"?: number;
|
|
26
|
+
ytdReturn?: number;
|
|
27
|
+
yearlyReturn?: number;
|
|
28
|
+
"3YearReturn"?: number;
|
|
29
|
+
"5YearReturn"?: number;
|
|
28
30
|
symbol: string;
|
|
29
|
-
latestPrice
|
|
30
|
-
dailyChange
|
|
31
|
-
dayLow
|
|
32
|
-
dayHigh
|
|
33
|
-
lowerPriceLimit
|
|
34
|
-
upperPriceLimit
|
|
35
|
-
dayOpen
|
|
36
|
-
eps
|
|
31
|
+
latestPrice?: number;
|
|
32
|
+
dailyChange?: number;
|
|
33
|
+
dayLow?: number;
|
|
34
|
+
dayHigh?: number;
|
|
35
|
+
lowerPriceLimit?: number;
|
|
36
|
+
upperPriceLimit?: number;
|
|
37
|
+
dayOpen?: number;
|
|
38
|
+
eps?: number;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export enum StockStatsKey {
|
|
@@ -59,8 +61,8 @@ export enum StockStatsKey {
|
|
|
59
61
|
export interface TopMover {
|
|
60
62
|
symbol: string;
|
|
61
63
|
change: number;
|
|
62
|
-
assetClass
|
|
63
|
-
assetType
|
|
64
|
+
assetClass?: AssetClass;
|
|
65
|
+
assetType?: AssetType;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export enum TopMoverDirection {
|
|
@@ -69,10 +71,13 @@ export enum TopMoverDirection {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export class FinancialFundamentalsClient extends Client {
|
|
72
|
-
async getStockDividends(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
async getStockDividends(
|
|
75
|
+
symbol: string,
|
|
76
|
+
region: Region
|
|
77
|
+
): Promise<StockDividend[]> {
|
|
78
|
+
const url = new URL(`${this["baseUrl"]}/api/v2/stock/dividends`);
|
|
79
|
+
url.searchParams.append("symbol", symbol);
|
|
80
|
+
url.searchParams.append("region", region);
|
|
76
81
|
|
|
77
82
|
return this.sendRequest<StockDividend[]>({
|
|
78
83
|
method: 'GET',
|
|
@@ -91,13 +96,16 @@ export class FinancialFundamentalsClient extends Client {
|
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection, assetType?: AssetType
|
|
99
|
+
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection, assetType?: AssetType,
|
|
100
|
+
assetClass?: AssetClass
|
|
101
|
+
): Promise<TopMover[]> {
|
|
95
102
|
const url = new URL(`${this['baseUrl']}/api/v2/stock/top-movers`);
|
|
96
103
|
url.searchParams.append('region', region);
|
|
97
104
|
url.searchParams.append('page', page.toString());
|
|
98
105
|
url.searchParams.append('pageSize', pageSize.toString());
|
|
99
106
|
url.searchParams.append('direction', direction);
|
|
100
107
|
if (assetType) url.searchParams.append('assetType', assetType);
|
|
108
|
+
if (assetClass) url.searchParams.append("assetClass", assetClass);
|
|
101
109
|
|
|
102
110
|
return this.sendRequest<TopMover[]>({
|
|
103
111
|
method: 'GET',
|
|
@@ -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,7 +39,7 @@ 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 {
|
|
@@ -114,15 +119,16 @@ export enum HistoricalRatiosKey {
|
|
|
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,8 +145,6 @@ 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 {
|
|
@@ -167,24 +171,36 @@ export interface FinancialSheetDate {
|
|
|
167
171
|
year: number;
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
export class FinancialClient extends Client
|
|
171
|
-
async getFinancialRatioComparison(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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);
|
|
186
|
+
|
|
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
206
|
method: 'GET',
|
|
@@ -192,10 +208,15 @@ export class FinancialClient extends Client {
|
|
|
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
222
|
method: 'GET',
|
|
@@ -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
|
+
}
|