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
package/src/client/broker.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import { PaginatedResponse } from "./capital_increase";
|
|
1
2
|
import { Client } from "./client";
|
|
2
3
|
import { Region } from "./collections";
|
|
3
4
|
import { AssetClass, AssetType } from "./stocks";
|
|
4
5
|
|
|
5
6
|
export enum BrokerSort {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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",
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
export interface Broker {
|
|
@@ -14,6 +24,7 @@ export interface Broker {
|
|
|
14
24
|
name: string;
|
|
15
25
|
longName: string;
|
|
16
26
|
logo: string;
|
|
27
|
+
supportedAssetClasses?: AssetClass[]
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
export interface BrokerStock {
|
|
@@ -22,10 +33,9 @@ export interface BrokerStock {
|
|
|
22
33
|
id: string;
|
|
23
34
|
assetType: AssetType;
|
|
24
35
|
assetClass: AssetClass;
|
|
25
|
-
region: Region;
|
|
26
36
|
}
|
|
27
37
|
|
|
28
|
-
export interface
|
|
38
|
+
export interface BrokerStats {
|
|
29
39
|
totalBuyAmount: number;
|
|
30
40
|
totalSellAmount: number;
|
|
31
41
|
netAmount: number;
|
|
@@ -33,164 +43,134 @@ export interface BaseBrokerStats {
|
|
|
33
43
|
totalSellVolume: number;
|
|
34
44
|
totalVolume: number;
|
|
35
45
|
totalAmount: number;
|
|
46
|
+
averageCost?: number;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
export interface
|
|
39
|
-
broker
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export interface MarketBrokersResponse {
|
|
43
|
-
recordCount: number;
|
|
44
|
-
totalStats: BaseBrokerStats;
|
|
45
|
-
items: BrokerStats[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TopBrokersResponse {
|
|
49
|
-
topStats: BaseBrokerStats;
|
|
50
|
-
restStats: BaseBrokerStats;
|
|
51
|
-
topItems: BrokerStats[];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface StockBrokerStats extends BaseBrokerStats {
|
|
55
|
-
averageCost: number;
|
|
56
|
-
broker: Broker;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface StockOverallStats extends BaseBrokerStats {
|
|
60
|
-
averageCost: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface StockBrokersResponse {
|
|
64
|
-
recordCount: number;
|
|
65
|
-
totalStats: StockOverallStats;
|
|
66
|
-
items: StockBrokerStats[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface TopStockBrokersResponse {
|
|
70
|
-
topStats: StockOverallStats;
|
|
71
|
-
restStats: StockOverallStats;
|
|
72
|
-
topItems: StockBrokerStats[];
|
|
49
|
+
export interface BrokerItem extends BrokerStats {
|
|
50
|
+
broker?: Broker;
|
|
51
|
+
stock?: BrokerStock;
|
|
73
52
|
}
|
|
74
53
|
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface TopStocksForBrokerResponse {
|
|
80
|
-
topStats: BaseBrokerStats;
|
|
81
|
-
restStats: BaseBrokerStats;
|
|
82
|
-
topItems: BrokerStockStats[];
|
|
54
|
+
export interface BrokerList extends PaginatedResponse<BrokerItem> {
|
|
55
|
+
totalStats: BrokerStats;
|
|
83
56
|
}
|
|
84
57
|
|
|
85
58
|
export class BrokerClient extends Client {
|
|
86
|
-
private static readonly BASE = "/api/v1/brokers";
|
|
87
59
|
|
|
88
|
-
async
|
|
60
|
+
async getBrokers(
|
|
89
61
|
region: Region,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
): Promise<MarketBrokersResponse> {
|
|
96
|
-
return this.sendRequest<MarketBrokersResponse>({
|
|
62
|
+
page: number,
|
|
63
|
+
size: number,
|
|
64
|
+
assetClass?: AssetClass
|
|
65
|
+
): Promise<PaginatedResponse<Broker>> {
|
|
66
|
+
return this.sendRequest<PaginatedResponse<Broker>>({
|
|
97
67
|
method: "GET",
|
|
98
|
-
url:
|
|
68
|
+
url: "/api/v1/brokers",
|
|
99
69
|
params: {
|
|
100
70
|
region,
|
|
101
|
-
fromDate,
|
|
102
|
-
toDate,
|
|
103
|
-
sortBy,
|
|
104
71
|
page,
|
|
105
72
|
size,
|
|
73
|
+
assetClass
|
|
106
74
|
},
|
|
107
75
|
});
|
|
108
76
|
}
|
|
109
77
|
|
|
110
|
-
async
|
|
78
|
+
async getMarketStocks(
|
|
111
79
|
region: Region,
|
|
80
|
+
sortBy: BrokerSort,
|
|
81
|
+
sortDirection: SortDirection,
|
|
112
82
|
fromDate: string,
|
|
113
83
|
toDate: string,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
): Promise<
|
|
117
|
-
return this.sendRequest<
|
|
84
|
+
page: number,
|
|
85
|
+
size: number
|
|
86
|
+
): Promise<BrokerList> {
|
|
87
|
+
return this.sendRequest<BrokerList>({
|
|
118
88
|
method: "GET",
|
|
119
|
-
url:
|
|
89
|
+
url: "/api/v1/brokers/market/stock",
|
|
120
90
|
params: {
|
|
121
91
|
region,
|
|
92
|
+
sortBy,
|
|
93
|
+
sortDirection,
|
|
122
94
|
fromDate,
|
|
123
95
|
toDate,
|
|
124
|
-
|
|
125
|
-
|
|
96
|
+
page,
|
|
97
|
+
size,
|
|
126
98
|
},
|
|
127
99
|
});
|
|
128
100
|
}
|
|
129
101
|
|
|
130
|
-
async
|
|
102
|
+
async getMarketBrokers(
|
|
131
103
|
region: Region,
|
|
104
|
+
sortBy: BrokerSort,
|
|
105
|
+
sortDirection: SortDirection,
|
|
132
106
|
fromDate: string,
|
|
133
107
|
toDate: string,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
): Promise<StockBrokersResponse> {
|
|
139
|
-
return this.sendRequest<StockBrokersResponse>({
|
|
108
|
+
page: number,
|
|
109
|
+
size: number
|
|
110
|
+
): Promise<BrokerList> {
|
|
111
|
+
return this.sendRequest<BrokerList>({
|
|
140
112
|
method: "GET",
|
|
141
|
-
url:
|
|
113
|
+
url: "/api/v1/brokers/market",
|
|
142
114
|
params: {
|
|
143
115
|
region,
|
|
116
|
+
sortBy,
|
|
117
|
+
sortDirection,
|
|
144
118
|
fromDate,
|
|
145
119
|
toDate,
|
|
146
|
-
sortBy,
|
|
147
120
|
page,
|
|
148
121
|
size,
|
|
149
|
-
symbol,
|
|
150
122
|
},
|
|
151
123
|
});
|
|
152
124
|
}
|
|
153
125
|
|
|
154
|
-
async
|
|
126
|
+
async getBrokersByStock(
|
|
127
|
+
symbol: string,
|
|
155
128
|
region: Region,
|
|
129
|
+
sortBy: BrokerSort,
|
|
130
|
+
sortDirection: SortDirection,
|
|
156
131
|
fromDate: string,
|
|
157
132
|
toDate: string,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return this.sendRequest<TopStockBrokersResponse>({
|
|
133
|
+
page: number,
|
|
134
|
+
size: number
|
|
135
|
+
): Promise<BrokerList> {
|
|
136
|
+
return this.sendRequest<BrokerList>({
|
|
163
137
|
method: "GET",
|
|
164
|
-
url:
|
|
138
|
+
url: `/api/v1/brokers/${symbol}`,
|
|
165
139
|
params: {
|
|
140
|
+
symbol,
|
|
166
141
|
region,
|
|
142
|
+
sortBy,
|
|
143
|
+
sortDirection,
|
|
167
144
|
fromDate,
|
|
168
145
|
toDate,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
symbol,
|
|
146
|
+
page,
|
|
147
|
+
size,
|
|
172
148
|
},
|
|
173
149
|
});
|
|
174
150
|
}
|
|
175
151
|
|
|
176
|
-
async
|
|
152
|
+
async getStocksByBroker(
|
|
153
|
+
symbol: string,
|
|
177
154
|
region: Region,
|
|
155
|
+
sortBy: BrokerSort,
|
|
156
|
+
sortDirection: SortDirection,
|
|
178
157
|
fromDate: string,
|
|
179
158
|
toDate: string,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return this.sendRequest<TopStocksForBrokerResponse>({
|
|
159
|
+
page: number,
|
|
160
|
+
size: number
|
|
161
|
+
): Promise<BrokerList> {
|
|
162
|
+
return this.sendRequest<BrokerList>({
|
|
185
163
|
method: "GET",
|
|
186
|
-
url:
|
|
164
|
+
url: `/api/v1/brokers/stock/${symbol}`,
|
|
187
165
|
params: {
|
|
166
|
+
symbol,
|
|
188
167
|
region,
|
|
168
|
+
sortBy,
|
|
169
|
+
sortDirection,
|
|
189
170
|
fromDate,
|
|
190
171
|
toDate,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
brokerSymbol,
|
|
172
|
+
page,
|
|
173
|
+
size,
|
|
194
174
|
},
|
|
195
175
|
});
|
|
196
176
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { Client } from
|
|
2
|
-
import { Region
|
|
3
|
-
|
|
4
|
-
// type PaginatedResponse[T any] struct {
|
|
5
|
-
// RecordCount int `json:"recordCount"`
|
|
6
|
-
// Items []T `json:"items"`
|
|
7
|
-
// }
|
|
1
|
+
import { Client } from "./client";
|
|
2
|
+
import { Region } from "./collections";
|
|
8
3
|
|
|
9
4
|
export interface PaginatedResponse<T> {
|
|
10
5
|
recordCount: number;
|
|
@@ -18,23 +13,23 @@ export interface CapitalIncrease {
|
|
|
18
13
|
currentCapital: string;
|
|
19
14
|
targetCapital: string;
|
|
20
15
|
types: string[];
|
|
21
|
-
spkApplicationResult: string;
|
|
22
|
-
spkApplicationDate: string;
|
|
23
|
-
spkApprovalDate: string;
|
|
24
|
-
paymentDate: string;
|
|
25
|
-
registrationDate: string;
|
|
16
|
+
spkApplicationResult: string | null;
|
|
17
|
+
spkApplicationDate: string | null;
|
|
18
|
+
spkApprovalDate: string | null;
|
|
19
|
+
paymentDate: string | null;
|
|
20
|
+
registrationDate: string | null;
|
|
26
21
|
specifiedCurrency: string;
|
|
27
22
|
symbol: string;
|
|
28
|
-
|
|
23
|
+
relatedDisclosureIds: number[];
|
|
29
24
|
rightsRate: string;
|
|
30
25
|
rightsPrice: string;
|
|
31
26
|
rightsTotalAmount: string;
|
|
32
|
-
rightsStartDate: string;
|
|
33
|
-
rightsEndDate: string;
|
|
34
|
-
rightsLastSellDate: string;
|
|
27
|
+
rightsStartDate: string | null;
|
|
28
|
+
rightsEndDate: string | null;
|
|
29
|
+
rightsLastSellDate: string | null;
|
|
35
30
|
bonusRate: string;
|
|
36
31
|
bonusTotalAmount: string;
|
|
37
|
-
bonusStartDate: string;
|
|
32
|
+
bonusStartDate: string | null;
|
|
38
33
|
bonusDividendRate: string;
|
|
39
34
|
bonusDividendTotalAmount: string;
|
|
40
35
|
externalCapitalIncreaseAmount: string;
|
|
@@ -48,8 +43,8 @@ export class CapitalIncreaseClient extends Client {
|
|
|
48
43
|
region: Region
|
|
49
44
|
): Promise<PaginatedResponse<CapitalIncrease>> {
|
|
50
45
|
return this.sendRequest<PaginatedResponse<CapitalIncrease>>({
|
|
51
|
-
method:
|
|
52
|
-
url:
|
|
46
|
+
method: "GET",
|
|
47
|
+
url: "/api/v1/capital-increase/all",
|
|
53
48
|
params: { region, page, size },
|
|
54
49
|
});
|
|
55
50
|
}
|
|
@@ -58,11 +53,11 @@ export class CapitalIncreaseClient extends Client {
|
|
|
58
53
|
symbol: string,
|
|
59
54
|
page: number,
|
|
60
55
|
size: number,
|
|
61
|
-
region: Region
|
|
56
|
+
region: Region
|
|
62
57
|
): Promise<PaginatedResponse<CapitalIncrease>> {
|
|
63
58
|
return this.sendRequest<PaginatedResponse<CapitalIncrease>>({
|
|
64
59
|
method: 'GET',
|
|
65
|
-
url:
|
|
60
|
+
url: `/api/v1/capital-increase/${symbol}`,
|
|
66
61
|
params: { region, page, size },
|
|
67
62
|
});
|
|
68
63
|
}
|
|
@@ -74,7 +69,7 @@ export class CapitalIncreaseClient extends Client {
|
|
|
74
69
|
): Promise<CapitalIncrease[]> {
|
|
75
70
|
return this.sendRequest<CapitalIncrease[]>({
|
|
76
71
|
method: 'GET',
|
|
77
|
-
url:
|
|
72
|
+
url: `/api/v1/rights/active/${symbol}`,
|
|
78
73
|
params: { date, region },
|
|
79
74
|
});
|
|
80
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from './client';
|
|
2
|
-
import { Stock } from './stocks';
|
|
2
|
+
import { HistoricalPricePeriod, PriceDataPoint, Stock } from './stocks';
|
|
3
3
|
|
|
4
4
|
export enum CollectionType {
|
|
5
5
|
Sector = 'sector',
|
|
@@ -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
|
}
|
|
@@ -42,60 +42,81 @@ export interface CollectionDetail extends Collection {
|
|
|
42
42
|
stocks: Stock[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export interface CollectionPriceGraph {
|
|
46
|
+
previous_close: number;
|
|
47
|
+
graph: PriceDataPoint[];
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
export class CollectionClient extends Client {
|
|
46
|
-
|
|
51
|
+
async getAllSectors(region: Region, locale: Locale): Promise<Collection[]> {
|
|
47
52
|
return this.sendRequest<Collection[]>({
|
|
48
53
|
method: 'GET',
|
|
49
|
-
url: `/api/v1
|
|
54
|
+
url: `/api/v1/sector`,
|
|
50
55
|
params: { region, locale },
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return this.sendRequest<
|
|
58
|
+
|
|
59
|
+
async getAllIndustries(region: Region, locale: Locale): Promise<Collection[]> {
|
|
60
|
+
return this.sendRequest<Collection[]>({
|
|
56
61
|
method: 'GET',
|
|
57
|
-
url: `/api/v1
|
|
62
|
+
url: `/api/v1/industry`,
|
|
58
63
|
params: { region, locale },
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
async getAllSectors(region: Region, locale: Locale): Promise<Collection[]> {
|
|
63
|
-
return this.getAllCollectionsPrivate(CollectionType.Sector, region, locale);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async getAllIndustries(region: Region, locale: Locale): Promise<Collection[]> {
|
|
67
|
-
return this.getAllCollectionsPrivate(CollectionType.Industry, region, locale);
|
|
68
|
-
}
|
|
69
|
-
|
|
66
|
+
|
|
70
67
|
async getAllThemes(region: Region, locale: Locale): Promise<Collection[]> {
|
|
71
|
-
return this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
return this.sendRequest<Collection[]>({
|
|
69
|
+
method: 'GET',
|
|
70
|
+
url: `/api/v1/theme`,
|
|
71
|
+
params: { region, locale },
|
|
72
|
+
});
|
|
76
73
|
}
|
|
77
|
-
|
|
74
|
+
|
|
78
75
|
async getAllCollections(region: Region, locale: Locale): Promise<Collection[]> {
|
|
79
|
-
return this.
|
|
76
|
+
return this.sendRequest<Collection[]>({
|
|
77
|
+
method: 'GET',
|
|
78
|
+
url: `/api/v1/collection`,
|
|
79
|
+
params: { region, locale },
|
|
80
|
+
});
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
async getSectorDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
83
|
-
return this.
|
|
84
|
+
return this.sendRequest<CollectionDetail>({
|
|
85
|
+
method: 'GET',
|
|
86
|
+
url: `/api/v1/sector/${id}`,
|
|
87
|
+
params: { region, locale },
|
|
88
|
+
});
|
|
84
89
|
}
|
|
85
|
-
|
|
90
|
+
|
|
86
91
|
async getIndustryDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
87
|
-
return this.
|
|
92
|
+
return this.sendRequest<CollectionDetail>({
|
|
93
|
+
method: 'GET',
|
|
94
|
+
url: `/api/v1/industry/${id}`,
|
|
95
|
+
params: { region, locale },
|
|
96
|
+
});
|
|
88
97
|
}
|
|
89
|
-
|
|
98
|
+
|
|
90
99
|
async getThemeDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
91
|
-
return this.
|
|
100
|
+
return this.sendRequest<CollectionDetail>({
|
|
101
|
+
method: 'GET',
|
|
102
|
+
url: `/api/v1/theme/${id}`,
|
|
103
|
+
params: { region, locale },
|
|
104
|
+
});
|
|
92
105
|
}
|
|
93
|
-
|
|
94
|
-
async
|
|
95
|
-
return this.
|
|
106
|
+
|
|
107
|
+
async getCollectionDetail(id: string, region: Region, locale: Locale): Promise<CollectionDetail> {
|
|
108
|
+
return this.sendRequest<CollectionDetail>({
|
|
109
|
+
method: 'GET',
|
|
110
|
+
url: `/api/v1/collection/${id}`,
|
|
111
|
+
params: { region, locale },
|
|
112
|
+
});
|
|
96
113
|
}
|
|
97
114
|
|
|
98
|
-
async
|
|
99
|
-
return this.
|
|
115
|
+
async getAggregateGraph(period: HistoricalPricePeriod, sectorId: string, industryId: string, collectionId: string, region: Region): Promise<CollectionPriceGraph> {
|
|
116
|
+
return this.sendRequest<CollectionPriceGraph>({
|
|
117
|
+
method: 'GET',
|
|
118
|
+
url: `/api/v1/aggregate/graph`,
|
|
119
|
+
params: { period, sectorId, industryId, collectionId, region },
|
|
120
|
+
});
|
|
100
121
|
}
|
|
101
|
-
}
|
|
122
|
+
}
|
|
@@ -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,14 +71,14 @@ export enum TopMoverDirection {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export class FinancialFundamentalsClient extends Client {
|
|
72
|
-
async getStockDividends(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
async getStockDividends(
|
|
75
|
+
symbol: string,
|
|
76
|
+
region: Region
|
|
77
|
+
): Promise<StockDividend[]> {
|
|
77
78
|
return this.sendRequest<StockDividend[]>({
|
|
78
79
|
method: 'GET',
|
|
79
|
-
url:
|
|
80
|
+
url: "/api/v2/stock/dividends",
|
|
81
|
+
params: { symbol, region }
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -91,13 +93,16 @@ export class FinancialFundamentalsClient extends Client {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection, assetType?: AssetType
|
|
96
|
+
async getTopMovers(region: Region, page: number, pageSize: number, direction: TopMoverDirection, assetType?: AssetType,
|
|
97
|
+
assetClass?: AssetClass
|
|
98
|
+
): Promise<TopMover[]> {
|
|
95
99
|
const url = new URL(`${this['baseUrl']}/api/v2/stock/top-movers`);
|
|
96
100
|
url.searchParams.append('region', region);
|
|
97
101
|
url.searchParams.append('page', page.toString());
|
|
98
102
|
url.searchParams.append('pageSize', pageSize.toString());
|
|
99
103
|
url.searchParams.append('direction', direction);
|
|
100
104
|
if (assetType) url.searchParams.append('assetType', assetType);
|
|
105
|
+
if (assetClass) url.searchParams.append("assetClass", assetClass);
|
|
101
106
|
|
|
102
107
|
return this.sendRequest<TopMover[]>({
|
|
103
108
|
method: 'GET',
|