This commit is contained in:
Shotaro Nakamura
2026-07-10 19:03:57 +09:00
parent df40c591a5
commit 23aa3e5775
42 changed files with 259 additions and 256 deletions
+1
View File
@@ -20,6 +20,7 @@
"iconv-lite": "^0.7.2"
},
"devDependencies": {
"@repo/tsconfig": "workspace:*",
"@types/bun": "latest"
},
"peerDependencies": {
+1 -1
View File
@@ -99,7 +99,7 @@ export const SBI_SERVER_ERROR_MESSAGES: Record<string, string> = {
E_0083: 'An error occurred. Wait a while and try again.',
}
export type SbiServerErrorOptions = {
export interface SbiServerErrorOptions {
code: string
status?: string
serverMessage?: string
+10 -10
View File
@@ -125,7 +125,7 @@ const CHART_DEFAULT_UNITS = {
} as const satisfies Record<ChartPeriod, number>
const CHART_MINUTE_UNITS = new Set([1, 5, 10, 15])
type MtsHeader = {
interface MtsHeader {
sessionId: string
trCode: string
resultCode: string
@@ -134,7 +134,7 @@ type MtsHeader = {
maintenance: string
}
type MtsResponse = {
interface MtsResponse {
status: number
requestUrl: string
header: MtsHeader
@@ -142,14 +142,14 @@ type MtsResponse = {
text: string
}
type FixedField = {
interface FixedField {
width: number
value?: string | number | null
align?: 'left' | 'right'
pad?: string
}
type OrderPreviewInput = {
interface OrderPreviewInput {
issueCode: string
market?: MarketCode
side: TradeSide
@@ -157,7 +157,7 @@ type OrderPreviewInput = {
price?: number
}
type CashPreOrderInfo = {
interface CashPreOrderInfo {
issueCode?: string
market?: string
issueName?: string
@@ -170,7 +170,7 @@ const cashCorrectionPreviewInput = {
type TradeAuthenticationStatus = 'success' | 'needDial' | 'excessivelyRequested' | 'unexpected'
type TradeAuthenticationInfo = {
interface TradeAuthenticationInfo {
status: TradeAuthenticationStatus
statusCode: string
telNo?: string
@@ -258,7 +258,7 @@ const publicDomesticMarket = (market: string | undefined, methodName: string) =>
return publicMarket
}
type IzanagiIssueSearchItem = {
interface IzanagiIssueSearchItem {
stockName?: string | null
stockCode?: string | null
mkt?: string | null
@@ -269,7 +269,7 @@ type IzanagiIssueSearchItem = {
hitString?: string | null
}
type IzanagiIssueSearchResponse = {
interface IzanagiIssueSearchResponse {
status?: string | null
stocks?: IzanagiIssueSearchItem[] | null
}
@@ -4100,7 +4100,7 @@ const isCashPreOrderInput = (
options: StockOrderPreOrderInput,
): options is CashOrderOptions | CashOrderPreOrderOptions => 'kind' in options
type AppStockOrderTrinOptions = {
interface AppStockOrderTrinOptions {
issueCode: string
market: string
quantity: number
@@ -4122,7 +4122,7 @@ type AppStockOrderTrinOptions = {
methodName: string
}
type OmitConfirmationOption = {
interface OmitConfirmationOption {
omitConfirmation?: boolean
}
+4 -4
View File
@@ -24,24 +24,24 @@ import type {
} from '../types'
import type { SbiClientMethods } from '../methods/types'
type PasskeyLoginStart = {
interface PasskeyLoginStart {
url: string
privateKeyPem: string
publicKey: string
}
type PasskeyAccessToken = {
interface PasskeyAccessToken {
callbackUrl: string
accessToken: string
}
type CredentialRequest = {
interface CredentialRequest {
challenge: string
rpId: string
csrfToken?: string
}
type SbiEndpointConfig = {
interface SbiEndpointConfig {
authBaseUrl: string
mtsBaseUrl: string
izanagiBaseUrl?: string
+59 -59
View File
@@ -4,7 +4,7 @@ export type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged'
export type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb'
export type WebAuthnJwk = {
export interface WebAuthnJwk {
kty: string
crv?: string
x?: string
@@ -17,7 +17,7 @@ export type WebAuthnJwk = {
[key: string]: unknown
}
export type StoredWebAuthnCredentialSecret = {
export interface StoredWebAuthnCredentialSecret {
privateKey: {
format: 'jwk'
jwk: WebAuthnJwk
@@ -29,7 +29,7 @@ export type StoredWebAuthnCredentialSecret = {
}
}
export type StoredWebAuthnCredential = {
export interface StoredWebAuthnCredential {
version: 1
kind: 'webauthn-credential'
provider: 'sbi-sec'
@@ -76,7 +76,7 @@ export type PlaintextStoredWebAuthnCredential = Omit<StoredWebAuthnCredential, '
secretPlaintext: StoredWebAuthnCredentialSecret
}
export type PasskeyLoginResponse = {
export interface PasskeyLoginResponse {
type: 'passkey-login-response'
requestUrl: string
status: number
@@ -90,7 +90,7 @@ export type PasskeyLoginResponse = {
} | null
}
export type ForeignStockEndpointConfig = {
export interface ForeignStockEndpointConfig {
baseUrl?: string
restUrl: string
graphqlBffUrl: string
@@ -98,7 +98,7 @@ export type ForeignStockEndpointConfig = {
userAgent?: string
}
export type ForeignStockSession = {
export interface ForeignStockSession {
endpoints: ForeignStockEndpointConfig
ssoToken?: string
sessionId?: string
@@ -108,14 +108,14 @@ export type ForeignStockSession = {
loginAuthenticated?: boolean
}
export type MainSiteAuthCache = {
export interface MainSiteAuthCache {
baseUrl: string
assetsUrl: string
cookieHeader: string
authenticatedAt: string
}
export type MainSiteSession = {
export interface MainSiteSession {
baseUrl?: string
etGatePath?: string
assetsValuationsPath?: string
@@ -127,7 +127,7 @@ export type MainSiteSession = {
authPromise?: Promise<MainSiteAuthCache>
}
export type SbiSession = {
export interface SbiSession {
mtsBaseUrl: string
izanagiBaseUrl?: string
foreignStock?: ForeignStockSession
@@ -139,7 +139,7 @@ export type SbiSession = {
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type LoginWithPasskeyOptions = {
export interface LoginWithPasskeyOptions {
passkeyCredential: PlaintextStoredWebAuthnCredential
authBaseUrl?: string
mtsBaseUrl?: string
@@ -159,13 +159,13 @@ export type LoginWithPasskeyOptions = {
mainSiteExchangeOrderCompletePath?: string
}
export type SbiClientOptions = {
export interface SbiClientOptions {
tradePassword?: string
deviceId?: string
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type SbiTradeAuthenticationRequest = {
export interface SbiTradeAuthenticationRequest {
type: 'phone'
telNo?: string
phoneNo?: string
@@ -173,7 +173,7 @@ export type SbiTradeAuthenticationRequest = {
authLimitTime?: string
}
export type SbiTradeAuthenticationOptions = {
export interface SbiTradeAuthenticationOptions {
onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise<void>
confirmAttempts?: number
confirmIntervalMs?: number
@@ -189,24 +189,24 @@ export type WatchlistId = string
export type PositionId = string
export type ThemeId = string
export type CurrencyAmount = {
export interface CurrencyAmount {
value: number | null
text: string
currency: 'JPY' | 'USD'
}
export type PercentValue = {
export interface PercentValue {
value: number | null
text: string
}
export type SignedTextValue = {
export interface SignedTextValue {
value: number | null
text: string
sign?: 'positive' | 'negative' | 'zero'
}
export type AccountAssetsValuationSummary = {
export interface AccountAssetsValuationSummary {
assetsErrorType: unknown
valuation: number | null
netChange: number | null
@@ -223,7 +223,7 @@ export type AccountAssetsValuationDetail = AccountAssetsValuationSummary & {
compositionRatio: number | null
}
export type AccountAssetsValuations = {
export interface AccountAssetsValuations {
fetchedAt: string
summary: AccountAssetsValuationSummary
summaryWithoutDeposit: AccountAssetsValuationSummary
@@ -276,7 +276,7 @@ export type IsaAccountType =
| 'nisaTradePermitted'
| 'unknown'
export type IssueRef = {
export interface IssueRef {
code: IssueCode
market?: MarketCode
name?: string
@@ -292,7 +292,7 @@ export type IssueSearchItem = IssueRef & {
export type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown'
export type IssueSearchResult = {
export interface IssueSearchResult {
status?: string
statusText: IssueSearchStatus
issues: IssueSearchItem[]
@@ -300,7 +300,7 @@ export type IssueSearchResult = {
export type ChartPeriod = 'minute' | 'day' | 'week' | 'month'
export type ChartPrice = {
export interface ChartPrice {
dateTime: string
open: CurrencyAmount
high: CurrencyAmount
@@ -309,7 +309,7 @@ export type ChartPrice = {
volume?: number | null
}
export type IssueChart = {
export interface IssueChart {
issue: IssueRef
period: ChartPeriod
unit: number
@@ -322,13 +322,13 @@ export type IssueChart = {
error?: SbiMethodError
}
export type SessionInfo = {
export interface SessionInfo {
sessionId: string
loginType: LoginType
resultCode: string
}
export type AccountProfile = {
export interface AccountProfile {
session: SessionInfo
branchCode?: string
butenCode?: string
@@ -391,7 +391,7 @@ export type AccountProfile = {
}
}
export type BuyingPower = {
export interface BuyingPower {
cashBuyingPower?: CurrencyAmount
marginBuyingPower?: CurrencyAmount
withdrawableAmount?: CurrencyAmount
@@ -403,7 +403,7 @@ export type BuyingPower = {
error?: SbiMethodError
}
export type CollateralRatioRecord = {
export interface CollateralRatioRecord {
marginRequirements?: CurrencyAmount
referenceMarginRequirements?: CurrencyAmount
collateralRatioCash?: CurrencyAmount
@@ -420,7 +420,7 @@ export type CollateralRatioRecord = {
minimumCollateral?: CurrencyAmount
}
export type CashPosition = {
export interface CashPosition {
issue: IssueRef
accountType?: AccountType
depositType?: DepositType
@@ -449,7 +449,7 @@ export type CashPosition = {
accountInformation?: string
}
export type CashPositionList = {
export interface CashPositionList {
positions: CashPosition[]
index?: number
totalCount?: number
@@ -461,7 +461,7 @@ export type CashPositionList = {
error?: SbiMethodError
}
export type MarginPosition = {
export interface MarginPosition {
id?: PositionId
issue: IssueRef
side: MarginTradeSide
@@ -503,7 +503,7 @@ export type MarginPosition = {
bargainMarket?: string
}
export type MarginPositionList = {
export interface MarginPositionList {
positions: MarginPosition[]
index?: number
totalCount?: number
@@ -515,7 +515,7 @@ export type MarginPositionList = {
error?: SbiMethodError
}
export type ProfitLossSummary = {
export interface ProfitLossSummary {
cash?: SignedTextValue
margin?: SignedTextValue
total?: SignedTextValue
@@ -523,7 +523,7 @@ export type ProfitLossSummary = {
error?: SbiMethodError
}
export type Quote = {
export interface Quote {
issue: IssueRef
price?: CurrencyAmount
change?: SignedTextValue
@@ -539,12 +539,12 @@ export type Quote = {
error?: SbiMethodError
}
export type BoardPriceLevel = {
export interface BoardPriceLevel {
price: CurrencyAmount
quantity?: number | null
}
export type Board = {
export interface Board {
issue: IssueRef
bids: BoardPriceLevel[]
asks: BoardPriceLevel[]
@@ -552,7 +552,7 @@ export type Board = {
error?: SbiMethodError
}
export type MarketIndex = {
export interface MarketIndex {
code?: string
categoryCode?: string
name: string
@@ -568,13 +568,13 @@ export type MarketIndex = {
previousClose?: CurrencyAmount
}
export type DomesticMarket = {
export interface DomesticMarket {
status?: string
indexes: MarketIndex[]
error?: SbiMethodError
}
export type RankingItem = {
export interface RankingItem {
rank: number
issue: IssueRef
value?: number | string | null
@@ -585,14 +585,14 @@ export type RankingItem = {
colorFlag?: string
}
export type Ranking = {
export interface Ranking {
items: RankingItem[]
category?: string
updatedAt?: string
error?: SbiMethodError
}
export type NewsItem = {
export interface NewsItem {
id?: string
title: string
source?: string
@@ -606,26 +606,26 @@ export type NewsItem = {
pnac?: string
}
export type NewsList = {
export interface NewsList {
items: NewsItem[]
error?: SbiMethodError
}
export type WatchlistItem = {
export interface WatchlistItem {
issue: IssueRef
sortOrder?: number
memo?: string
quote?: Quote
}
export type Watchlist = {
export interface Watchlist {
id: WatchlistId
name: string
items: WatchlistItem[]
error?: SbiMethodError
}
export type Order = {
export interface Order {
id: OrderId
issue: IssueRef
side: TradeSide
@@ -655,13 +655,13 @@ export type Order = {
correctable?: boolean
}
export type OrderList = {
export interface OrderList {
orders: Order[]
hasMore?: boolean
error?: SbiMethodError
}
export type TradeRecord = {
export interface TradeRecord {
id: string
issue: IssueRef
tradeRecordTypeCode?: string
@@ -678,13 +678,13 @@ export type TradeRecord = {
marginCloseLimitType?: string
}
export type TradeRecordList = {
export interface TradeRecordList {
records: TradeRecord[]
hasMore?: boolean
error?: SbiMethodError
}
export type OrderCorrectionPreOrderDetail = {
export interface OrderCorrectionPreOrderDetail {
exchangeName?: string
marketLoanKbn?: string
marketIppanLoanKbn?: string
@@ -697,7 +697,7 @@ export type OrderCorrectionPreOrderDetail = {
volumeText?: string
}
export type OrderCorrectionPreOrder = {
export interface OrderCorrectionPreOrder {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
@@ -753,7 +753,7 @@ export type OrderCorrectionPreOrder = {
exchangeList?: string
}
export type OrderPreview = {
export interface OrderPreview {
issue: IssueRef
side: TradeSide
quantity?: number
@@ -768,12 +768,12 @@ export type OrderPreview = {
error?: SbiMethodError
}
export type StockOrderPreOrderPriceStep = {
export interface StockOrderPreOrderPriceStep {
from?: CurrencyAmount
to?: CurrencyAmount
}
export type StockOrderPreOrderPaymentLimit = {
export interface StockOrderPreOrderPaymentLimit {
text?: string
code?: string
}
@@ -787,7 +787,7 @@ export type StockOrderPreOrderMarginTradeType =
| 'day'
| 'hyper'
export type StockOrderPreOrder = {
export interface StockOrderPreOrder {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
@@ -850,7 +850,7 @@ export type StockOrderPreOrder = {
error?: SbiMethodError
}
export type OrderReceipt = {
export interface OrderReceipt {
accepted: boolean
orderId?: OrderId
acceptedAt?: string
@@ -863,7 +863,7 @@ export type ExchangeSpecificMethod = 'foreign' | 'domestic'
export type ExchangeAccountKind = 'GENERAL' | 'JR_NISA'
export type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL'
export type ExchangeOrderPreview = {
export interface ExchangeOrderPreview {
currencyCode: string
currencyName?: string
side: ExchangeOrderSide
@@ -882,7 +882,7 @@ export type ExchangeOrderPreview = {
csrfToken: string
}
export type ExchangeOrderReceipt = {
export interface ExchangeOrderReceipt {
accepted: boolean
currencyCode?: string
side?: ExchangeOrderSide
@@ -891,7 +891,7 @@ export type ExchangeOrderReceipt = {
rawTitle?: string
}
export type ExchangeRateInfo = {
export interface ExchangeRateInfo {
currencyCode: string
side: ExchangeOrderSide
referenceExchangeRate?: string
@@ -910,7 +910,7 @@ export type ExchangeRateInfo = {
raw: Record<string, unknown>
}
export type ThemeInvestment = {
export interface ThemeInvestment {
id: ThemeId
name: string
issues: ThemeInvestmentIssue[]
@@ -933,7 +933,7 @@ export type ThemeInvestmentIssue = IssueRef & {
tradeTime?: string
}
export type ThemeInvestmentList = {
export interface ThemeInvestmentList {
themes: ThemeInvestment[]
buyingPowerTotal?: CurrencyAmount
isaBuyLimit?: CurrencyAmount
@@ -944,7 +944,7 @@ export type ThemeInvestmentList = {
error?: SbiMethodError
}
export type SbiMethodError = {
export interface SbiMethodError {
status?: string
code?: string
message?: string
+2 -27
View File
@@ -1,29 +1,4 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
"extends": "@repo/tsconfig/tsconfig.json",
"include": ["src/**/*.ts"]
}
+1
View File
@@ -17,6 +17,7 @@
"@repo/mnie-sdk": "workspace:*"
},
"devDependencies": {
"@repo/tsconfig": "workspace:*",
"@types/bun": "latest"
},
"peerDependencies": {
+2 -2
View File
@@ -7,14 +7,14 @@ import { homedir } from 'node:os'
import { dirname, join } from 'node:path'
import { createMnieClient } from '@repo/mnie-sdk'
type Profile = {
interface Profile {
origin: string
apiKeyStorage: 'file' | 'keyring'
apiKey?: string
keyringAccount?: string
}
type ProfilesFile = {
interface ProfilesFile {
defaultProfile?: string
profiles: Record<string, Profile>
}
+1 -1
View File
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "@repo/tsconfig/tsconfig.json",
"include": ["src/**/*.ts"]
}
+2 -2
View File
@@ -1,6 +1,5 @@
{
"name": "@repo/mnie-sdk",
"private": true,
"name": "mnie",
"type": "module",
"module": "./dist/index.mjs",
"types": "./src/index.ts",
@@ -19,6 +18,7 @@
"@repo/mnie-types": "workspace:*"
},
"devDependencies": {
"@repo/tsconfig": "workspace:*",
"@types/bun": "latest"
},
"peerDependencies": {
+4 -4
View File
@@ -1,12 +1,12 @@
import type { SbiClientMethods } from '@repo/mnie-types'
export type MnieSdkOptions = {
export interface MnieSdkOptions {
origin: string
apiKey: string
WebSocket?: typeof WebSocket
}
export type JsonRpcError = {
export interface JsonRpcError {
code: number
message: string
}
@@ -17,14 +17,14 @@ export type MnieClient = SbiClientMethods & {
close(): void
}
type JsonRpcResponse = {
interface JsonRpcResponse {
jsonrpc?: '2.0'
id?: string | number | null
result?: unknown
error?: JsonRpcError
}
type PendingCall = {
interface PendingCall {
resolve: (value: unknown) => void
reject: (error: Error) => void
}
+1 -1
View File
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "@repo/tsconfig/tsconfig.json",
"include": ["src/**/*.ts"]
}
+1
View File
@@ -16,6 +16,7 @@
"typecheck": "tsc"
},
"devDependencies": {
"@repo/tsconfig": "workspace:*",
"@types/bun": "latest"
},
"peerDependencies": {
+18 -18
View File
@@ -42,21 +42,21 @@ import type {
Watchlist,
} from './types'
export type PagingOptions = {
export interface PagingOptions {
/** Start index for the result list. Defaults to the first item when omitted. */
index?: number
/** Maximum number of items to fetch. Uses the implementation default when omitted. */
limit?: number
}
export type DateRangeOptions = {
export interface DateRangeOptions {
/** Start date for the inquiry range. */
from?: string
/** End date for the inquiry range. */
to?: string
}
export type IssueOptions = {
export interface IssueOptions {
/** Issue code to request. */
issueCode: IssueCode
/** Market code to request. */
@@ -79,7 +79,7 @@ export type IssueChartOptions = IssueOptions & {
count?: number
}
export type IssueSearchOptions = {
export interface IssueSearchOptions {
/** Search text, such as an issue code, name, or keyword. */
query: string
/** Market code to search. */
@@ -118,7 +118,7 @@ export type OrderInquiryOptions = PagingOptions &
status?: OrderStatus
}
export type OrderDetailOptions = {
export interface OrderDetailOptions {
/** Order number shown in order inquiry. */
orderNumber?: string
/** Order ID from order inquiry. For US stocks this is often `orderSubNo`. */
@@ -149,7 +149,7 @@ export type BoardOptions = IssueOptions & {
| 'marginCloseSell'
}
export type StockOrderBaseOptions = {
export interface StockOrderBaseOptions {
/** Issue code to order. */
issueCode: IssueCode
/** Market code to order on. */
@@ -185,7 +185,7 @@ export type CashOrderTriggerZone = 'above' | 'below'
export type CashOrderMethod = 'normal' | 'stop' | 'oco'
export type StockOrderMarginPosition = {
export interface StockOrderMarginPosition {
/** Open trade date from the margin position record, in yyyyMMdd or yyyy-MM-dd format. */
openTradeDate: string
/** Open price from the margin position record. Raw strings are accepted to preserve APK values. */
@@ -284,7 +284,7 @@ export type MarginClosePositionOrder =
export type ActualDeliveryKind = 'genbiki' | 'genwatashi'
export type ActualDeliveryOrderOptions = {
export interface ActualDeliveryOrderOptions {
/** Issue code to deliver. */
issueCode: IssueCode
/** Market code for the issue. */
@@ -339,7 +339,7 @@ export type PlaceActualDeliveryOrderOptions = ActualDeliveryOrderOptions & {
allowTrading?: true
}
export type OrderCorrectionOptions = {
export interface OrderCorrectionOptions {
/** Order number shown in order inquiry. Required by the mobile pre-correction route. */
orderNumber?: string
/** Order ID to correct. */
@@ -397,7 +397,7 @@ export type PlaceOrderCorrectionOptions = OrderCorrectionOptions & {
allowTrading?: true
}
export type OrderCancelOptions = {
export interface OrderCancelOptions {
/** Order number shown in order inquiry. */
orderNumber: string
/** Original order ID shown in order inquiry. */
@@ -419,7 +419,7 @@ export type PlaceOrderCancelOptions = OrderCancelOptions & {
allowTrading?: true
}
export type ExchangeOrderOptions = {
export interface ExchangeOrderOptions {
/** Currency code, such as USD. */
currencyCode: string
/** Buy or sell the foreign currency. */
@@ -438,7 +438,7 @@ export type ExchangeOrderOptions = {
tradePassword?: string
}
export type ExchangeRateOptions = {
export interface ExchangeRateOptions {
/** Currency code, such as USD. */
currencyCode: string
/** Buy or sell the foreign currency. */
@@ -513,7 +513,7 @@ export type PlaceIfdOrderOptions = IfdOrderOptions & {
allowTrading?: true
}
export type ThemeInvestmentOrderOptions = {
export interface ThemeInvestmentOrderOptions {
/** Theme ID for the theme investment order. */
themeId: ThemeId
/** Theme set year/month (`theme_set_yyyymm`) from the mobile APK handoff. */
@@ -532,21 +532,21 @@ export type ThemeInvestmentOrderOptions = {
amount?: number
}
export type ThemeInvestmentOrderComponent = {
export interface ThemeInvestmentOrderComponent {
/** Component stock issue code. */
issueCode: IssueCode
/** Component order quantity. */
quantity: number | string
}
export type ThemeInvestmentPreOrderComponent = {
export interface ThemeInvestmentPreOrderComponent {
/** Component stock issue code selected by the mobile theme investment flow. */
issueCode: IssueCode
/** Component order quantity from the mobile handoff, when already selected. */
quantity?: number | string
}
export type ThemeInvestmentPreOrderOptions = {
export interface ThemeInvestmentPreOrderOptions {
/** Theme ID for the theme investment order target. */
themeId: ThemeId
/** Theme name from the mobile theme investment flow, when available. */
@@ -562,12 +562,12 @@ export type PlaceThemeInvestmentOrderOptions = ThemeInvestmentOrderOptions & {
allowTrading?: true
}
export type AccountPowerOptions = {
export interface AccountPowerOptions {
/** Fetches margin-account collateral details. Disable this for accounts without margin trading. */
includeMarginAccount?: boolean
}
export type ProfitLossOptions = {
export interface ProfitLossOptions {
/** Market to fetch profit/loss for. Omit for domestic cash/margin summary. */
market?: MarketCode
}
+59 -59
View File
@@ -4,7 +4,7 @@ export type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged'
export type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb'
export type WebAuthnJwk = {
export interface WebAuthnJwk {
kty: string
crv?: string
x?: string
@@ -17,7 +17,7 @@ export type WebAuthnJwk = {
[key: string]: unknown
}
export type StoredWebAuthnCredentialSecret = {
export interface StoredWebAuthnCredentialSecret {
privateKey: {
format: 'jwk'
jwk: WebAuthnJwk
@@ -29,7 +29,7 @@ export type StoredWebAuthnCredentialSecret = {
}
}
export type StoredWebAuthnCredential = {
export interface StoredWebAuthnCredential {
version: 1
kind: 'webauthn-credential'
provider: 'sbi-sec'
@@ -76,7 +76,7 @@ export type PlaintextStoredWebAuthnCredential = Omit<StoredWebAuthnCredential, '
secretPlaintext: StoredWebAuthnCredentialSecret
}
export type PasskeyLoginResponse = {
export interface PasskeyLoginResponse {
type: 'passkey-login-response'
requestUrl: string
status: number
@@ -90,7 +90,7 @@ export type PasskeyLoginResponse = {
} | null
}
export type ForeignStockEndpointConfig = {
export interface ForeignStockEndpointConfig {
baseUrl?: string
restUrl: string
graphqlBffUrl: string
@@ -98,7 +98,7 @@ export type ForeignStockEndpointConfig = {
userAgent?: string
}
export type ForeignStockSession = {
export interface ForeignStockSession {
endpoints: ForeignStockEndpointConfig
ssoToken?: string
sessionId?: string
@@ -108,14 +108,14 @@ export type ForeignStockSession = {
loginAuthenticated?: boolean
}
export type MainSiteAuthCache = {
export interface MainSiteAuthCache {
baseUrl: string
assetsUrl: string
cookieHeader: string
authenticatedAt: string
}
export type MainSiteSession = {
export interface MainSiteSession {
baseUrl?: string
etGatePath?: string
assetsValuationsPath?: string
@@ -127,7 +127,7 @@ export type MainSiteSession = {
authPromise?: Promise<MainSiteAuthCache>
}
export type SbiSession = {
export interface SbiSession {
mtsBaseUrl: string
izanagiBaseUrl?: string
foreignStock?: ForeignStockSession
@@ -139,7 +139,7 @@ export type SbiSession = {
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type LoginWithPasskeyOptions = {
export interface LoginWithPasskeyOptions {
passkeyCredential: PlaintextStoredWebAuthnCredential
authBaseUrl?: string
mtsBaseUrl?: string
@@ -159,13 +159,13 @@ export type LoginWithPasskeyOptions = {
mainSiteExchangeOrderCompletePath?: string
}
export type SbiClientOptions = {
export interface SbiClientOptions {
tradePassword?: string
deviceId?: string
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type SbiTradeAuthenticationRequest = {
export interface SbiTradeAuthenticationRequest {
type: 'phone'
telNo?: string
phoneNo?: string
@@ -173,7 +173,7 @@ export type SbiTradeAuthenticationRequest = {
authLimitTime?: string
}
export type SbiTradeAuthenticationOptions = {
export interface SbiTradeAuthenticationOptions {
onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise<void>
confirmAttempts?: number
confirmIntervalMs?: number
@@ -189,24 +189,24 @@ export type WatchlistId = string
export type PositionId = string
export type ThemeId = string
export type CurrencyAmount = {
export interface CurrencyAmount {
value: number | null
text: string
currency: 'JPY' | 'USD'
}
export type PercentValue = {
export interface PercentValue {
value: number | null
text: string
}
export type SignedTextValue = {
export interface SignedTextValue {
value: number | null
text: string
sign?: 'positive' | 'negative' | 'zero'
}
export type AccountAssetsValuationSummary = {
export interface AccountAssetsValuationSummary {
assetsErrorType: unknown
valuation: number | null
netChange: number | null
@@ -223,7 +223,7 @@ export type AccountAssetsValuationDetail = AccountAssetsValuationSummary & {
compositionRatio: number | null
}
export type AccountAssetsValuations = {
export interface AccountAssetsValuations {
fetchedAt: string
summary: AccountAssetsValuationSummary
summaryWithoutDeposit: AccountAssetsValuationSummary
@@ -276,7 +276,7 @@ export type IsaAccountType =
| 'nisaTradePermitted'
| 'unknown'
export type IssueRef = {
export interface IssueRef {
code: IssueCode
market?: MarketCode
name?: string
@@ -292,7 +292,7 @@ export type IssueSearchItem = IssueRef & {
export type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown'
export type IssueSearchResult = {
export interface IssueSearchResult {
status?: string
statusText: IssueSearchStatus
issues: IssueSearchItem[]
@@ -300,7 +300,7 @@ export type IssueSearchResult = {
export type ChartPeriod = 'minute' | 'day' | 'week' | 'month'
export type ChartPrice = {
export interface ChartPrice {
dateTime: string
open: CurrencyAmount
high: CurrencyAmount
@@ -309,7 +309,7 @@ export type ChartPrice = {
volume?: number | null
}
export type IssueChart = {
export interface IssueChart {
issue: IssueRef
period: ChartPeriod
unit: number
@@ -322,13 +322,13 @@ export type IssueChart = {
error?: SbiMethodError
}
export type SessionInfo = {
export interface SessionInfo {
sessionId: string
loginType: LoginType
resultCode: string
}
export type AccountProfile = {
export interface AccountProfile {
session: SessionInfo
branchCode?: string
butenCode?: string
@@ -391,7 +391,7 @@ export type AccountProfile = {
}
}
export type BuyingPower = {
export interface BuyingPower {
cashBuyingPower?: CurrencyAmount
marginBuyingPower?: CurrencyAmount
withdrawableAmount?: CurrencyAmount
@@ -403,7 +403,7 @@ export type BuyingPower = {
error?: SbiMethodError
}
export type CollateralRatioRecord = {
export interface CollateralRatioRecord {
marginRequirements?: CurrencyAmount
referenceMarginRequirements?: CurrencyAmount
collateralRatioCash?: CurrencyAmount
@@ -420,7 +420,7 @@ export type CollateralRatioRecord = {
minimumCollateral?: CurrencyAmount
}
export type CashPosition = {
export interface CashPosition {
issue: IssueRef
accountType?: AccountType
depositType?: DepositType
@@ -449,7 +449,7 @@ export type CashPosition = {
accountInformation?: string
}
export type CashPositionList = {
export interface CashPositionList {
positions: CashPosition[]
index?: number
totalCount?: number
@@ -461,7 +461,7 @@ export type CashPositionList = {
error?: SbiMethodError
}
export type MarginPosition = {
export interface MarginPosition {
id?: PositionId
issue: IssueRef
side: MarginTradeSide
@@ -503,7 +503,7 @@ export type MarginPosition = {
bargainMarket?: string
}
export type MarginPositionList = {
export interface MarginPositionList {
positions: MarginPosition[]
index?: number
totalCount?: number
@@ -515,7 +515,7 @@ export type MarginPositionList = {
error?: SbiMethodError
}
export type ProfitLossSummary = {
export interface ProfitLossSummary {
cash?: SignedTextValue
margin?: SignedTextValue
total?: SignedTextValue
@@ -523,7 +523,7 @@ export type ProfitLossSummary = {
error?: SbiMethodError
}
export type Quote = {
export interface Quote {
issue: IssueRef
price?: CurrencyAmount
change?: SignedTextValue
@@ -539,12 +539,12 @@ export type Quote = {
error?: SbiMethodError
}
export type BoardPriceLevel = {
export interface BoardPriceLevel {
price: CurrencyAmount
quantity?: number | null
}
export type Board = {
export interface Board {
issue: IssueRef
bids: BoardPriceLevel[]
asks: BoardPriceLevel[]
@@ -552,7 +552,7 @@ export type Board = {
error?: SbiMethodError
}
export type MarketIndex = {
export interface MarketIndex {
code?: string
categoryCode?: string
name: string
@@ -568,13 +568,13 @@ export type MarketIndex = {
previousClose?: CurrencyAmount
}
export type DomesticMarket = {
export interface DomesticMarket {
status?: string
indexes: MarketIndex[]
error?: SbiMethodError
}
export type RankingItem = {
export interface RankingItem {
rank: number
issue: IssueRef
value?: number | string | null
@@ -585,14 +585,14 @@ export type RankingItem = {
colorFlag?: string
}
export type Ranking = {
export interface Ranking {
items: RankingItem[]
category?: string
updatedAt?: string
error?: SbiMethodError
}
export type NewsItem = {
export interface NewsItem {
id?: string
title: string
source?: string
@@ -606,26 +606,26 @@ export type NewsItem = {
pnac?: string
}
export type NewsList = {
export interface NewsList {
items: NewsItem[]
error?: SbiMethodError
}
export type WatchlistItem = {
export interface WatchlistItem {
issue: IssueRef
sortOrder?: number
memo?: string
quote?: Quote
}
export type Watchlist = {
export interface Watchlist {
id: WatchlistId
name: string
items: WatchlistItem[]
error?: SbiMethodError
}
export type Order = {
export interface Order {
id: OrderId
issue: IssueRef
side: TradeSide
@@ -655,13 +655,13 @@ export type Order = {
correctable?: boolean
}
export type OrderList = {
export interface OrderList {
orders: Order[]
hasMore?: boolean
error?: SbiMethodError
}
export type TradeRecord = {
export interface TradeRecord {
id: string
issue: IssueRef
tradeRecordTypeCode?: string
@@ -678,13 +678,13 @@ export type TradeRecord = {
marginCloseLimitType?: string
}
export type TradeRecordList = {
export interface TradeRecordList {
records: TradeRecord[]
hasMore?: boolean
error?: SbiMethodError
}
export type OrderCorrectionPreOrderDetail = {
export interface OrderCorrectionPreOrderDetail {
exchangeName?: string
marketLoanKbn?: string
marketIppanLoanKbn?: string
@@ -697,7 +697,7 @@ export type OrderCorrectionPreOrderDetail = {
volumeText?: string
}
export type OrderCorrectionPreOrder = {
export interface OrderCorrectionPreOrder {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
@@ -753,7 +753,7 @@ export type OrderCorrectionPreOrder = {
exchangeList?: string
}
export type OrderPreview = {
export interface OrderPreview {
issue: IssueRef
side: TradeSide
quantity?: number
@@ -768,12 +768,12 @@ export type OrderPreview = {
error?: SbiMethodError
}
export type StockOrderPreOrderPriceStep = {
export interface StockOrderPreOrderPriceStep {
from?: CurrencyAmount
to?: CurrencyAmount
}
export type StockOrderPreOrderPaymentLimit = {
export interface StockOrderPreOrderPaymentLimit {
text?: string
code?: string
}
@@ -787,7 +787,7 @@ export type StockOrderPreOrderMarginTradeType =
| 'day'
| 'hyper'
export type StockOrderPreOrder = {
export interface StockOrderPreOrder {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
@@ -850,7 +850,7 @@ export type StockOrderPreOrder = {
error?: SbiMethodError
}
export type OrderReceipt = {
export interface OrderReceipt {
accepted: boolean
orderId?: OrderId
acceptedAt?: string
@@ -863,7 +863,7 @@ export type ExchangeSpecificMethod = 'foreign' | 'domestic'
export type ExchangeAccountKind = 'GENERAL' | 'JR_NISA'
export type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL'
export type ExchangeOrderPreview = {
export interface ExchangeOrderPreview {
currencyCode: string
currencyName?: string
side: ExchangeOrderSide
@@ -882,7 +882,7 @@ export type ExchangeOrderPreview = {
csrfToken: string
}
export type ExchangeOrderReceipt = {
export interface ExchangeOrderReceipt {
accepted: boolean
currencyCode?: string
side?: ExchangeOrderSide
@@ -891,7 +891,7 @@ export type ExchangeOrderReceipt = {
rawTitle?: string
}
export type ExchangeRateInfo = {
export interface ExchangeRateInfo {
currencyCode: string
side: ExchangeOrderSide
referenceExchangeRate?: string
@@ -910,7 +910,7 @@ export type ExchangeRateInfo = {
raw: Record<string, unknown>
}
export type ThemeInvestment = {
export interface ThemeInvestment {
id: ThemeId
name: string
issues: ThemeInvestmentIssue[]
@@ -933,7 +933,7 @@ export type ThemeInvestmentIssue = IssueRef & {
tradeTime?: string
}
export type ThemeInvestmentList = {
export interface ThemeInvestmentList {
themes: ThemeInvestment[]
buyingPowerTotal?: CurrencyAmount
isaBuyLimit?: CurrencyAmount
@@ -944,7 +944,7 @@ export type ThemeInvestmentList = {
error?: SbiMethodError
}
export type SbiMethodError = {
export interface SbiMethodError {
status?: string
code?: string
message?: string
+1 -1
View File
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "@repo/tsconfig/tsconfig.json",
"include": ["src/**/*.ts"]
}
+11
View File
@@ -0,0 +1,11 @@
{
"name": "@repo/tsconfig",
"version": "0.0.0",
"private": true,
"files": [
"tsconfig.json"
],
"exports": {
"./tsconfig.json": "./tsconfig.json"
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}