@mnie/provider-sbi-sec 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/index.d.mts +557 -0
- package/dist/index.mjs +16215 -0
- package/package.json +39 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shotaro Nakamura
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# client-sbi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
SBI provider client for Mnie.
|
|
4
|
+
|
|
5
|
+
The public finance method contract is exported from `@repo/mnie-types`; this package contains SBI-specific login, parsing, and transport code.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
import { CommonMethods, FinancialProvider, InvestmentMethods, MethodDefinition } from "@mnie/types";
|
|
2
|
+
export type * from "@mnie/types";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type WebAuthnAlgorithm = -7 | -257;
|
|
6
|
+
type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged';
|
|
7
|
+
type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb';
|
|
8
|
+
interface WebAuthnJwk {
|
|
9
|
+
kty: string;
|
|
10
|
+
crv?: string;
|
|
11
|
+
x?: string;
|
|
12
|
+
y?: string;
|
|
13
|
+
d?: string;
|
|
14
|
+
n?: string;
|
|
15
|
+
e?: string;
|
|
16
|
+
key_ops?: string[];
|
|
17
|
+
ext?: boolean;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
interface StoredWebAuthnCredentialSecret {
|
|
21
|
+
privateKey: {
|
|
22
|
+
format: 'jwk';
|
|
23
|
+
jwk: WebAuthnJwk;
|
|
24
|
+
};
|
|
25
|
+
cosePrivateKey?: string;
|
|
26
|
+
registration?: {
|
|
27
|
+
attestationObject?: string;
|
|
28
|
+
clientDataJSON?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface StoredWebAuthnCredential {
|
|
32
|
+
version: 1;
|
|
33
|
+
kind: 'webauthn-credential';
|
|
34
|
+
provider: 'sbi-sec';
|
|
35
|
+
rpId: string;
|
|
36
|
+
origin: string;
|
|
37
|
+
credentialId: string;
|
|
38
|
+
userHandle?: string;
|
|
39
|
+
alg: WebAuthnAlgorithm;
|
|
40
|
+
publicKey: {
|
|
41
|
+
format: 'jwk';
|
|
42
|
+
jwk: WebAuthnJwk;
|
|
43
|
+
};
|
|
44
|
+
authenticator: {
|
|
45
|
+
aaguid?: string;
|
|
46
|
+
signCount: number;
|
|
47
|
+
discoverable: boolean;
|
|
48
|
+
userVerification: WebAuthnUserVerification;
|
|
49
|
+
transports?: WebAuthnTransport[];
|
|
50
|
+
backupEligible?: boolean;
|
|
51
|
+
backupState?: boolean;
|
|
52
|
+
};
|
|
53
|
+
secret: {
|
|
54
|
+
encrypted: true;
|
|
55
|
+
format: 'jwe-like-v1';
|
|
56
|
+
kdf: {
|
|
57
|
+
name: 'argon2id' | 'scrypt';
|
|
58
|
+
salt: string;
|
|
59
|
+
params: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
cipher: {
|
|
62
|
+
name: 'AES-256-GCM';
|
|
63
|
+
nonce: string;
|
|
64
|
+
aad: string;
|
|
65
|
+
ciphertext: string;
|
|
66
|
+
tag: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
createdAt: string;
|
|
70
|
+
updatedAt: string;
|
|
71
|
+
}
|
|
72
|
+
type PlaintextStoredWebAuthnCredential = Omit<StoredWebAuthnCredential, 'secret'> & {
|
|
73
|
+
label?: string;
|
|
74
|
+
secretPlaintext: StoredWebAuthnCredentialSecret;
|
|
75
|
+
};
|
|
76
|
+
interface WebAuthnAssertionRequest {
|
|
77
|
+
challenge: string;
|
|
78
|
+
rpId: string;
|
|
79
|
+
}
|
|
80
|
+
interface WebAuthnAssertion {
|
|
81
|
+
id: string;
|
|
82
|
+
rawId: string;
|
|
83
|
+
clientDataJSON: string;
|
|
84
|
+
authenticatorData: string;
|
|
85
|
+
signature: string;
|
|
86
|
+
userHandle: string;
|
|
87
|
+
}
|
|
88
|
+
interface PasskeyAssertionProvider {
|
|
89
|
+
readonly rpId: string;
|
|
90
|
+
readonly origin: string;
|
|
91
|
+
createAssertion(request: WebAuthnAssertionRequest): Promise<WebAuthnAssertion> | WebAuthnAssertion;
|
|
92
|
+
}
|
|
93
|
+
interface PasskeyLoginResponse {
|
|
94
|
+
type: 'passkey-login-response';
|
|
95
|
+
requestUrl: string;
|
|
96
|
+
status: number;
|
|
97
|
+
body: ArrayBuffer;
|
|
98
|
+
text: string;
|
|
99
|
+
accessToken?: string;
|
|
100
|
+
header: {
|
|
101
|
+
sessionId: string;
|
|
102
|
+
trCode: string;
|
|
103
|
+
resultCode: string;
|
|
104
|
+
} | null;
|
|
105
|
+
}
|
|
106
|
+
interface SbiEndpointOptions {
|
|
107
|
+
authBaseUrl?: string;
|
|
108
|
+
mtsBaseUrl?: string;
|
|
109
|
+
izanagiBaseUrl?: string;
|
|
110
|
+
foreignStockBaseUrl?: string;
|
|
111
|
+
usStockBaseUrl?: string;
|
|
112
|
+
foreignStockRestUrl?: string;
|
|
113
|
+
foreignStockGraphqlBffUrl?: string;
|
|
114
|
+
foreignStockGraphqlIntUrl?: string;
|
|
115
|
+
foreignStockUserAgent?: string;
|
|
116
|
+
mainSiteBaseUrl?: string;
|
|
117
|
+
mainSiteEtGatePath?: string;
|
|
118
|
+
mainSiteAssetsValuationsPath?: string;
|
|
119
|
+
mainSiteExchangeOrderInputPath?: string;
|
|
120
|
+
mainSiteExchangeOrderPasswordPath?: string;
|
|
121
|
+
mainSiteExchangeOrderConfirmPath?: string;
|
|
122
|
+
mainSiteExchangeOrderCompletePath?: string;
|
|
123
|
+
}
|
|
124
|
+
type LoginWithPasskeyOptions = SbiEndpointOptions & ({
|
|
125
|
+
passkeyCredential: PlaintextStoredWebAuthnCredential;
|
|
126
|
+
passkeyProvider?: never;
|
|
127
|
+
} | {
|
|
128
|
+
passkeyProvider: PasskeyAssertionProvider;
|
|
129
|
+
passkeyCredential?: never;
|
|
130
|
+
});
|
|
131
|
+
interface SbiClientOptions {
|
|
132
|
+
tradePassword?: string;
|
|
133
|
+
deviceId?: string;
|
|
134
|
+
tradeAuthentication?: SbiTradeAuthenticationOptions;
|
|
135
|
+
}
|
|
136
|
+
interface SbiTradeAuthenticationRequest {
|
|
137
|
+
type: 'phone';
|
|
138
|
+
telNo?: string;
|
|
139
|
+
phoneNo?: string;
|
|
140
|
+
sbiCallNo?: string;
|
|
141
|
+
authLimitTime?: string;
|
|
142
|
+
}
|
|
143
|
+
interface SbiTradeAuthenticationOptions {
|
|
144
|
+
onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise<void>;
|
|
145
|
+
confirmAttempts?: number;
|
|
146
|
+
confirmIntervalMs?: number;
|
|
147
|
+
}
|
|
148
|
+
type IssueCode = string;
|
|
149
|
+
type DomesticMarketCode = 'XTKS' | 'XNGO' | 'XFKA' | 'XSAP';
|
|
150
|
+
type SKabuMarketCode = 'STK';
|
|
151
|
+
type UsStockMarketCode = 'XNAS' | 'XNYS' | 'ARCX';
|
|
152
|
+
type MarketCode = DomesticMarketCode | SKabuMarketCode | UsStockMarketCode;
|
|
153
|
+
interface CurrencyAmount {
|
|
154
|
+
value: number | null;
|
|
155
|
+
text: string;
|
|
156
|
+
currency: 'JPY' | 'USD';
|
|
157
|
+
}
|
|
158
|
+
interface PercentValue {
|
|
159
|
+
value: number | null;
|
|
160
|
+
text: string;
|
|
161
|
+
}
|
|
162
|
+
interface SignedTextValue {
|
|
163
|
+
value: number | null;
|
|
164
|
+
text: string;
|
|
165
|
+
sign?: 'positive' | 'negative' | 'zero';
|
|
166
|
+
}
|
|
167
|
+
interface AccountAssetsValuationSummary {
|
|
168
|
+
assetsErrorType: unknown;
|
|
169
|
+
valuation: number | null;
|
|
170
|
+
netChange: number | null;
|
|
171
|
+
percentChange: number | null;
|
|
172
|
+
monthOnMonth: number | null;
|
|
173
|
+
monthOnMonthRatio: unknown;
|
|
174
|
+
profitLoss: number | null;
|
|
175
|
+
profitLossRate: number | null;
|
|
176
|
+
acquisitionCost: number | null;
|
|
177
|
+
}
|
|
178
|
+
type AccountAssetsValuationDetail = AccountAssetsValuationSummary & {
|
|
179
|
+
category: string;
|
|
180
|
+
compositionRatio: number | null;
|
|
181
|
+
};
|
|
182
|
+
interface AccountAssetsValuations {
|
|
183
|
+
fetchedAt: string;
|
|
184
|
+
summary: AccountAssetsValuationSummary;
|
|
185
|
+
summaryWithoutDeposit: AccountAssetsValuationSummary;
|
|
186
|
+
summaryWithoutIdeco?: AccountAssetsValuationSummary;
|
|
187
|
+
summaryWithoutDepositAndIdeco?: AccountAssetsValuationSummary;
|
|
188
|
+
summaryDetails: AccountAssetsValuationDetail[];
|
|
189
|
+
summaryDetailsWithoutDeposit: AccountAssetsValuationDetail[];
|
|
190
|
+
summaryDetailsWithoutIdeco: AccountAssetsValuationDetail[];
|
|
191
|
+
summaryDetailsWithoutDepositAndIdeco: AccountAssetsValuationDetail[];
|
|
192
|
+
}
|
|
193
|
+
type AccountType = 'general' | 'specific' | 'growthInvestment' | 'nisa' | 'juniorNisa' | 'unknown';
|
|
194
|
+
type TradeSide = 'buy' | 'sell';
|
|
195
|
+
interface IssueRef {
|
|
196
|
+
code: IssueCode;
|
|
197
|
+
market?: MarketCode;
|
|
198
|
+
name?: string;
|
|
199
|
+
}
|
|
200
|
+
type IssueSearchItem = IssueRef & {
|
|
201
|
+
extract?: string;
|
|
202
|
+
extractWord?: string;
|
|
203
|
+
boldFrom?: string;
|
|
204
|
+
boldTo?: string;
|
|
205
|
+
hitString?: string;
|
|
206
|
+
};
|
|
207
|
+
type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown';
|
|
208
|
+
interface IssueSearchResult {
|
|
209
|
+
status?: string;
|
|
210
|
+
statusText: IssueSearchStatus;
|
|
211
|
+
issues: IssueSearchItem[];
|
|
212
|
+
}
|
|
213
|
+
type ChartPeriod = 'minute' | 'day' | 'week' | 'month';
|
|
214
|
+
interface ChartPrice {
|
|
215
|
+
dateTime: string;
|
|
216
|
+
open: CurrencyAmount;
|
|
217
|
+
high: CurrencyAmount;
|
|
218
|
+
low: CurrencyAmount;
|
|
219
|
+
close: CurrencyAmount;
|
|
220
|
+
volume?: number | null;
|
|
221
|
+
}
|
|
222
|
+
interface IssueChart {
|
|
223
|
+
issue: IssueRef;
|
|
224
|
+
period: ChartPeriod;
|
|
225
|
+
unit: number;
|
|
226
|
+
prices: ChartPrice[];
|
|
227
|
+
previousClose?: CurrencyAmount;
|
|
228
|
+
currentPrice?: CurrencyAmount;
|
|
229
|
+
highPrice?: CurrencyAmount;
|
|
230
|
+
lowPrice?: CurrencyAmount;
|
|
231
|
+
latestDateTime?: string;
|
|
232
|
+
error?: SbiMethodError;
|
|
233
|
+
}
|
|
234
|
+
interface Quote {
|
|
235
|
+
issue: IssueRef;
|
|
236
|
+
price?: CurrencyAmount;
|
|
237
|
+
change?: SignedTextValue;
|
|
238
|
+
changeRate?: PercentValue;
|
|
239
|
+
changeFlag?: string;
|
|
240
|
+
open?: CurrencyAmount;
|
|
241
|
+
high?: CurrencyAmount;
|
|
242
|
+
low?: CurrencyAmount;
|
|
243
|
+
previousClose?: CurrencyAmount;
|
|
244
|
+
volume?: number | null;
|
|
245
|
+
timestamp?: string;
|
|
246
|
+
nominalPrices?: CurrencyAmount[];
|
|
247
|
+
error?: SbiMethodError;
|
|
248
|
+
}
|
|
249
|
+
interface BoardPriceLevel {
|
|
250
|
+
price: CurrencyAmount;
|
|
251
|
+
quantity?: number | null;
|
|
252
|
+
}
|
|
253
|
+
interface Board {
|
|
254
|
+
issue: IssueRef;
|
|
255
|
+
bids: BoardPriceLevel[];
|
|
256
|
+
asks: BoardPriceLevel[];
|
|
257
|
+
quote?: Quote;
|
|
258
|
+
error?: SbiMethodError;
|
|
259
|
+
}
|
|
260
|
+
interface MarketIndex {
|
|
261
|
+
code?: string;
|
|
262
|
+
categoryCode?: string;
|
|
263
|
+
name: string;
|
|
264
|
+
value?: number | null;
|
|
265
|
+
valueText?: string;
|
|
266
|
+
change?: SignedTextValue;
|
|
267
|
+
changeRate?: PercentValue;
|
|
268
|
+
colorFlag?: string;
|
|
269
|
+
timestamp?: string;
|
|
270
|
+
open?: CurrencyAmount;
|
|
271
|
+
high?: CurrencyAmount;
|
|
272
|
+
low?: CurrencyAmount;
|
|
273
|
+
previousClose?: CurrencyAmount;
|
|
274
|
+
}
|
|
275
|
+
interface TradeRecord {
|
|
276
|
+
id: string;
|
|
277
|
+
issue: IssueRef;
|
|
278
|
+
tradeRecordTypeCode?: string;
|
|
279
|
+
tradeCurrencyCode?: string;
|
|
280
|
+
listedSecuritiesStatus?: string;
|
|
281
|
+
orderPriceKindCode?: string;
|
|
282
|
+
accountType?: AccountType;
|
|
283
|
+
settlementCurrencyCode?: string;
|
|
284
|
+
amount?: CurrencyAmount;
|
|
285
|
+
quantity?: number | null;
|
|
286
|
+
price?: CurrencyAmount;
|
|
287
|
+
tradeDate?: string;
|
|
288
|
+
valueDate?: string;
|
|
289
|
+
marginCloseLimitType?: string;
|
|
290
|
+
}
|
|
291
|
+
interface TradeRecordList {
|
|
292
|
+
records: TradeRecord[];
|
|
293
|
+
hasMore?: boolean;
|
|
294
|
+
error?: SbiMethodError;
|
|
295
|
+
}
|
|
296
|
+
interface OrderCorrectionPreOrderDetail {
|
|
297
|
+
exchangeName?: string;
|
|
298
|
+
marketLoanKbn?: string;
|
|
299
|
+
marketIppanLoanKbn?: string;
|
|
300
|
+
currentPrice?: CurrencyAmount;
|
|
301
|
+
tradeColorFlag?: string;
|
|
302
|
+
priceTick?: string;
|
|
303
|
+
priceTickText?: string;
|
|
304
|
+
tradeTime?: string;
|
|
305
|
+
changeText?: string;
|
|
306
|
+
volumeText?: string;
|
|
307
|
+
}
|
|
308
|
+
interface OrderCorrectionPreOrder {
|
|
309
|
+
issue: IssueRef;
|
|
310
|
+
tradeTitle?: string;
|
|
311
|
+
buyingPowerTotal?: CurrencyAmount;
|
|
312
|
+
controlledStockCode?: string;
|
|
313
|
+
hasTradeWarning?: boolean;
|
|
314
|
+
deficitMessageFlag?: string;
|
|
315
|
+
deficitMessage?: string;
|
|
316
|
+
details: OrderCorrectionPreOrderDetail[];
|
|
317
|
+
orderNumber?: string;
|
|
318
|
+
orderId?: string;
|
|
319
|
+
primaryOrderMethod?: string;
|
|
320
|
+
primaryTriggerZone?: string;
|
|
321
|
+
primaryTriggerPrice?: number | null;
|
|
322
|
+
status?: string;
|
|
323
|
+
statusText?: string;
|
|
324
|
+
tradeId?: string;
|
|
325
|
+
tradeName?: string;
|
|
326
|
+
quantity?: number | null;
|
|
327
|
+
quantityText?: string;
|
|
328
|
+
orderLimit?: string;
|
|
329
|
+
orderLimitText?: string;
|
|
330
|
+
priceSteps: StockOrderPreOrderPriceStep[];
|
|
331
|
+
sessionRange?: string;
|
|
332
|
+
inputDateText?: string;
|
|
333
|
+
primaryOrderTerm?: string;
|
|
334
|
+
nonSpecificTradeText?: string;
|
|
335
|
+
marketName?: string;
|
|
336
|
+
rbeOrderStatus?: string;
|
|
337
|
+
priceCondition?: string;
|
|
338
|
+
price?: number | null;
|
|
339
|
+
priceAmount?: CurrencyAmount;
|
|
340
|
+
exchangeName?: string;
|
|
341
|
+
transId?: string;
|
|
342
|
+
ptsDayNightFlag?: string;
|
|
343
|
+
smallTickFlag?: string;
|
|
344
|
+
juniorBuyingPowerTotal?: CurrencyAmount;
|
|
345
|
+
secondaryPriceCondition?: string;
|
|
346
|
+
secondaryPrice?: number | null;
|
|
347
|
+
secondaryPriceAmount?: CurrencyAmount;
|
|
348
|
+
autoOrderKind?: string;
|
|
349
|
+
autoOrderNumber?: string;
|
|
350
|
+
autoOrderInputDate?: string;
|
|
351
|
+
secondaryOrderMethod?: string;
|
|
352
|
+
secondaryTriggerZone?: string;
|
|
353
|
+
secondaryTriggerPrice?: number | null;
|
|
354
|
+
secondaryOrderCondition?: string;
|
|
355
|
+
secondaryLimitPrice?: number | null;
|
|
356
|
+
secondaryLimitPriceAmount?: CurrencyAmount;
|
|
357
|
+
secondaryOrderTerm?: string;
|
|
358
|
+
secondaryOcoPriceCondition?: string;
|
|
359
|
+
secondaryOcoPrice?: number | null;
|
|
360
|
+
secondaryOcoPriceAmount?: CurrencyAmount;
|
|
361
|
+
exchangeList?: string;
|
|
362
|
+
}
|
|
363
|
+
interface OrderPreview {
|
|
364
|
+
issue: IssueRef;
|
|
365
|
+
side: TradeSide;
|
|
366
|
+
quantity?: number;
|
|
367
|
+
price?: CurrencyAmount;
|
|
368
|
+
estimatedAmount?: CurrencyAmount;
|
|
369
|
+
commission?: CurrencyAmount;
|
|
370
|
+
tax?: CurrencyAmount;
|
|
371
|
+
warnings: string[];
|
|
372
|
+
confirmationId?: string;
|
|
373
|
+
message?: string;
|
|
374
|
+
correction?: OrderCorrectionPreOrder;
|
|
375
|
+
error?: SbiMethodError;
|
|
376
|
+
}
|
|
377
|
+
interface StockOrderPreOrderPriceStep {
|
|
378
|
+
from?: CurrencyAmount;
|
|
379
|
+
to?: CurrencyAmount;
|
|
380
|
+
}
|
|
381
|
+
interface StockOrderPreOrderPaymentLimit {
|
|
382
|
+
text?: string;
|
|
383
|
+
code?: string;
|
|
384
|
+
}
|
|
385
|
+
type StockOrderPreOrderMarginTradeType = 'standard' | 'generalBuy' | 'generalSellShort' | 'generalSellInventoryLimited' | 'generalSellInventoryUnlimited' | 'day' | 'hyper';
|
|
386
|
+
interface StockOrderPreOrder {
|
|
387
|
+
issue: IssueRef;
|
|
388
|
+
tradeTitle?: string;
|
|
389
|
+
buyingPowerTotal?: CurrencyAmount;
|
|
390
|
+
controlledStockCode?: string;
|
|
391
|
+
hasTradeWarning?: boolean;
|
|
392
|
+
market?: MarketCode;
|
|
393
|
+
exchangeList?: string;
|
|
394
|
+
exchangeListName?: string;
|
|
395
|
+
exchangeListIndexFlag?: string;
|
|
396
|
+
marketLoanKbn?: string;
|
|
397
|
+
marketIppanLoanKbn?: string;
|
|
398
|
+
currentPrice?: CurrencyAmount;
|
|
399
|
+
tradeColorFlag?: string;
|
|
400
|
+
priceTick?: string;
|
|
401
|
+
priceTickText?: string;
|
|
402
|
+
tradeTime?: string;
|
|
403
|
+
changeText?: string;
|
|
404
|
+
volume?: number | null;
|
|
405
|
+
lotSize?: number | null;
|
|
406
|
+
priceSteps: StockOrderPreOrderPriceStep[];
|
|
407
|
+
sessionRange?: string;
|
|
408
|
+
basePrice?: CurrencyAmount;
|
|
409
|
+
orderTerms: string[];
|
|
410
|
+
orderTermDates: string[];
|
|
411
|
+
paymentLimits: StockOrderPreOrderPaymentLimit[];
|
|
412
|
+
nonSpecificTradeText?: string;
|
|
413
|
+
paymentLimitText?: string;
|
|
414
|
+
acquisitionPrice?: CurrencyAmount;
|
|
415
|
+
position?: number | null;
|
|
416
|
+
unexecutedQuantity?: number | null;
|
|
417
|
+
lotSize2?: number | null;
|
|
418
|
+
ptsDayNightFlag?: string;
|
|
419
|
+
sorServiceType?: string;
|
|
420
|
+
nisa?: {
|
|
421
|
+
serviceKbn?: string;
|
|
422
|
+
buyLimit?: CurrencyAmount;
|
|
423
|
+
growthServiceKbn?: string;
|
|
424
|
+
juniorServiceKbn?: string;
|
|
425
|
+
juniorBuyLimit?: CurrencyAmount;
|
|
426
|
+
juniorBuyingPowerTotal?: CurrencyAmount;
|
|
427
|
+
};
|
|
428
|
+
smallTickFlag?: string;
|
|
429
|
+
margin?: {
|
|
430
|
+
tradeTypes?: StockOrderPreOrderMarginTradeType[];
|
|
431
|
+
ippanShort?: string;
|
|
432
|
+
ippanLong?: string;
|
|
433
|
+
dayBuy?: string;
|
|
434
|
+
daySell?: string;
|
|
435
|
+
premiumShortSelling?: string;
|
|
436
|
+
premiumFee?: CurrencyAmount;
|
|
437
|
+
ippanPaymentLimit?: string;
|
|
438
|
+
positionStatus?: string;
|
|
439
|
+
};
|
|
440
|
+
sKabu?: {
|
|
441
|
+
code?: string;
|
|
442
|
+
available?: boolean;
|
|
443
|
+
};
|
|
444
|
+
deficitMessageFlag?: string;
|
|
445
|
+
deficitMessage?: string;
|
|
446
|
+
error?: SbiMethodError;
|
|
447
|
+
}
|
|
448
|
+
type ExchangeOrderSide = 'buy' | 'sell';
|
|
449
|
+
type ExchangeSpecificMethod = 'foreign' | 'domestic';
|
|
450
|
+
type ExchangeAccountKind = 'GENERAL' | 'JR_NISA';
|
|
451
|
+
type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL';
|
|
452
|
+
interface ExchangeOrderPreview {
|
|
453
|
+
currencyCode: string;
|
|
454
|
+
currencyName?: string;
|
|
455
|
+
side: ExchangeOrderSide;
|
|
456
|
+
exchangeType?: string;
|
|
457
|
+
accountKind?: ExchangeAccountKind;
|
|
458
|
+
specificMethod?: ExchangeSpecificMethod;
|
|
459
|
+
sellMethod?: ExchangeSellMethod | null;
|
|
460
|
+
tradeQuantity?: string;
|
|
461
|
+
orderAmount?: string;
|
|
462
|
+
exchangeRate?: string;
|
|
463
|
+
netAmount?: string;
|
|
464
|
+
valueDate?: string;
|
|
465
|
+
rateDateTime?: string;
|
|
466
|
+
warningMessage?: string | null;
|
|
467
|
+
isMaintenance?: boolean;
|
|
468
|
+
csrfToken: string;
|
|
469
|
+
}
|
|
470
|
+
interface ExchangeOrderReceipt {
|
|
471
|
+
accepted: boolean;
|
|
472
|
+
currencyCode?: string;
|
|
473
|
+
side?: ExchangeOrderSide;
|
|
474
|
+
message?: string;
|
|
475
|
+
warningMessage?: string | null;
|
|
476
|
+
rawTitle?: string;
|
|
477
|
+
}
|
|
478
|
+
interface ExchangeRateInfo {
|
|
479
|
+
currencyCode: string;
|
|
480
|
+
side: ExchangeOrderSide;
|
|
481
|
+
referenceExchangeRate?: string;
|
|
482
|
+
computeExchangeRate?: string;
|
|
483
|
+
basePrice?: string;
|
|
484
|
+
exchangeTradeType?: string;
|
|
485
|
+
updateTime?: string;
|
|
486
|
+
buyPossibleAmount?: string;
|
|
487
|
+
sellPossibleAmount?: string;
|
|
488
|
+
buyUnit?: string;
|
|
489
|
+
sellUnit?: string;
|
|
490
|
+
buyLimitMin?: string;
|
|
491
|
+
buyLimitMax?: string;
|
|
492
|
+
sellLimitMin?: string;
|
|
493
|
+
sellLimitMax?: string;
|
|
494
|
+
raw: Record<string, unknown>;
|
|
495
|
+
}
|
|
496
|
+
interface SbiMethodError {
|
|
497
|
+
status?: string;
|
|
498
|
+
code?: string;
|
|
499
|
+
message?: string;
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/operations.d.ts
|
|
503
|
+
interface IssueOptions {
|
|
504
|
+
/** Issue code to request. */
|
|
505
|
+
issueCode: IssueCode;
|
|
506
|
+
/** Market code to request. */
|
|
507
|
+
market: MarketCode;
|
|
508
|
+
}
|
|
509
|
+
type IssueChartOptions = IssueOptions & {
|
|
510
|
+
/** Chart period. Defaults to daily candles. */period?: ChartPeriod; /** Candle unit. Minute charts accept 1, 5, 10, or 15. Other periods use 1. */
|
|
511
|
+
unit?: number; /** Number of historical prices to request. Defaults to 120. */
|
|
512
|
+
count?: number;
|
|
513
|
+
};
|
|
514
|
+
interface IssueSearchOptions {
|
|
515
|
+
/** Search text, such as an issue code, name, or keyword. */
|
|
516
|
+
query: string;
|
|
517
|
+
/** Market code to search. */
|
|
518
|
+
market: MarketCode;
|
|
519
|
+
/** Maximum number of returned issues after client-side filtering. */
|
|
520
|
+
limit?: number;
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/provider.d.ts
|
|
524
|
+
type SbiSecOperations = CommonMethods & InvestmentMethods & {
|
|
525
|
+
'market.index.major': MethodDefinition<Record<string, never>, MarketIndex[]>;
|
|
526
|
+
'market.issue.chart': MethodDefinition<IssueChartOptions, IssueChart>;
|
|
527
|
+
'market.issue.search': MethodDefinition<IssueSearchOptions, IssueSearchResult>;
|
|
528
|
+
'market.issue.suggest': MethodDefinition<IssueSearchOptions, IssueSearchResult>;
|
|
529
|
+
'market.issue.board': MethodDefinition<IssueOptions, Board>;
|
|
530
|
+
};
|
|
531
|
+
/** Authenticates with an SBI passkey and returns the provider-neutral API. */
|
|
532
|
+
declare const connectWithPasskey: (options: LoginWithPasskeyOptions, clientOptions?: SbiClientOptions) => Promise<FinancialProvider<SbiSecOperations>>;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/session/passkey.d.ts
|
|
535
|
+
declare const createStoredCredentialPasskeyProvider: (credential: PlaintextStoredWebAuthnCredential) => PasskeyAssertionProvider;
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/methods/error-map.d.ts
|
|
538
|
+
declare const SBI_SERVER_ERROR_MESSAGES: Record<string, string>;
|
|
539
|
+
interface SbiServerErrorOptions {
|
|
540
|
+
code: string;
|
|
541
|
+
status?: string;
|
|
542
|
+
serverMessage?: string;
|
|
543
|
+
trCode?: string;
|
|
544
|
+
requestUrl?: string;
|
|
545
|
+
}
|
|
546
|
+
declare class SbiServerError extends Error {
|
|
547
|
+
readonly code: string;
|
|
548
|
+
readonly status?: string;
|
|
549
|
+
readonly serverMessage?: string;
|
|
550
|
+
readonly englishMessage: string;
|
|
551
|
+
readonly trCode?: string;
|
|
552
|
+
readonly requestUrl?: string;
|
|
553
|
+
constructor(options: SbiServerErrorOptions);
|
|
554
|
+
}
|
|
555
|
+
declare const getSbiServerErrorMessage: (code: string) => string;
|
|
556
|
+
//#endregion
|
|
557
|
+
export { type AccountAssetsValuationDetail, type AccountAssetsValuationSummary, type AccountAssetsValuations, type ChartPeriod, type ChartPrice, type ExchangeAccountKind, type ExchangeOrderPreview, type ExchangeOrderReceipt, type ExchangeOrderSide, type ExchangeRateInfo, type ExchangeSellMethod, type ExchangeSpecificMethod, type IssueChart, type IssueSearchItem, type IssueSearchResult, type IssueSearchStatus, type LoginWithPasskeyOptions, type MarketCode, type OrderCorrectionPreOrder, type OrderCorrectionPreOrderDetail, type OrderPreview, type PasskeyAssertionProvider, type PasskeyLoginResponse, type PlaintextStoredWebAuthnCredential, SBI_SERVER_ERROR_MESSAGES, type SbiClientOptions, type SbiEndpointOptions, type SbiSecOperations, SbiServerError, type SbiServerErrorOptions, type StockOrderPreOrder, type StockOrderPreOrderMarginTradeType, type StockOrderPreOrderPaymentLimit, type StockOrderPreOrderPriceStep, type StoredWebAuthnCredential, type StoredWebAuthnCredentialSecret, type TradeRecord, type TradeRecordList, type WebAuthnAlgorithm, type WebAuthnAssertion, type WebAuthnAssertionRequest, type WebAuthnJwk, type WebAuthnTransport, type WebAuthnUserVerification, connectWithPasskey, createStoredCredentialPasskeyProvider, getSbiServerErrorMessage };
|