feat: introduce mnie

This commit is contained in:
Shotaro Nakamura
2026-06-21 21:37:07 +09:00
parent 614ea8a992
commit fed3ac1b61
104 changed files with 1815 additions and 218 deletions
+22
View File
@@ -0,0 +1,22 @@
{
"name": "@repo/mnie-types",
"private": true,
"type": "module",
"types": "./src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"import": "./src/index.ts"
}
},
"scripts": {
"clean": "rm -rf dist",
"typecheck": "tsc"
},
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
}
}
+2
View File
@@ -0,0 +1,2 @@
export type * from './types'
export type * from './methods'
+807
View File
@@ -0,0 +1,807 @@
import type {
AccountProfile,
AccountAssetsValuations,
AccountType,
Board,
BuyingPower,
CashPositionList,
ChartPeriod,
DepositType,
ExchangeAccountKind,
ExchangeOrderPreview,
ExchangeOrderReceipt,
ExchangeOrderSide,
ExchangeRateInfo,
ExchangeSellMethod,
ExchangeSpecificMethod,
DomesticMarket,
IssueCode,
IssueChart,
IssueSearchResult,
MarginPositionList,
MarginTradeSide,
MarketCode,
MarketIndex,
NewsList,
Order,
OrderId,
OrderKind,
OrderList,
OrderPreview,
StockOrderPreOrder,
OrderReceipt,
OrderStatus,
PositionId,
ProfitLossSummary,
Quote,
Ranking,
ThemeId,
ThemeInvestmentList,
TradeRecordList,
TradeSide,
Watchlist,
} from './types'
export type 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 = {
/** Start date for the inquiry range. */
from?: string
/** End date for the inquiry range. */
to?: string
}
export type IssueOptions = {
/** Issue code to request. */
issueCode: IssueCode
/** Market code to request. */
market: MarketCode
}
export type MarketIssueBoardPollingOptions = IssueOptions & {
/** Poll interval in seconds. Defaults to 5 seconds. */
intervalSeconds?: number
/** Stops the polling iterator when aborted. */
signal?: AbortSignal
}
export type IssueChartOptions = IssueOptions & {
/** Chart period. Defaults to daily candles. */
period?: ChartPeriod
/** Candle unit. Minute charts accept 1, 5, 10, or 15. Other periods use 1. */
unit?: number
/** Number of historical prices to request. Defaults to 120. */
count?: number
}
export type IssueSearchOptions = {
/** Search text, such as an issue code, name, or keyword. */
query: string
/** Market code to search. */
market: MarketCode
/** Maximum number of returned issues after client-side filtering. */
limit?: number
}
export type CashPositionOptions = PagingOptions & {
/** Filters cash positions by issue code. */
issueCode?: IssueCode
/** Filters cash positions by market code. */
market?: MarketCode
/** Filters cash positions by account type. */
accountType?: AccountType
}
export type MarginPositionOptions = PagingOptions & {
/** Filters margin positions by issue code. */
issueCode?: IssueCode
/** Filters margin positions by market code. */
market?: MarketCode
/** Filters margin positions by short or long side. */
side?: MarginTradeSide
/** Filters margin positions by account type. */
accountType?: AccountType
}
export type OrderInquiryOptions = PagingOptions &
DateRangeOptions & {
/** Filters order inquiry results by issue code. */
issueCode?: IssueCode
/** Filters order inquiry results by market code. */
market?: MarketCode
/** Filters order inquiry results by order status. */
status?: OrderStatus
}
export type OrderDetailOptions = {
/** Order number shown in order inquiry. */
orderNumber?: string
/** Order ID from order inquiry. For US stocks this is often `orderSubNo`. */
orderId?: OrderId
/** Issue code used to fetch the related security and quote details. */
issueCode?: IssueCode
/** Market code used to fetch the related security and quote details. */
market: MarketCode
}
export type TradeRecordInquiryOptions = OrderInquiryOptions & {
/** Filters trade records by account type. */
accountType?: AccountType
}
export type BoardOptions = IssueOptions & {
/** Account type used when requesting board-order information. */
accountType?: AccountType
/** Trading action used when requesting board-order information. */
side?:
| 'cashBuy'
| 'cashSell'
| 'marginOpen'
| 'marginOpenBuy'
| 'marginOpenSell'
| 'marginClose'
| 'marginCloseBuy'
| 'marginCloseSell'
}
export type StockOrderBaseOptions = {
/** Issue code to order. */
issueCode: IssueCode
/** Market code to order on. */
market: MarketCode
/** Previous market code sent with SOR orders. Defaults to the value returned at login. */
sorLastMarket?: MarketCode
/** Buy or sell side for the order. */
side: TradeSide
/** Account type used for the order. */
accountType?: AccountType
/** Order quantity. */
quantity: number
/** Deposit type used for the order. */
depositType?: DepositType
/** US stock settlement method. Defaults to yen settlement for foreign stock orders. */
foreignStockSettlementMethod?: 'yen' | 'foreign'
}
export type CashOrderPriceCondition =
| 'limit'
| 'limitAtOpen'
| 'limitAtClose'
| 'limitIoc'
| 'market'
| 'marketAtOpen'
| 'marketAtClose'
| 'marketIoc'
| 'funari'
export type CashOrderTerm = 'day' | 'week' | 'date'
export type CashOrderTriggerZone = 'above' | 'below'
export type CashOrderMethod = 'normal' | 'stop' | 'oco'
export type 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. */
openPrice: number | string
/** Quantity selected from the margin position record. */
quantity: number | string
/** Original new-trade date from the margin position record, in yyyyMMdd or yyyy-MM-dd format. */
orgNewTradeDate: string
/** Bargain market code from the margin position record. */
bargainMarketCode: MarketCode
}
export type StandardCashOrderOptions = StockOrderBaseOptions & {
/** Order price for limit and other price-based orders. */
price?: number
/** Order kind, such as market or limit. */
kind?: Exclude<OrderKind, 's'>
/** APK/MTS execution condition, such as 指値, 寄指, IOC成, or 不成. */
priceCondition?: CashOrderPriceCondition
/** Order validity. `date` requires `orderDate` in yyyyMMdd or yyyy-MM-dd format. */
orderTerm?: CashOrderTerm
/** Explicit validity date used when `orderTerm` is `date`. */
orderDate?: string
/** Special order method. `stop` sends SLO and `oco` sends OCO. */
orderMethod?: CashOrderMethod
/** Stop trigger direction used by stop/OCO orders. */
triggerZone?: CashOrderTriggerZone
/** Stop trigger price used by stop/OCO orders. */
triggerPrice?: number
/** Secondary execution condition used by OCO orders. */
secondaryPriceCondition?: CashOrderPriceCondition
/** Secondary order price used by OCO price-based conditions. */
secondaryPrice?: number
/** APK ippan margin payment-limit code returned by stock board/pre-order information. */
ippanMarginPaymentLimit?: string
}
export type SKabuOrderOptions = StockOrderBaseOptions & {
/** Places the cash order as an S-kabu order. S-kabu cannot specify a price. */
kind: 's'
/** APK pre-order market for the underlying issue. The live S-kabu order still sends `market: "STK"`. */
preOrderMarket?: MarketCode
/** S-kabu cannot specify a price. */
price?: never
}
export type CashOrderOptions = StandardCashOrderOptions | SKabuOrderOptions
export type CashOrderPreOrderOptions = Pick<
StockOrderBaseOptions,
'issueCode' | 'market' | 'side' | 'accountType' | 'depositType'
> & {
/** Requests the APK S-kabu pre-order route constraints for this issue. */
kind?: 's'
/** APK pre-order market for S-kabu checks. The live S-kabu order still sends `market: "STK"`. */
preOrderMarket?: MarketCode
}
export type MarginOpenTradeType =
| 'standard'
| 'generalBuy'
| 'generalSellShort'
| 'generalSellInventoryLimited'
| 'generalSellInventoryUnlimited'
| 'day'
| 'hyper'
export type MarginOpenOrderPreOrderOptions = Pick<
StockOrderBaseOptions,
'issueCode' | 'market' | 'side' | 'accountType' | 'depositType'
>
export type MarginOpenOrderOptions = StandardCashOrderOptions & {
/** APK margin-open trade type. Required because the mobile payload has no safe default. */
marginTradeType: MarginOpenTradeType
/** APK ippan margin payment-limit code, when returned by board/pre-order information. */
ippanMarginPaymentLimit?: string
}
export type MarginCloseTradeType = 'sixMonth' | 'noLimit' | 'oneDay' | 'fifteenDay'
export type MarginCloseOrderPreOrderOptions = Pick<
StockOrderBaseOptions,
'issueCode' | 'market' | 'side' | 'accountType' | 'depositType'
> & {
/** APK margin-close trade type used by the mobile pre-order request. */
marginCloseTradeType?: MarginCloseTradeType
}
export type MarginClosePositionOrder =
| 'profitFirst'
| 'lossFirst'
| 'newestFirst'
| 'oldestFirst'
| 'specify'
export type ActualDeliveryKind = 'genbiki' | 'genwatashi'
export type ActualDeliveryOrderOptions = {
/** Issue code to deliver. */
issueCode: IssueCode
/** Market code for the issue. */
market: MarketCode
/** Account type used for the order. */
accountType?: AccountType
/** Order quantity. */
quantity: number
/** Deposit type used for the order. */
depositType?: DepositType
/** Order price for price-based actual-delivery requests. */
price?: number
/** Actual-delivery action: `genbiki` for 現引, `genwatashi` for 現渡. */
kind: ActualDeliveryKind
/** Position ID to deliver. */
positionId?: PositionId
/** Margin position records selected for genbiki/genwatashi delivery. */
marginPositions?: StockOrderMarginPosition[]
/** APK ippan margin payment-limit code returned by stock board/pre-order information. */
ippanMarginPaymentLimit?: string
}
export type ActualDeliveryOrderPreOrderOptions = Pick<
ActualDeliveryOrderOptions,
'issueCode' | 'market' | 'accountType' | 'depositType' | 'kind'
>
export type PlaceCashOrderOptions = CashOrderOptions & {
/** Confirmation ID returned by the confirmation step. */
confirmationId?: string
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live order. */
allowTrading?: true
}
export type PlaceMarginOpenOrderOptions = MarginOpenOrderOptions & {
/** Confirmation ID returned by the confirmation step. */
confirmationId?: string
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live margin open order. */
allowTrading?: true
}
export type PlaceActualDeliveryOrderOptions = ActualDeliveryOrderOptions & {
/** Confirmation ID returned by the confirmation step. */
confirmationId?: string
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live actual-delivery order. */
allowTrading?: true
}
export type OrderCorrectionOptions = {
/** Order number shown in order inquiry. Required by the mobile pre-correction route. */
orderNumber?: string
/** Order ID to correct. */
orderId: OrderId
/** Issue code from the pre-correction response. */
issueCode?: IssueCode
/** Market code from the pre-correction response. */
market?: MarketCode
/** Original trade ID code. */
tradeId?: string
/** Additional correction flag used by the mobile MTS route. */
correctionType?: string
/** Original order status code from the pre-correction response. */
status?: string
/** Original RBE order status code from the pre-correction response. */
rbeOrderStatus?: string
/** Display deposit type text from the original order. */
depositTypeText?: string
/** Primary order method for correction. */
orderMethod?: CashOrderMethod
/** Corrected primary execution condition. */
priceCondition?: CashOrderPriceCondition
/** Stop trigger direction for correction. */
triggerZone?: CashOrderTriggerZone
/** Stop trigger price for correction. */
triggerPrice?: number
/** Secondary/OCO execution condition for correction. */
secondaryPriceCondition?: CashOrderPriceCondition
/** Secondary/OCO price for correction. */
secondaryPrice?: number
/** IFD follow-up execution condition for IF/IFDOCO correction. */
ifdPriceCondition?: CashOrderPriceCondition
/** IFD follow-up price for IF/IFDOCO correction. */
ifdPrice?: number
/** IFD follow-up special order method for correction. */
ifdOrderMethod?: CashOrderMethod
/** IFD follow-up stop trigger direction for correction. */
ifdTriggerZone?: CashOrderTriggerZone
/** IFD follow-up stop trigger price for correction. */
ifdTriggerPrice?: number
/** IFD follow-up secondary/OCO execution condition for correction. */
ifdSecondaryPriceCondition?: CashOrderPriceCondition
/** IFD follow-up secondary/OCO price for correction. */
ifdSecondaryPrice?: number
/** Mobile correction control flag. Defaults to normal mobile value when omitted. */
correctionControlFlag?: '1' | '2'
/** Corrected order quantity. */
quantity?: number
/** Corrected order price. */
price?: number
}
export type PlaceOrderCorrectionOptions = OrderCorrectionOptions & {
/** Explicitly allows sending a live correction request. */
allowTrading?: true
}
export type OrderCancelOptions = {
/** Order number shown in order inquiry. */
orderNumber: string
/** Original order ID shown in order inquiry. */
orderId?: OrderId
/** Original issue code shown in order inquiry. */
issueCode?: IssueCode
/** Original market code shown in order inquiry. */
market?: MarketCode
/** Original trade ID code. Defaults to cash stock when omitted. */
tradeId?: string
/** Additional cancel flag used by the mobile MTS route. */
cancelType?: string
}
export type PlaceOrderCancelOptions = OrderCancelOptions & {
/** Trading password used by SBI to submit the cancellation. */
tradePassword?: string
/** Explicitly allows sending a live cancellation request. */
allowTrading?: true
}
export type ExchangeOrderOptions = {
/** Currency code, such as USD. */
currencyCode: string
/** Buy or sell the foreign currency. */
side: ExchangeOrderSide
/** Quantity entered on the SBI exchange order screen. */
tradeQuantity: number | string
/** `foreign` means foreign-currency quantity; `domestic` means yen amount. */
specificMethod?: ExchangeSpecificMethod
/** SBI account kind. Defaults to GENERAL. */
accountKind?: ExchangeAccountKind
/** Required for sell orders when using the exchange web flow. */
sellMethod?: ExchangeSellMethod
/** Hidden order amount posted to SBI. Defaults to tradeQuantity for foreign quantity orders. */
orderAmount?: number | string
/** Trading password used by SBI. Defaults to session tradePassword. */
tradePassword?: string
}
export type ExchangeRateOptions = {
/** Currency code, such as USD. */
currencyCode: string
/** Buy or sell the foreign currency. */
side: ExchangeOrderSide
}
export type PlaceExchangeOrderOptions = ExchangeOrderOptions & {
/** Explicitly allows sending a live exchange order. */
allowTrading?: true
}
export type MarginCloseOrderOptions = StandardCashOrderOptions & {
/** Position ID to close. */
positionId?: PositionId
/** APK margin-close trade type. Required because the mobile payload has no safe default. */
marginCloseTradeType: MarginCloseTradeType
/** Margin position records selected for specified close orders. */
marginPositions?: StockOrderMarginPosition[]
/** APK close-position ordering used by summary close orders. */
marginClosePositionOrder?: MarginClosePositionOrder
}
export type PlaceMarginCloseOrderOptions = MarginCloseOrderOptions & {
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live margin close order. */
allowTrading?: true
}
export type MarginCloseSummaryOrderOptions = MarginCloseOrderOptions
export type PlaceMarginCloseSummaryOrderOptions = MarginCloseSummaryOrderOptions & {
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live margin close summary order. */
allowTrading?: true
}
export type IfdOrderOptions = StandardCashOrderOptions & {
/** Product to use for the first IFD leg. Defaults to cash. */
tradeType?: 'cash' | 'marginOpen'
/** APK margin-open trade type for the first leg when `tradeType` is `marginOpen`. */
marginTradeType?: MarginOpenTradeType
/** APK ippan margin payment-limit code for the first leg. */
ippanMarginPaymentLimit?: string
/** Execution condition for the IFD follow-up leg. */
ifdPriceCondition?: CashOrderPriceCondition
/** Order price for the IFD follow-up leg. */
ifdPrice?: number
/** Validity for the IFD follow-up leg. */
ifdOrderTerm?: CashOrderTerm
/** Explicit validity date for the IFD follow-up leg. */
ifdOrderDate?: string
/** Special order method for the IFD follow-up leg. */
ifdOrderMethod?: CashOrderMethod
/** Stop trigger direction for the IFD follow-up leg. */
ifdTriggerZone?: CashOrderTriggerZone
/** Stop trigger price for the IFD follow-up leg. */
ifdTriggerPrice?: number
/** Secondary OCO execution condition for IFDOCO. */
ifdSecondaryPriceCondition?: CashOrderPriceCondition
/** Secondary OCO price for IFDOCO. */
ifdSecondaryPrice?: number
}
export type PlaceIfdOrderOptions = IfdOrderOptions & {
/** Confirmation ID returned by the confirmation step. */
confirmationId?: string
/** APK confirmation-screen omission flag. Only valid for live submit calls. */
omitConfirmation?: boolean
/** Explicitly allows sending a live IFD order. */
allowTrading?: true
}
export type ThemeInvestmentOrderOptions = {
/** Theme ID for the theme investment order. */
themeId: ThemeId
/** Theme set year/month (`theme_set_yyyymm`) from the mobile APK handoff. */
themeSetYyyymm: string
/** Theme course (`theme_course`) from the mobile APK handoff. */
themeCourse: number | string
/** Buy or sell side for the order. */
side: TradeSide
/** Account/deposit type used for the theme investment order. */
accountType?: AccountType
/** Deposit type used for the theme investment order. */
depositType?: DepositType
/** Component stock orders selected by the mobile theme investment flow. */
components: ThemeInvestmentOrderComponent[]
/** Order amount for the theme investment order. */
amount?: number
}
export type ThemeInvestmentOrderComponent = {
/** Component stock issue code. */
issueCode: IssueCode
/** Component order quantity. */
quantity: number | string
}
export type 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 = {
/** Theme ID for the theme investment order target. */
themeId: ThemeId
/** Theme name from the mobile theme investment flow, when available. */
themeName?: string
/** Exchange code used for all component stocks in the mobile pre-order call. */
exchangeCode: MarketCode
/** Component stocks selected by the mobile theme investment flow. */
components: ThemeInvestmentPreOrderComponent[]
}
export type PlaceThemeInvestmentOrderOptions = ThemeInvestmentOrderOptions & {
/** Explicitly allows sending a live theme investment order. */
allowTrading?: true
}
export type AccountPowerOptions = {
/** Fetches margin-account collateral details. Disable this for accounts without margin trading. */
includeMarginAccount?: boolean
}
export type ProfitLossOptions = {
/** Market to fetch profit/loss for. Omit for domestic cash/margin summary. */
market?: MarketCode
}
export interface SbiClientMethodSession {
/** Returns the current authenticated session profile. */
profile(): Promise<AccountProfile>
}
export interface SbiClientMethodAccountPower {
/** Fetches buying power, margin buying power, withdrawable amount, and related account power values. */
buyingPower(options?: AccountPowerOptions): Promise<BuyingPower>
/** Fetches the collateral ratio and related margin collateral details. */
collateralRatio(options?: AccountPowerOptions): Promise<BuyingPower>
}
export interface SbiClientMethodAccountPositions {
/** Fetches cash positions. */
cash(options?: CashPositionOptions): Promise<CashPositionList>
/** Fetches the alternate cash-position list used by the mobile app. */
cashDetail(options?: CashPositionOptions): Promise<CashPositionList>
/** Fetches cash positions for a specific issue. */
cashForIssue(options: IssueOptions): Promise<CashPositionList>
/** Fetches margin positions. */
margin(options?: MarginPositionOptions): Promise<MarginPositionList>
/** Fetches the alternate margin-position list used by the mobile app. */
marginDetail(options?: MarginPositionOptions): Promise<MarginPositionList>
/** Fetches margin positions for a specific issue. */
marginForIssue(options: IssueOptions): Promise<MarginPositionList>
/** Fetches margin positions for a specific issue aggregated by issue. */
marginSummaryForIssue(options: IssueOptions): Promise<MarginPositionList>
/** Fetches individual margin positions for a specific issue. */
marginDetailsForIssue(options: IssueOptions): Promise<MarginPositionList>
/** Fetches margin positions available for close orders. */
closeableMargin(options: MarginPositionOptions): Promise<MarginPositionList>
/** Fetches margin positions available for stock delivery. */
deliverableMargin(options: MarginPositionOptions): Promise<MarginPositionList>
}
export interface SbiClientMethodAccountProfitLoss {
/** Fetches the unrealized profit and loss summary for cash and margin positions. */
unrealized(options?: ProfitLossOptions): Promise<ProfitLossSummary>
}
export interface SbiClientMethodAccountAssets {
/** Fetches current My Assets valuations from the SBI main site. */
current(): Promise<AccountAssetsValuations>
}
export interface SbiClientMethodAccount {
/** Returns the current account profile. */
profile(): Promise<AccountProfile>
/** Methods for fetching My Assets values from the SBI main site. */
assets: SbiClientMethodAccountAssets
/** Methods for fetching buying power and collateral information. */
power: SbiClientMethodAccountPower
/** Methods for fetching cash and margin positions. */
positions: SbiClientMethodAccountPositions
/** Methods for fetching profit and loss information. */
profitLoss: SbiClientMethodAccountProfitLoss
}
export interface SbiClientMethodMarketIssue {
/** Searches domestic issues by code, name, or keyword. */
search(options: IssueSearchOptions): Promise<IssueSearchResult>
/** Fetches issue suggestions for partial input. */
suggest(options: IssueSearchOptions): Promise<IssueSearchResult>
/** Fetches prices accepted as order input for an issue. */
allowedPrices(options: IssueOptions): Promise<Quote>
/** Fetches board information for an issue. */
board(options: IssueOptions): Promise<Board>
/** Polls board information for an issue using the same endpoint as `board`. */
pollBoard(options: MarketIssueBoardPollingOptions): AsyncIterableIterator<Board>
/** Fetches historical chart prices for an issue. */
chart(options: IssueChartOptions): Promise<IssueChart>
/** Fetches open orders for an issue. */
openOrders(options: IssueOptions): Promise<OrderList>
/** Fetches board and issue information useful before placing an order. */
tradingInfo(options: BoardOptions): Promise<Board>
}
export interface SbiClientMethodMarketIndex {
/** Fetches major market indexes. */
major(): Promise<MarketIndex[]>
}
export interface SbiClientMethodMarketRanking {
/** Fetches market rankings. */
market(): Promise<Ranking>
/** Fetches sector rankings. */
sector(): Promise<Ranking>
/** Fetches SBI-provided rankings. */
sbi(): Promise<Ranking>
}
export interface SbiClientMethodMarket {
/** Methods for fetching issue quotes, boards, and order-related market information. */
issue: SbiClientMethodMarketIssue
/** Methods for fetching market index information. */
index: SbiClientMethodMarketIndex
/** Fetches the domestic market overview. */
overview(): Promise<DomesticMarket>
/** Methods for fetching ranking information. */
ranking: SbiClientMethodMarketRanking
}
export interface SbiClientMethodNews {
/** Fetches news items. */
list(): Promise<NewsList>
}
export interface SbiClientMethodWatchlist {
/** Fetches registered watchlists. */
list(): Promise<Watchlist[]>
}
export interface SbiClientMethodOrderInquiry {
/** Fetches orders executed today. */
executionsToday(options?: OrderInquiryOptions): Promise<OrderList>
/** Fetches open or recently active orders. */
open(options?: OrderInquiryOptions): Promise<OrderList>
/** Fetches a detailed order record. Currently implemented for US stock orders. */
detail(options: OrderDetailOptions): Promise<Order>
/** Fetches trade records. Currently implemented for US stock trades. */
tradeRecords(options: TradeRecordInquiryOptions): Promise<TradeRecordList>
}
export interface SbiClientMethodCashOrder {
/** Fetches APK cash pre-order information and selectable constraints. */
preOrder(options: CashOrderPreOrderOptions): Promise<StockOrderPreOrder>
/** Estimates a cash order without submitting a live order. */
estimate(options: CashOrderOptions): Promise<OrderPreview>
/** Places a live cash order. Requires `allowTrading: true`. */
place(options: PlaceCashOrderOptions): Promise<OrderReceipt>
/** Estimates a cash order correction without submitting a live correction. */
estimateCorrection(options: OrderCorrectionOptions): Promise<OrderPreview>
/** Estimates the mobile correction-confirmation route without submitting a live correction. */
estimateCorrectionConfirm(options: OrderCorrectionOptions): Promise<OrderPreview>
/** Places a live cash order correction. Requires `allowTrading: true`. */
placeCorrection(options: PlaceOrderCorrectionOptions): Promise<OrderReceipt>
/** Estimates a cash order cancellation without submitting a live cancellation. */
estimateCancel(options: OrderCancelOptions): Promise<OrderPreview>
/** Places a live cash order cancellation. Requires `allowTrading: true`. */
placeCancel(options: PlaceOrderCancelOptions): Promise<OrderReceipt>
}
export interface SbiClientMethodMarginOrder {
/** Fetches APK margin-open pre-order information and selectable constraints. */
preOrderOpen(options: MarginOpenOrderPreOrderOptions): Promise<StockOrderPreOrder>
/** Estimates a margin-open order without submitting a live order. */
estimateOpen(options: MarginOpenOrderOptions): Promise<OrderPreview>
/** Places a live margin-open order. Requires `allowTrading: true`. */
open(options: PlaceMarginOpenOrderOptions): Promise<OrderReceipt>
/** Fetches APK margin-close pre-order information and selectable constraints. */
preOrderClose(options: MarginCloseOrderPreOrderOptions): Promise<StockOrderPreOrder>
/** Estimates a margin close order without submitting a live order. */
estimateClose(options: MarginCloseOrderOptions): Promise<OrderPreview>
/** Places a live margin close order. Requires `allowTrading: true`. */
close(options: PlaceMarginCloseOrderOptions): Promise<OrderReceipt>
/** Estimates a margin close order by position summary without submitting a live order. */
estimateCloseSummary(options: MarginCloseOrderOptions): Promise<OrderPreview>
/** Places a live margin close order by position summary. Requires `allowTrading: true`. */
closeSummary(options: PlaceMarginCloseOrderOptions): Promise<OrderReceipt>
/** Estimates a mobile margin close summary order without submitting a live order. */
estimateSummary(options: MarginCloseSummaryOrderOptions): Promise<OrderPreview>
/** Places a mobile margin close summary order. Requires `allowTrading: true`. */
placeSummary(options: PlaceMarginCloseSummaryOrderOptions): Promise<OrderReceipt>
/** Fetches APK genbiki/genwatashi pre-order information and selectable constraints. */
preOrderActualDelivery(options: ActualDeliveryOrderPreOrderOptions): Promise<StockOrderPreOrder>
/** Estimates a genbiki/genwatashi actual-delivery order without submitting a live order. */
estimateActualDelivery(options: ActualDeliveryOrderOptions): Promise<OrderPreview>
/** Places a genbiki/genwatashi actual-delivery order. Requires `allowTrading: true`. */
actualDelivery(options: PlaceActualDeliveryOrderOptions): Promise<OrderReceipt>
}
export interface SbiClientMethodIfdOrder {
/** Estimates an IFD order without submitting a live order. */
estimate(options: IfdOrderOptions): Promise<OrderPreview>
/** Places a live IFD order. Requires `allowTrading: true`. */
place(options: PlaceIfdOrderOptions): Promise<OrderReceipt>
/** Estimates an IFD order correction without submitting a live correction. */
estimateCorrection(options: OrderCorrectionOptions): Promise<OrderPreview>
/** Places a live IFD order correction. Requires `allowTrading: true`. */
placeCorrection(options: PlaceOrderCorrectionOptions): Promise<OrderReceipt>
/** Estimates an IFD order cancellation without submitting a live cancellation. */
estimateCancel(options: OrderCancelOptions): Promise<OrderPreview>
/** Places a live IFD order cancellation. Requires `allowTrading: true`. */
placeCancel(options: PlaceOrderCancelOptions): Promise<OrderReceipt>
}
export interface SbiClientMethodThemeInvestmentOrder {
/** Fetches APK theme investment pre-order targets for selected component stocks. */
list(options: ThemeInvestmentPreOrderOptions): Promise<ThemeInvestmentList>
/** Estimates a theme investment order without submitting a live order. */
estimate(options: ThemeInvestmentOrderOptions): Promise<OrderPreview>
/** Places a live theme investment order. Requires `allowTrading: true`. */
place(options: PlaceThemeInvestmentOrderOptions): Promise<OrderReceipt>
}
export interface SbiClientMethodExchangeOrder {
/** Fetches the current exchange-order input rate and limits. */
rate(options: ExchangeRateOptions): Promise<ExchangeRateInfo>
/** Estimates an exchange order without submitting a live order. */
estimate(options: ExchangeOrderOptions): Promise<ExchangeOrderPreview>
/** Places a live exchange order. Requires `allowTrading: true`. */
place(options: PlaceExchangeOrderOptions): Promise<ExchangeOrderReceipt>
}
export interface SbiClientMethodOrders {
/** Methods for order inquiries. */
inquiry: SbiClientMethodOrderInquiry
/** Methods for estimating, placing, and correcting cash orders. */
cash: SbiClientMethodCashOrder
/** Methods for estimating and placing margin orders. */
margin: SbiClientMethodMarginOrder
/** Methods for estimating, placing, and correcting IFD orders. */
ifd: SbiClientMethodIfdOrder
/** Methods for estimating and placing theme investment orders. */
themeInvestment: SbiClientMethodThemeInvestmentOrder
/** Methods for estimating and placing exchange orders. */
exchange: SbiClientMethodExchangeOrder
}
export interface SbiClientMethods {
/** Session-related methods. */
session: SbiClientMethodSession
/** Methods for account profile, buying power, positions, and profit and loss. */
account: SbiClientMethodAccount
/** Methods for market overviews, issues, indexes, and rankings. */
market: SbiClientMethodMarket
/** News methods. */
news: SbiClientMethodNews
/** Watchlist methods. */
watchlist: SbiClientMethodWatchlist
/** Methods for order history, estimates, live placement, and corrections. */
orders: SbiClientMethodOrders
}
+951
View File
@@ -0,0 +1,951 @@
export type WebAuthnAlgorithm = -7 | -257
export type WebAuthnUserVerification = 'required' | 'preferred' | 'discouraged'
export type WebAuthnTransport = 'ble' | 'hybrid' | 'internal' | 'nfc' | 'usb'
export type WebAuthnJwk = {
kty: string
crv?: string
x?: string
y?: string
d?: string
n?: string
e?: string
key_ops?: string[]
ext?: boolean
[key: string]: unknown
}
export type StoredWebAuthnCredentialSecret = {
privateKey: {
format: 'jwk'
jwk: WebAuthnJwk
}
cosePrivateKey?: string
registration?: {
attestationObject?: string
clientDataJSON?: string
}
}
export type StoredWebAuthnCredential = {
version: 1
kind: 'webauthn-credential'
provider: 'sbi-sec'
rpId: string
origin: string
credentialId: string
userHandle?: string
alg: WebAuthnAlgorithm
publicKey: {
format: 'jwk'
jwk: WebAuthnJwk
}
authenticator: {
aaguid?: string
signCount: number
discoverable: boolean
userVerification: WebAuthnUserVerification
transports?: WebAuthnTransport[]
backupEligible?: boolean
backupState?: boolean
}
secret: {
encrypted: true
format: 'jwe-like-v1'
kdf: {
name: 'argon2id' | 'scrypt'
salt: string
params: Record<string, unknown>
}
cipher: {
name: 'AES-256-GCM'
nonce: string
aad: string
ciphertext: string
tag: string
}
}
createdAt: string
updatedAt: string
}
export type PlaintextStoredWebAuthnCredential = Omit<StoredWebAuthnCredential, 'secret'> & {
label?: string
secretPlaintext: StoredWebAuthnCredentialSecret
}
export type PasskeyLoginResponse = {
type: 'passkey-login-response'
requestUrl: string
status: number
body: ArrayBuffer
text: string
accessToken?: string
header: {
sessionId: string
trCode: string
resultCode: string
} | null
}
export type ForeignStockEndpointConfig = {
baseUrl?: string
restUrl: string
graphqlBffUrl: string
graphqlIntUrl: string
userAgent?: string
}
export type ForeignStockSession = {
endpoints: ForeignStockEndpointConfig
ssoToken?: string
sessionId?: string
accountId?: string
marketPriceHash?: string
candleHash?: string
loginAuthenticated?: boolean
}
export type MainSiteAuthCache = {
baseUrl: string
assetsUrl: string
cookieHeader: string
authenticatedAt: string
}
export type MainSiteSession = {
baseUrl?: string
etGatePath?: string
assetsValuationsPath?: string
exchangeOrderInputPath?: string
exchangeOrderPasswordPath?: string
exchangeOrderConfirmPath?: string
exchangeOrderCompletePath?: string
auth?: MainSiteAuthCache
authPromise?: Promise<MainSiteAuthCache>
}
export type SbiSession = {
mtsBaseUrl: string
izanagiBaseUrl?: string
foreignStock?: ForeignStockSession
mainSite?: MainSiteSession
profile: AccountProfile
loginResponse: PasskeyLoginResponse
tradePassword?: string
deviceIdRegistered?: boolean
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type LoginWithPasskeyOptions = {
passkeyCredential: PlaintextStoredWebAuthnCredential
authBaseUrl?: string
mtsBaseUrl?: string
izanagiBaseUrl?: string
foreignStockBaseUrl?: string
usStockBaseUrl?: string
foreignStockRestUrl?: string
foreignStockGraphqlBffUrl?: string
foreignStockGraphqlIntUrl?: string
foreignStockUserAgent?: string
mainSiteBaseUrl?: string
mainSiteEtGatePath?: string
mainSiteAssetsValuationsPath?: string
mainSiteExchangeOrderInputPath?: string
mainSiteExchangeOrderPasswordPath?: string
mainSiteExchangeOrderConfirmPath?: string
mainSiteExchangeOrderCompletePath?: string
}
export type SbiClientOptions = {
tradePassword?: string
deviceId?: string
tradeAuthentication?: SbiTradeAuthenticationOptions
}
export type SbiTradeAuthenticationRequest = {
type: 'phone'
telNo?: string
phoneNo?: string
sbiCallNo?: string
authLimitTime?: string
}
export type SbiTradeAuthenticationOptions = {
onRequired?: (request: SbiTradeAuthenticationRequest) => void | Promise<void>
confirmAttempts?: number
confirmIntervalMs?: number
}
export type IssueCode = string
export type DomesticMarketCode = 'XTKS' | 'XNGO' | 'XFKA' | 'XSAP'
export type SKabuMarketCode = 'STK'
export type UsStockMarketCode = 'XNAS' | 'XNYS' | 'ARCX'
export type MarketCode = DomesticMarketCode | SKabuMarketCode | UsStockMarketCode
export type OrderId = string
export type WatchlistId = string
export type PositionId = string
export type ThemeId = string
export type CurrencyAmount = {
value: number | null
text: string
currency: 'JPY' | 'USD'
}
export type PercentValue = {
value: number | null
text: string
}
export type SignedTextValue = {
value: number | null
text: string
sign?: 'positive' | 'negative' | 'zero'
}
export type AccountAssetsValuationSummary = {
assetsErrorType: unknown
valuation: number | null
netChange: number | null
percentChange: number | null
monthOnMonth: number | null
monthOnMonthRatio: unknown
profitLoss: number | null
profitLossRate: number | null
acquisitionCost: number | null
}
export type AccountAssetsValuationDetail = AccountAssetsValuationSummary & {
category: string
compositionRatio: number | null
}
export type AccountAssetsValuations = {
fetchedAt: string
summary: AccountAssetsValuationSummary
summaryWithoutDeposit: AccountAssetsValuationSummary
summaryWithoutIdeco?: AccountAssetsValuationSummary
summaryWithoutDepositAndIdeco?: AccountAssetsValuationSummary
summaryDetails: AccountAssetsValuationDetail[]
summaryDetailsWithoutDeposit: AccountAssetsValuationDetail[]
summaryDetailsWithoutIdeco: AccountAssetsValuationDetail[]
summaryDetailsWithoutDepositAndIdeco: AccountAssetsValuationDetail[]
}
export type AccountType =
| 'general'
| 'specific'
| 'growthInvestment'
| 'nisa'
| 'juniorNisa'
| 'unknown'
export type DepositType =
| 'general'
| 'specific'
| 'growthInvestment'
| 'nisa'
| 'juniorNisa'
| 'unknown'
export type TradeSide = 'buy' | 'sell'
export type MarginTradeSide = 'buy' | 'sell'
export type OrderStatus = 'open' | 'executed' | 'cancelled' | 'expired' | 'rejected' | 'unknown'
export type OrderKind = 'market' | 'limit' | 'stop' | 'oco' | 'ifd' | 'ifdo' | 's' | 'unknown'
export type LoginStatus =
| 'success'
| 'invalidUser'
| 'tradeForbidden'
| 'locked'
| 'fidoAuthorizationIncorrect'
| 'fidoAuthorization'
| 'passwordChangeRequired'
| 'unknown'
export type LoginType = 'passkey' | 'password' | 'unknown'
export type SpecificAccountType =
| 'withHolding'
| 'withoutHolding'
| 'nonSpecific'
| 'notApply'
| 'unknown'
export type IsaAccountType =
| 'nisaTradeForbidden'
| 'oldNisaTradePermitted'
| 'newNisaTradePermitted'
| 'nisaTradePermitted'
| 'unknown'
export type IssueRef = {
code: IssueCode
market?: MarketCode
name?: string
}
export type IssueSearchItem = IssueRef & {
extract?: string
extractWord?: string
boldFrom?: string
boldTo?: string
hitString?: string
}
export type IssueSearchStatus = 'success' | 'searchError' | 'tooManyResults' | 'unknown'
export type IssueSearchResult = {
status?: string
statusText: IssueSearchStatus
issues: IssueSearchItem[]
}
export type ChartPeriod = 'minute' | 'day' | 'week' | 'month'
export type ChartPrice = {
dateTime: string
open: CurrencyAmount
high: CurrencyAmount
low: CurrencyAmount
close: CurrencyAmount
volume?: number | null
}
export type IssueChart = {
issue: IssueRef
period: ChartPeriod
unit: number
prices: ChartPrice[]
previousClose?: CurrencyAmount
currentPrice?: CurrencyAmount
highPrice?: CurrencyAmount
lowPrice?: CurrencyAmount
latestDateTime?: string
error?: SbiMethodError
}
export type SessionInfo = {
sessionId: string
loginType: LoginType
resultCode: string
}
export type AccountProfile = {
session: SessionInfo
branchCode?: string
butenCode?: string
accountNumber?: string
userId?: string
loginStatus?: LoginStatus
loginType?: LoginType
accountType?: AccountType
specificAccountType?: SpecificAccountType
hasMarginAccount?: boolean
marginAccount?: string
corporateFlag?: string
commissionPlan?: string
expireDate?: string
lastLoginDate?: string
lastLoginTime?: string
tradingPassword?: string
fxShareCol?: string
fullTerm?: string
fullAccount?: string
securityAuthenticationResponseCode?: string
fidoResponseCode?: string
passkeyStatus?: string
trId?: string
txId?: string
actionToken?: string
nisa?: {
enabled: boolean
tradePermitted?: boolean
juniorEnabled?: boolean
accountType?: IsaAccountType
jrNisaAccount?: string
jrNisaSpecific?: SpecificAccountType
jrNisaSeigen?: string
}
sor?: {
defaultEnabled?: boolean
defaultCode?: string
lastMarket?: MarketCode
juniorNisaLastMarket?: MarketCode
}
notices?: {
hasImportantNotice?: boolean
importantNoticeFlag?: string
count?: number
}
restrictions?: {
tradeRestricted?: boolean
restrictedTradeFlag?: string
message?: string
}
deficit?: {
hasMessage?: boolean
messageFlag?: string
message?: string
}
maintenance?: {
referenceable?: boolean
referenceableMaintenanceFlag?: string
}
}
export type BuyingPower = {
cashBuyingPower?: CurrencyAmount
marginBuyingPower?: CurrencyAmount
withdrawableAmount?: CurrencyAmount
collateralValue?: CurrencyAmount
collateralRatio?: PercentValue
sbiHybridDepositBalance?: CurrencyAmount
noticeMessage?: string
records?: CollateralRatioRecord[]
error?: SbiMethodError
}
export type CollateralRatioRecord = {
marginRequirements?: CurrencyAmount
referenceMarginRequirements?: CurrencyAmount
collateralRatioCash?: CurrencyAmount
substituteSecuritiesValuationAmount?: CurrencyAmount
unsettledPositionLoss?: SignedTextValue
unsettledPositionLossFlag?: string
settlementLoss?: SignedTextValue
settlementLossFlag?: string
paymentExpenses?: SignedTextValue
paymentExpensesFlag?: string
actualCollateral?: CurrencyAmount
positionAmount?: CurrencyAmount
sbiHybridDepositBalance?: CurrencyAmount
minimumCollateral?: CurrencyAmount
}
export type CashPosition = {
issue: IssueRef
accountType?: AccountType
depositType?: DepositType
depositTypeCode?: string
depositTypeText?: string
quantity: number | null
availableQuantity?: number | null
unexecutedOrderQuantity?: number | null
averagePrice?: CurrencyAmount
purchasePrice?: CurrencyAmount
/** Current unit price, not multiplied by quantity. */
currentPrice?: CurrencyAmount
priceText?: string
/** Total position valuation amount. For cash positions this is quantity-adjusted. */
marketValue?: CurrencyAmount
presentValueFlag?: string
/** Raw SBI valuation amount. Kept for source compatibility; prefer `marketValue` for totals. */
valuationPrice?: CurrencyAmount
valuationPriceChange?: SignedTextValue
valuationPriceChangeRate?: PercentValue
valuationPriceChangeFlag?: string
profitLoss?: SignedTextValue
profitLossRate?: PercentValue
profitLossFlag?: string
holdingCategory?: string
accountInformation?: string
}
export type CashPositionList = {
positions: CashPosition[]
index?: number
totalCount?: number
totalMarketValue?: CurrencyAmount
totalProfitLoss?: SignedTextValue
totalProfitLossRate?: PercentValue
totalProfitLossFlag?: string
hasMore?: boolean
error?: SbiMethodError
}
export type MarginPosition = {
id?: PositionId
issue: IssueRef
side: MarginTradeSide
sideText?: string
accountType?: AccountType
tradeKind?: string
quantity: number | null
availableCloseQuantity?: number | null
unexecutedOrderQuantity?: number | null
openPrice?: CurrencyAmount
openAmount?: CurrencyAmount
/** Current unit price or rate, not multiplied by quantity. */
currentPrice?: CurrencyAmount
rate?: CurrencyAmount
/** Total position valuation amount when provided by SBI. */
marketValue?: CurrencyAmount
presentValueFlag?: string
/** Raw SBI valuation amount. Prefer `marketValue` when calculating totals. */
valuationPrice?: CurrencyAmount
valuationPriceChange?: SignedTextValue
valuationPriceChangeRate?: PercentValue
valuationPriceChangeFlag?: string
profitLoss?: SignedTextValue
profitLossRate?: PercentValue
profitLossFlag?: string
openDate?: string
dueDate?: string
dueDateCode?: string
dueDateText?: string
depositTypeText?: string
cost?: CurrencyAmount
commission?: CurrencyAmount
managementFee?: CurrencyAmount
nameTransferFee?: CurrencyAmount
interest?: CurrencyAmount
backwardation?: CurrencyAmount
collateralRatio?: PercentValue
bargainMarketCode?: string
bargainMarket?: string
}
export type MarginPositionList = {
positions: MarginPosition[]
index?: number
totalCount?: number
totalMarketValue?: CurrencyAmount
totalProfitLoss?: SignedTextValue
totalProfitLossRate?: PercentValue
totalProfitLossFlag?: string
hasMore?: boolean
error?: SbiMethodError
}
export type ProfitLossSummary = {
cash?: SignedTextValue
margin?: SignedTextValue
total?: SignedTextValue
totalRate?: PercentValue
error?: SbiMethodError
}
export type Quote = {
issue: IssueRef
price?: CurrencyAmount
change?: SignedTextValue
changeRate?: PercentValue
changeFlag?: string
open?: CurrencyAmount
high?: CurrencyAmount
low?: CurrencyAmount
previousClose?: CurrencyAmount
volume?: number | null
timestamp?: string
nominalPrices?: CurrencyAmount[]
error?: SbiMethodError
}
export type BoardPriceLevel = {
price: CurrencyAmount
quantity?: number | null
}
export type Board = {
issue: IssueRef
bids: BoardPriceLevel[]
asks: BoardPriceLevel[]
quote?: Quote
error?: SbiMethodError
}
export type MarketIndex = {
code?: string
categoryCode?: string
name: string
value?: number | null
valueText?: string
change?: SignedTextValue
changeRate?: PercentValue
colorFlag?: string
timestamp?: string
open?: CurrencyAmount
high?: CurrencyAmount
low?: CurrencyAmount
previousClose?: CurrencyAmount
}
export type DomesticMarket = {
status?: string
indexes: MarketIndex[]
error?: SbiMethodError
}
export type RankingItem = {
rank: number
issue: IssueRef
value?: number | string | null
values?: Array<number | string | null>
change?: SignedTextValue
changeRate?: PercentValue
exchangeName?: string
colorFlag?: string
}
export type Ranking = {
items: RankingItem[]
category?: string
updatedAt?: string
error?: SbiMethodError
}
export type NewsItem = {
id?: string
title: string
source?: string
publishedAt?: string
url?: string
summary?: string
storyDate?: string
storyTime?: string
processedDate?: string
takeTime?: string
pnac?: string
}
export type NewsList = {
items: NewsItem[]
error?: SbiMethodError
}
export type WatchlistItem = {
issue: IssueRef
sortOrder?: number
memo?: string
quote?: Quote
}
export type Watchlist = {
id: WatchlistId
name: string
items: WatchlistItem[]
error?: SbiMethodError
}
export type Order = {
id: OrderId
issue: IssueRef
side: TradeSide
sideText?: string
status: OrderStatus
statusText?: string
executionStatus?: string
executionStatusText?: string
kind?: OrderKind
accountType?: AccountType
depositType?: DepositType
depositTypeCode?: string
depositTypeText?: string
quantity?: number | null
unexecutedQuantity?: number | null
executedQuantity?: number | null
price?: CurrencyAmount
executedPrice?: CurrencyAmount
orderedAt?: string
expiresAt?: string
orderNumber?: string
orderSubNo?: string
tradeId?: string
exchangeCode?: string
accountInformation?: string
cancelable?: boolean
correctable?: boolean
}
export type OrderList = {
orders: Order[]
hasMore?: boolean
error?: SbiMethodError
}
export type TradeRecord = {
id: string
issue: IssueRef
tradeRecordTypeCode?: string
tradeCurrencyCode?: string
listedSecuritiesStatus?: string
orderPriceKindCode?: string
accountType?: AccountType
settlementCurrencyCode?: string
amount?: CurrencyAmount
quantity?: number | null
price?: CurrencyAmount
tradeDate?: string
valueDate?: string
marginCloseLimitType?: string
}
export type TradeRecordList = {
records: TradeRecord[]
hasMore?: boolean
error?: SbiMethodError
}
export type OrderCorrectionPreOrderDetail = {
exchangeName?: string
marketLoanKbn?: string
marketIppanLoanKbn?: string
currentPrice?: CurrencyAmount
tradeColorFlag?: string
priceTick?: string
priceTickText?: string
tradeTime?: string
changeText?: string
volumeText?: string
}
export type OrderCorrectionPreOrder = {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
controlledStockCode?: string
hasTradeWarning?: boolean
deficitMessageFlag?: string
deficitMessage?: string
details: OrderCorrectionPreOrderDetail[]
orderNumber?: string
orderId?: string
primaryOrderMethod?: string
primaryTriggerZone?: string
primaryTriggerPrice?: number | null
status?: string
statusText?: string
tradeId?: string
tradeName?: string
quantity?: number | null
quantityText?: string
orderLimit?: string
orderLimitText?: string
priceSteps: StockOrderPreOrderPriceStep[]
sessionRange?: string
inputDateText?: string
primaryOrderTerm?: string
nonSpecificTradeText?: string
marketName?: string
rbeOrderStatus?: string
priceCondition?: string
price?: number | null
priceAmount?: CurrencyAmount
exchangeName?: string
transId?: string
ptsDayNightFlag?: string
smallTickFlag?: string
juniorBuyingPowerTotal?: CurrencyAmount
secondaryPriceCondition?: string
secondaryPrice?: number | null
secondaryPriceAmount?: CurrencyAmount
autoOrderKind?: string
autoOrderNumber?: string
autoOrderInputDate?: string
secondaryOrderMethod?: string
secondaryTriggerZone?: string
secondaryTriggerPrice?: number | null
secondaryOrderCondition?: string
secondaryLimitPrice?: number | null
secondaryLimitPriceAmount?: CurrencyAmount
secondaryOrderTerm?: string
secondaryOcoPriceCondition?: string
secondaryOcoPrice?: number | null
secondaryOcoPriceAmount?: CurrencyAmount
exchangeList?: string
}
export type OrderPreview = {
issue: IssueRef
side: TradeSide
quantity?: number
price?: CurrencyAmount
estimatedAmount?: CurrencyAmount
commission?: CurrencyAmount
tax?: CurrencyAmount
warnings: string[]
confirmationId?: string
message?: string
correction?: OrderCorrectionPreOrder
error?: SbiMethodError
}
export type StockOrderPreOrderPriceStep = {
from?: CurrencyAmount
to?: CurrencyAmount
}
export type StockOrderPreOrderPaymentLimit = {
text?: string
code?: string
}
export type StockOrderPreOrderMarginTradeType =
| 'standard'
| 'generalBuy'
| 'generalSellShort'
| 'generalSellInventoryLimited'
| 'generalSellInventoryUnlimited'
| 'day'
| 'hyper'
export type StockOrderPreOrder = {
issue: IssueRef
tradeTitle?: string
buyingPowerTotal?: CurrencyAmount
controlledStockCode?: string
hasTradeWarning?: boolean
market?: MarketCode
exchangeList?: string
exchangeListName?: string
exchangeListIndexFlag?: string
marketLoanKbn?: string
marketIppanLoanKbn?: string
currentPrice?: CurrencyAmount
tradeColorFlag?: string
priceTick?: string
priceTickText?: string
tradeTime?: string
changeText?: string
volume?: number | null
lotSize?: number | null
priceSteps: StockOrderPreOrderPriceStep[]
sessionRange?: string
basePrice?: CurrencyAmount
orderTerms: string[]
orderTermDates: string[]
paymentLimits: StockOrderPreOrderPaymentLimit[]
nonSpecificTradeText?: string
paymentLimitText?: string
acquisitionPrice?: CurrencyAmount
position?: number | null
unexecutedQuantity?: number | null
lotSize2?: number | null
ptsDayNightFlag?: string
sorServiceType?: string
nisa?: {
serviceKbn?: string
buyLimit?: CurrencyAmount
growthServiceKbn?: string
juniorServiceKbn?: string
juniorBuyLimit?: CurrencyAmount
juniorBuyingPowerTotal?: CurrencyAmount
}
smallTickFlag?: string
margin?: {
tradeTypes?: StockOrderPreOrderMarginTradeType[]
ippanShort?: string
ippanLong?: string
dayBuy?: string
daySell?: string
premiumShortSelling?: string
premiumFee?: CurrencyAmount
ippanPaymentLimit?: string
positionStatus?: string
}
sKabu?: {
code?: string
available?: boolean
}
deficitMessageFlag?: string
deficitMessage?: string
error?: SbiMethodError
}
export type OrderReceipt = {
accepted: boolean
orderId?: OrderId
acceptedAt?: string
message?: string
error?: SbiMethodError
}
export type ExchangeOrderSide = 'buy' | 'sell'
export type ExchangeSpecificMethod = 'foreign' | 'domestic'
export type ExchangeAccountKind = 'GENERAL' | 'JR_NISA'
export type ExchangeSellMethod = 'SELL_PART' | 'SELL_ALL'
export type ExchangeOrderPreview = {
currencyCode: string
currencyName?: string
side: ExchangeOrderSide
exchangeType?: string
accountKind?: ExchangeAccountKind
specificMethod?: ExchangeSpecificMethod
sellMethod?: ExchangeSellMethod | null
tradeQuantity?: string
orderAmount?: string
exchangeRate?: string
netAmount?: string
valueDate?: string
rateDateTime?: string
warningMessage?: string | null
isMaintenance?: boolean
csrfToken: string
}
export type ExchangeOrderReceipt = {
accepted: boolean
currencyCode?: string
side?: ExchangeOrderSide
message?: string
warningMessage?: string | null
rawTitle?: string
}
export type ExchangeRateInfo = {
currencyCode: string
side: ExchangeOrderSide
referenceExchangeRate?: string
computeExchangeRate?: string
basePrice?: string
exchangeTradeType?: string
updateTime?: string
buyPossibleAmount?: string
sellPossibleAmount?: string
buyUnit?: string
sellUnit?: string
buyLimitMin?: string
buyLimitMax?: string
sellLimitMin?: string
sellLimitMax?: string
raw: Record<string, unknown>
}
export type ThemeInvestment = {
id: ThemeId
name: string
issues: ThemeInvestmentIssue[]
minimumAmount?: CurrencyAmount
}
export type ThemeInvestmentIssue = IssueRef & {
controlledStockCode?: string
hasTradeWarning?: boolean
nisaServiceKbn?: string
juniorNisaServiceKbn?: string
growthNisaServiceKbn?: string
sKabuCode?: string
sKabuAvailable?: boolean
lotSize?: number | null
currentPrice?: CurrencyAmount
tradeColorFlag?: string
priceTick?: string
priceTickText?: string
tradeTime?: string
}
export type ThemeInvestmentList = {
themes: ThemeInvestment[]
buyingPowerTotal?: CurrencyAmount
isaBuyLimit?: CurrencyAmount
juniorNisaBuyLimit?: CurrencyAmount
buyingPowerTotalJuniorNisa?: CurrencyAmount
deficitMessage?: string
deficitMessageFlag?: string
error?: SbiMethodError
}
export type SbiMethodError = {
status?: string
code?: string
message?: string
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts"]
}