@kkkermit/trading212.js 0.1.2 → 0.1.3
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/CHANGELOG.md +6 -0
- package/dist/{chunk-K766TWIM.cjs → chunk-5FW6NZDM.cjs} +1 -1
- package/dist/{chunk-AVOYEH6N.js → chunk-OATOHP5N.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{client-BSQXqdxj.d.cts → client-D4eKsdG_.d.cts} +1 -1
- package/dist/{client-BSQXqdxj.d.ts → client-D4eKsdG_.d.ts} +1 -1
- package/dist/index.cjs +38 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.cjs +6 -6
- package/dist/testing.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -915,7 +915,7 @@ interface Instrument$1 {
|
|
|
915
915
|
ticker?: string | null;
|
|
916
916
|
}
|
|
917
917
|
interface InstrumentIssue {
|
|
918
|
-
name?: "DELISTED" | "SUSPENDED" | "NO_LONGER_TRADABLE" | "MAX_POSITION_SIZE_REACHED" | "APPROACHING_MAX_POSITION_SIZE" | "COMPLEX_INSTRUMENT_APP_TEST_REQUIRED" | "PRICE_TOO_LOW" | (string & {}) | null;
|
|
918
|
+
name?: "DELISTED" | "SUSPENDED" | "NO_LONGER_TRADABLE" | "MAX_POSITION_SIZE_REACHED" | "APPROACHING_MAX_POSITION_SIZE" | "COMPLEX_INSTRUMENT_APP_TEST_REQUIRED" | "PRICE_TOO_LOW" | "IPO_INSTRUMENT_NOT_AVAILABLE" | "ETN_RECONFIRMATION_REQUIRED" | "ETN_FINAL_RISK_CONFIRMATION_REQUIRED" | (string & {}) | null;
|
|
919
919
|
severity?: "IRREVERSIBLE" | "REVERSIBLE" | "INFORMATIVE" | (string & {}) | null;
|
|
920
920
|
}
|
|
921
921
|
interface InvestmentResult {
|
|
@@ -915,7 +915,7 @@ interface Instrument$1 {
|
|
|
915
915
|
ticker?: string | null;
|
|
916
916
|
}
|
|
917
917
|
interface InstrumentIssue {
|
|
918
|
-
name?: "DELISTED" | "SUSPENDED" | "NO_LONGER_TRADABLE" | "MAX_POSITION_SIZE_REACHED" | "APPROACHING_MAX_POSITION_SIZE" | "COMPLEX_INSTRUMENT_APP_TEST_REQUIRED" | "PRICE_TOO_LOW" | (string & {}) | null;
|
|
918
|
+
name?: "DELISTED" | "SUSPENDED" | "NO_LONGER_TRADABLE" | "MAX_POSITION_SIZE_REACHED" | "APPROACHING_MAX_POSITION_SIZE" | "COMPLEX_INSTRUMENT_APP_TEST_REQUIRED" | "PRICE_TOO_LOW" | "IPO_INSTRUMENT_NOT_AVAILABLE" | "ETN_RECONFIRMATION_REQUIRED" | "ETN_FINAL_RISK_CONFIRMATION_REQUIRED" | (string & {}) | null;
|
|
919
919
|
severity?: "IRREVERSIBLE" | "REVERSIBLE" | "INFORMATIVE" | (string & {}) | null;
|
|
920
920
|
}
|
|
921
921
|
interface InvestmentResult {
|
package/dist/index.cjs
CHANGED
|
@@ -1,154 +1,154 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5FW6NZDM_cjs = require('./chunk-5FW6NZDM.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "AuthenticationError", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk5FW6NZDM_cjs.AuthenticationError; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "BASE_URLS", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk5FW6NZDM_cjs.BASE_URLS; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "ConfigurationError", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk5FW6NZDM_cjs.ConfigurationError; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "ENDPOINTS", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk5FW6NZDM_cjs.ENDPOINTS; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FINAL_ORDER_STATUSES", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk5FW6NZDM_cjs.FINAL_ORDER_STATUSES; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "HttpError", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk5FW6NZDM_cjs.HttpError; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "InstrumentNotFoundError", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk5FW6NZDM_cjs.InstrumentNotFoundError; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "MemoryCache", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk5FW6NZDM_cjs.MemoryCache; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "MissingScopeError", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk5FW6NZDM_cjs.MissingScopeError; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "NetworkError", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk5FW6NZDM_cjs.NetworkError; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "NotAvailableInDemoError", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunk5FW6NZDM_cjs.NotAvailableInDemoError; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "NotFoundError", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunk5FW6NZDM_cjs.NotFoundError; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "OrderOutcomeUnknownError", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunk5FW6NZDM_cjs.OrderOutcomeUnknownError; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "OrderRejectedError", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunk5FW6NZDM_cjs.OrderRejectedError; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "PermissionError", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunk5FW6NZDM_cjs.PermissionError; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "QUANTITY_DECIMALS", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunk5FW6NZDM_cjs.QUANTITY_DECIMALS; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "RateLimitError", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunk5FW6NZDM_cjs.RateLimitError; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "SPEC_VERSION", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk5FW6NZDM_cjs.SPEC_VERSION; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "ServerError", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk5FW6NZDM_cjs.ServerError; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "TIME_VALIDITIES", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk5FW6NZDM_cjs.TIME_VALIDITIES; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "TimeoutError", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk5FW6NZDM_cjs.TimeoutError; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "Trading212", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk5FW6NZDM_cjs.Trading212; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "Trading212Error", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk5FW6NZDM_cjs.Trading212Error; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "TradingDisabledError", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk5FW6NZDM_cjs.TradingDisabledError; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "UnexpectedResponseError", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunk5FW6NZDM_cjs.UnexpectedResponseError; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "VERSION", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk5FW6NZDM_cjs.VERSION; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "ValidationError", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk5FW6NZDM_cjs.ValidationError; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "buildPortfolioSnapshot", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk5FW6NZDM_cjs.buildPortfolioSnapshot; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "consoleLogger", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunk5FW6NZDM_cjs.consoleLogger; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "decimalPlaces", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk5FW6NZDM_cjs.decimalPlaces; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "fieldsFirst", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk5FW6NZDM_cjs.fieldsFirst; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "isTrading212Error", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk5FW6NZDM_cjs.isTrading212Error; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "isValidQuantity", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunk5FW6NZDM_cjs.isValidQuantity; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "parseErrorBody", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk5FW6NZDM_cjs.parseErrorBody; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "sessionAt", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk5FW6NZDM_cjs.sessionAt; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "silentLogger", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunk5FW6NZDM_cjs.silentLogger; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "truncateQuantity", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunk5FW6NZDM_cjs.truncateQuantity; }
|
|
154
154
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AccountBucketDetailedResponse, a as AccountBucketInstrumentResult, b as AccountBucketInstrumentsDetailedResponse, c as AccountBucketResultResponse, d as AccountResource, e as AccountSummary, f as AuthenticationError, B as BASE_URLS, C as CacheStore, g as CallOptions, h as Cash, i as ConfigurationError, j as ConsoleLike, D as Dividend, k as DividendDetails, l as DryRunResult, m as DuplicateBucketRequest, E as ENDPOINTS, n as EndpointBudget, o as EndpointDefinition, p as EndpointId, q as EndpointKind, r as EndpointRateLimit, s as EnqueuedReportResponse, t as EnvSource, u as Environment, v as ErrorCode, w as ErrorDetails, x as Exchange, y as ExchangesResource, z as ExportResult, F as FINAL_ORDER_STATUSES, G as FetchLike, H as FieldsFirstMethod, I as Fill, J as FillWalletImpact, K as HistoricalOrder, L as HistoryDividendItem, M as HistoryResource, N as HistoryTransactionItem, O as HoldingSnapshot, P as Hooks, Q as HttpError, R as HttpMethod, S as Instrument, T as InstrumentIssue, U as InstrumentNotFoundError, V as InstrumentSuggestion, W as InstrumentsResource, X as InvestmentResult, Y as Investments, Z as IterateOptions, _ as LimitOrderRequest, $ as LimitRequest, a0 as ListOptions, a1 as LogFields, a2 as LogLevel, a3 as Logger, a4 as MarketOrderRequest, a5 as MarketRequest, a6 as MarketSession, a7 as MarketStatus, a8 as MemoryCache, a9 as MissingScopeError, aa as NetworkError, ab as NotAvailableInDemoError, ac as NotFoundError, ad as Order, ae as OrderInput, af as OrderOutcomeUnknownError, ag as OrderRejectedError, ah as OrderRejectionReason, ai as OrderTimeValidity, aj as OrderType, ak as OrdersResource, al as Page, am as PageOptions, an as PagedList, ao as PaginatedResponseHistoricalOrder, ap as PaginatedResponseHistoryDividendItem, aq as PaginatedResponseHistoryTransactionItem, ar as PermissionError, as as Pie, at as PieDetails, au as PieInput, av as PieRequest, aw as PiesResource, ax as PlaceOptions, ay as Placed, az as PortfolioResource, aA as PortfolioSnapshot, aB as Position, aC as PositionWalletImpact, aD as PositionsResource, aE as PublicReportRequest, aF as RateLimitError, aG as RateLimitInfo, aH as RateLimitMode, aI as RateLimitWaitEvent, aJ as Report, aK as ReportDataIncluded, aL as ReportRequest, aM as ReportResponse, aN as ReportWaitOptions, aO as ReportsResource, aP as RequestDescription, aQ as RequestEvent, aR as ResolveOptions, aS as ResponseEvent, aT as RetryEvent, aU as RetryOptions, aV as SPEC_VERSION, aW as SearchOptions, aX as SellAllOptions, aY as ServerError, aZ as StopLimitOrderRequest, a_ as StopLimitRequest, a$ as StopOrderRequest, b0 as StopRequest, b1 as TIME_VALIDITIES, b2 as Tax, b3 as TimeEvent, b4 as TimeValidity, b5 as TimeoutError, b6 as TradableInstrument, b7 as Trading212, b8 as Trading212Error, b9 as Trading212Options, ba as TradingDisabledError, bb as Transaction, bc as UnexpectedResponseError, bd as ValidationError, be as ValidationIssue, bf as VerifyResult, bg as WaitOptions, bh as WorkingSchedule, bi as buildPortfolioSnapshot, bj as consoleLogger, bk as fieldsFirst, bl as isTrading212Error, bm as sessionAt, bn as silentLogger } from './client-
|
|
1
|
+
export { A as AccountBucketDetailedResponse, a as AccountBucketInstrumentResult, b as AccountBucketInstrumentsDetailedResponse, c as AccountBucketResultResponse, d as AccountResource, e as AccountSummary, f as AuthenticationError, B as BASE_URLS, C as CacheStore, g as CallOptions, h as Cash, i as ConfigurationError, j as ConsoleLike, D as Dividend, k as DividendDetails, l as DryRunResult, m as DuplicateBucketRequest, E as ENDPOINTS, n as EndpointBudget, o as EndpointDefinition, p as EndpointId, q as EndpointKind, r as EndpointRateLimit, s as EnqueuedReportResponse, t as EnvSource, u as Environment, v as ErrorCode, w as ErrorDetails, x as Exchange, y as ExchangesResource, z as ExportResult, F as FINAL_ORDER_STATUSES, G as FetchLike, H as FieldsFirstMethod, I as Fill, J as FillWalletImpact, K as HistoricalOrder, L as HistoryDividendItem, M as HistoryResource, N as HistoryTransactionItem, O as HoldingSnapshot, P as Hooks, Q as HttpError, R as HttpMethod, S as Instrument, T as InstrumentIssue, U as InstrumentNotFoundError, V as InstrumentSuggestion, W as InstrumentsResource, X as InvestmentResult, Y as Investments, Z as IterateOptions, _ as LimitOrderRequest, $ as LimitRequest, a0 as ListOptions, a1 as LogFields, a2 as LogLevel, a3 as Logger, a4 as MarketOrderRequest, a5 as MarketRequest, a6 as MarketSession, a7 as MarketStatus, a8 as MemoryCache, a9 as MissingScopeError, aa as NetworkError, ab as NotAvailableInDemoError, ac as NotFoundError, ad as Order, ae as OrderInput, af as OrderOutcomeUnknownError, ag as OrderRejectedError, ah as OrderRejectionReason, ai as OrderTimeValidity, aj as OrderType, ak as OrdersResource, al as Page, am as PageOptions, an as PagedList, ao as PaginatedResponseHistoricalOrder, ap as PaginatedResponseHistoryDividendItem, aq as PaginatedResponseHistoryTransactionItem, ar as PermissionError, as as Pie, at as PieDetails, au as PieInput, av as PieRequest, aw as PiesResource, ax as PlaceOptions, ay as Placed, az as PortfolioResource, aA as PortfolioSnapshot, aB as Position, aC as PositionWalletImpact, aD as PositionsResource, aE as PublicReportRequest, aF as RateLimitError, aG as RateLimitInfo, aH as RateLimitMode, aI as RateLimitWaitEvent, aJ as Report, aK as ReportDataIncluded, aL as ReportRequest, aM as ReportResponse, aN as ReportWaitOptions, aO as ReportsResource, aP as RequestDescription, aQ as RequestEvent, aR as ResolveOptions, aS as ResponseEvent, aT as RetryEvent, aU as RetryOptions, aV as SPEC_VERSION, aW as SearchOptions, aX as SellAllOptions, aY as ServerError, aZ as StopLimitOrderRequest, a_ as StopLimitRequest, a$ as StopOrderRequest, b0 as StopRequest, b1 as TIME_VALIDITIES, b2 as Tax, b3 as TimeEvent, b4 as TimeValidity, b5 as TimeoutError, b6 as TradableInstrument, b7 as Trading212, b8 as Trading212Error, b9 as Trading212Options, ba as TradingDisabledError, bb as Transaction, bc as UnexpectedResponseError, bd as ValidationError, be as ValidationIssue, bf as VerifyResult, bg as WaitOptions, bh as WorkingSchedule, bi as buildPortfolioSnapshot, bj as consoleLogger, bk as fieldsFirst, bl as isTrading212Error, bm as sessionAt, bn as silentLogger } from './client-D4eKsdG_.cjs';
|
|
2
2
|
|
|
3
3
|
interface ParsedErrorBody {
|
|
4
4
|
/** Trading 212's own code, from `code`, or the last part of a problem-details `type`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AccountBucketDetailedResponse, a as AccountBucketInstrumentResult, b as AccountBucketInstrumentsDetailedResponse, c as AccountBucketResultResponse, d as AccountResource, e as AccountSummary, f as AuthenticationError, B as BASE_URLS, C as CacheStore, g as CallOptions, h as Cash, i as ConfigurationError, j as ConsoleLike, D as Dividend, k as DividendDetails, l as DryRunResult, m as DuplicateBucketRequest, E as ENDPOINTS, n as EndpointBudget, o as EndpointDefinition, p as EndpointId, q as EndpointKind, r as EndpointRateLimit, s as EnqueuedReportResponse, t as EnvSource, u as Environment, v as ErrorCode, w as ErrorDetails, x as Exchange, y as ExchangesResource, z as ExportResult, F as FINAL_ORDER_STATUSES, G as FetchLike, H as FieldsFirstMethod, I as Fill, J as FillWalletImpact, K as HistoricalOrder, L as HistoryDividendItem, M as HistoryResource, N as HistoryTransactionItem, O as HoldingSnapshot, P as Hooks, Q as HttpError, R as HttpMethod, S as Instrument, T as InstrumentIssue, U as InstrumentNotFoundError, V as InstrumentSuggestion, W as InstrumentsResource, X as InvestmentResult, Y as Investments, Z as IterateOptions, _ as LimitOrderRequest, $ as LimitRequest, a0 as ListOptions, a1 as LogFields, a2 as LogLevel, a3 as Logger, a4 as MarketOrderRequest, a5 as MarketRequest, a6 as MarketSession, a7 as MarketStatus, a8 as MemoryCache, a9 as MissingScopeError, aa as NetworkError, ab as NotAvailableInDemoError, ac as NotFoundError, ad as Order, ae as OrderInput, af as OrderOutcomeUnknownError, ag as OrderRejectedError, ah as OrderRejectionReason, ai as OrderTimeValidity, aj as OrderType, ak as OrdersResource, al as Page, am as PageOptions, an as PagedList, ao as PaginatedResponseHistoricalOrder, ap as PaginatedResponseHistoryDividendItem, aq as PaginatedResponseHistoryTransactionItem, ar as PermissionError, as as Pie, at as PieDetails, au as PieInput, av as PieRequest, aw as PiesResource, ax as PlaceOptions, ay as Placed, az as PortfolioResource, aA as PortfolioSnapshot, aB as Position, aC as PositionWalletImpact, aD as PositionsResource, aE as PublicReportRequest, aF as RateLimitError, aG as RateLimitInfo, aH as RateLimitMode, aI as RateLimitWaitEvent, aJ as Report, aK as ReportDataIncluded, aL as ReportRequest, aM as ReportResponse, aN as ReportWaitOptions, aO as ReportsResource, aP as RequestDescription, aQ as RequestEvent, aR as ResolveOptions, aS as ResponseEvent, aT as RetryEvent, aU as RetryOptions, aV as SPEC_VERSION, aW as SearchOptions, aX as SellAllOptions, aY as ServerError, aZ as StopLimitOrderRequest, a_ as StopLimitRequest, a$ as StopOrderRequest, b0 as StopRequest, b1 as TIME_VALIDITIES, b2 as Tax, b3 as TimeEvent, b4 as TimeValidity, b5 as TimeoutError, b6 as TradableInstrument, b7 as Trading212, b8 as Trading212Error, b9 as Trading212Options, ba as TradingDisabledError, bb as Transaction, bc as UnexpectedResponseError, bd as ValidationError, be as ValidationIssue, bf as VerifyResult, bg as WaitOptions, bh as WorkingSchedule, bi as buildPortfolioSnapshot, bj as consoleLogger, bk as fieldsFirst, bl as isTrading212Error, bm as sessionAt, bn as silentLogger } from './client-
|
|
1
|
+
export { A as AccountBucketDetailedResponse, a as AccountBucketInstrumentResult, b as AccountBucketInstrumentsDetailedResponse, c as AccountBucketResultResponse, d as AccountResource, e as AccountSummary, f as AuthenticationError, B as BASE_URLS, C as CacheStore, g as CallOptions, h as Cash, i as ConfigurationError, j as ConsoleLike, D as Dividend, k as DividendDetails, l as DryRunResult, m as DuplicateBucketRequest, E as ENDPOINTS, n as EndpointBudget, o as EndpointDefinition, p as EndpointId, q as EndpointKind, r as EndpointRateLimit, s as EnqueuedReportResponse, t as EnvSource, u as Environment, v as ErrorCode, w as ErrorDetails, x as Exchange, y as ExchangesResource, z as ExportResult, F as FINAL_ORDER_STATUSES, G as FetchLike, H as FieldsFirstMethod, I as Fill, J as FillWalletImpact, K as HistoricalOrder, L as HistoryDividendItem, M as HistoryResource, N as HistoryTransactionItem, O as HoldingSnapshot, P as Hooks, Q as HttpError, R as HttpMethod, S as Instrument, T as InstrumentIssue, U as InstrumentNotFoundError, V as InstrumentSuggestion, W as InstrumentsResource, X as InvestmentResult, Y as Investments, Z as IterateOptions, _ as LimitOrderRequest, $ as LimitRequest, a0 as ListOptions, a1 as LogFields, a2 as LogLevel, a3 as Logger, a4 as MarketOrderRequest, a5 as MarketRequest, a6 as MarketSession, a7 as MarketStatus, a8 as MemoryCache, a9 as MissingScopeError, aa as NetworkError, ab as NotAvailableInDemoError, ac as NotFoundError, ad as Order, ae as OrderInput, af as OrderOutcomeUnknownError, ag as OrderRejectedError, ah as OrderRejectionReason, ai as OrderTimeValidity, aj as OrderType, ak as OrdersResource, al as Page, am as PageOptions, an as PagedList, ao as PaginatedResponseHistoricalOrder, ap as PaginatedResponseHistoryDividendItem, aq as PaginatedResponseHistoryTransactionItem, ar as PermissionError, as as Pie, at as PieDetails, au as PieInput, av as PieRequest, aw as PiesResource, ax as PlaceOptions, ay as Placed, az as PortfolioResource, aA as PortfolioSnapshot, aB as Position, aC as PositionWalletImpact, aD as PositionsResource, aE as PublicReportRequest, aF as RateLimitError, aG as RateLimitInfo, aH as RateLimitMode, aI as RateLimitWaitEvent, aJ as Report, aK as ReportDataIncluded, aL as ReportRequest, aM as ReportResponse, aN as ReportWaitOptions, aO as ReportsResource, aP as RequestDescription, aQ as RequestEvent, aR as ResolveOptions, aS as ResponseEvent, aT as RetryEvent, aU as RetryOptions, aV as SPEC_VERSION, aW as SearchOptions, aX as SellAllOptions, aY as ServerError, aZ as StopLimitOrderRequest, a_ as StopLimitRequest, a$ as StopOrderRequest, b0 as StopRequest, b1 as TIME_VALIDITIES, b2 as Tax, b3 as TimeEvent, b4 as TimeValidity, b5 as TimeoutError, b6 as TradableInstrument, b7 as Trading212, b8 as Trading212Error, b9 as Trading212Options, ba as TradingDisabledError, bb as Transaction, bc as UnexpectedResponseError, bd as ValidationError, be as ValidationIssue, bf as VerifyResult, bg as WaitOptions, bh as WorkingSchedule, bi as buildPortfolioSnapshot, bj as consoleLogger, bk as fieldsFirst, bl as isTrading212Error, bm as sessionAt, bn as silentLogger } from './client-D4eKsdG_.js';
|
|
2
2
|
|
|
3
3
|
interface ParsedErrorBody {
|
|
4
4
|
/** Trading 212's own code, from `code`, or the last part of a problem-details `type`. */
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AuthenticationError, BASE_URLS, ConfigurationError, ENDPOINTS, FINAL_ORDER_STATUSES, HttpError, InstrumentNotFoundError, MemoryCache, MissingScopeError, NetworkError, NotAvailableInDemoError, NotFoundError, OrderOutcomeUnknownError, OrderRejectedError, PermissionError, QUANTITY_DECIMALS, RateLimitError, SPEC_VERSION, ServerError, TIME_VALIDITIES, TimeoutError, Trading212, Trading212Error, TradingDisabledError, UnexpectedResponseError, VERSION, ValidationError, buildPortfolioSnapshot, consoleLogger, decimalPlaces, fieldsFirst, isTrading212Error, isValidQuantity, parseErrorBody, sessionAt, silentLogger, truncateQuantity } from './chunk-
|
|
1
|
+
export { AuthenticationError, BASE_URLS, ConfigurationError, ENDPOINTS, FINAL_ORDER_STATUSES, HttpError, InstrumentNotFoundError, MemoryCache, MissingScopeError, NetworkError, NotAvailableInDemoError, NotFoundError, OrderOutcomeUnknownError, OrderRejectedError, PermissionError, QUANTITY_DECIMALS, RateLimitError, SPEC_VERSION, ServerError, TIME_VALIDITIES, TimeoutError, Trading212, Trading212Error, TradingDisabledError, UnexpectedResponseError, VERSION, ValidationError, buildPortfolioSnapshot, consoleLogger, decimalPlaces, fieldsFirst, isTrading212Error, isValidQuantity, parseErrorBody, sessionAt, silentLogger, truncateQuantity } from './chunk-OATOHP5N.js';
|
package/dist/testing.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5FW6NZDM_cjs = require('./chunk-5FW6NZDM.cjs');
|
|
4
4
|
|
|
5
5
|
// src/testing/scriptedFetch.ts
|
|
6
6
|
var STATUS_TEXT = {
|
|
@@ -23,7 +23,7 @@ async function recordRequest(input, init) {
|
|
|
23
23
|
new Headers(init.headers).forEach((value, key) => {
|
|
24
24
|
if (key === "authorization") {
|
|
25
25
|
authorized = value.length > 0;
|
|
26
|
-
headers[key] =
|
|
26
|
+
headers[key] = chunk5FW6NZDM_cjs.REDACTED;
|
|
27
27
|
} else headers[key] = value;
|
|
28
28
|
});
|
|
29
29
|
let body = void 0;
|
|
@@ -201,7 +201,7 @@ var FakeTrading212Server = class {
|
|
|
201
201
|
#traces = 0;
|
|
202
202
|
constructor(state = {}, environment = "demo") {
|
|
203
203
|
this.environment = environment;
|
|
204
|
-
this.#origin =
|
|
204
|
+
this.#origin = chunk5FW6NZDM_cjs.BASE_URLS[environment];
|
|
205
205
|
this.cash = state.cash ?? 1e4;
|
|
206
206
|
this.currency = state.currency ?? "GBP";
|
|
207
207
|
this.accountId = state.accountId ?? 12345678;
|
|
@@ -280,7 +280,7 @@ var FakeTrading212Server = class {
|
|
|
280
280
|
return authorization === FAKE_AUTHORIZATION ? void 0 : { status: 401, headers: { "content-type": "text/plain; charset=utf-8" }, body: "\n" };
|
|
281
281
|
}
|
|
282
282
|
#match(method, path) {
|
|
283
|
-
for (const definition of Object.values(
|
|
283
|
+
for (const definition of Object.values(chunk5FW6NZDM_cjs.ENDPOINTS)) {
|
|
284
284
|
if (definition.method !== method) continue;
|
|
285
285
|
const pattern = new RegExp(`^${definition.path.replace("{id}", "(\\d+)")}$`);
|
|
286
286
|
const match = pattern.exec(path);
|
|
@@ -444,7 +444,7 @@ var FakeTrading212Server = class {
|
|
|
444
444
|
if (!this.#instrument(ticker)) return apiError(400, "instrument-not-found", REFUSED, `No instrument ${ticker}`);
|
|
445
445
|
if (!Number.isFinite(quantity) || quantity === 0)
|
|
446
446
|
return apiError(400, "invalid-request", INVALID, "Invalid payload");
|
|
447
|
-
if (
|
|
447
|
+
if (chunk5FW6NZDM_cjs.decimalPlaces(quantity) > 4)
|
|
448
448
|
return apiError(400, "quantity-precision-mismatch", REFUSED, "invalid quantity precision 4");
|
|
449
449
|
if (id !== "placeMarketOrder" && "extendedHours" in body)
|
|
450
450
|
return apiError(400, "invalid-request", INVALID, "Invalid payload");
|
|
@@ -629,7 +629,7 @@ var FakeTrading212Server = class {
|
|
|
629
629
|
function createFakeTrading212(options = {}) {
|
|
630
630
|
const environment = options.environment ?? "demo";
|
|
631
631
|
const server = new FakeTrading212Server(options.state, environment);
|
|
632
|
-
const client = new
|
|
632
|
+
const client = new chunk5FW6NZDM_cjs.Trading212({
|
|
633
633
|
rateLimit: "off",
|
|
634
634
|
trading: "enabled",
|
|
635
635
|
...options.client,
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kkkermit/trading212.js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Unofficial, zero-dependency TypeScript client for the Trading 212 Public API: typed, rate-limit aware, safe around live money, with errors that tell you how to fix them.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"trading212",
|