sbisecurities

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Status string `json:"status"`
}

type DepositType

type DepositType string
const (
	DepositTypeNisaGrowth  DepositType = "nisa_growth"  // NISA (成長)預り
	DepositTypeNisaReserve DepositType = "nisa_reserve" // NISA (つみたて)預り
	DepositTypeNormal      DepositType = "normal"       // 普通預り
	DepositTypeSpecific    DepositType = "specific"     // 特定預り
	DepositTypeTnisa       DepositType = "tnisa"        // 旧つみたてNISA預り
)

func (DepositType) Label

func (t DepositType) Label() string

type FundAssets

type FundAssets struct {
	Data struct {
		AmountHoldings                *FundHoldings `json:"amountHoldings"`                // 金額指定保有
		CostSummary                   string        `json:"costSummary"`                   // 合計取得金額 (円)
		EstimateAmountSummary         string        `json:"estimateAmountSummary"`         // 合計評価額 (円)
		EstimateProfitLossRateSummary float64       `json:"estimateProfitLossRateSummary"` // 合計評価損益 (%)
		EstimateProfitLossSummary     string        `json:"estimateProfitLossSummary"`     // 合計評価損益 (円)
		JrNISAOpened                  bool          `json:"jrnisaOpened"`                  // ?
		JrNISASpecificOpened          bool          `json:"jrnisaSpecificOpened"`          // ?
		PreviousChangeSummary         string        `json:"previousChangeSummary"`         // 合計評価額の前日比 (円)
		PreviousRatioSummary          float64       `json:"previousRatioSummary"`          // 合計評価額の前日比 (%)
		SpecificOpened                bool          `json:"specificOpened"`                // 特定口座を持っているか
		TotalCount                    int           `json:"totalCount"`                    // 保有ファンドの数
		UnitHoldings                  *FundHoldings `json:"unitHoldings"`                  // 口数指定保有
	} `json:"data"`
	Status string `json:"status"`
}

func (*FundAssets) Holdings

func (a *FundAssets) Holdings() []*FundHoldings

type FundDeposit

type FundDeposit struct {
	CostTotal             string      `json:"costTotal"`           // 合計取得金額 (円)
	EstimateAmountTotal   string      `json:"estimateAmountTotal"` // 合計評価額 (円)
	FundInfos             []*FundInfo `json:"fundInfos"`
	HitCount              int         `json:"hitCount"`              // 保有ファンドの数
	PreviousChange        string      `json:"previousChange"`        // 合計評価額の前日比 (円)
	PreviousRatio         float64     `json:"previousRatio"`         // 合計評価額の前日比 (%)
	ProfitLossAmountTotal string      `json:"profitLossAmountTotal"` // 合計評価損益 (円)
	ProfitLossRateTotal   float64     `json:"profitLossRateTotal"`   // 合計評価損益 (%)

	DepositType DepositType `json:"-"`
}

type FundHoldings

type FundHoldings struct {
	JuniorNisaContinuous      any          `json:"juniorNisaContinuous"`      // ?
	JuniornisaNisaDeposit     any          `json:"juniornisaNisaDeposit"`     // ?
	JuniornisaNormalDeposit   any          `json:"juniornisaNormalDeposit"`   // ?
	JuniornisaSpecificDeposit any          `json:"juniornisaSpecificDeposit"` // ?
	NisaDeposit               any          `json:"nisaDeposit"`               // ?
	NisaGrowth                *FundDeposit `json:"nisaGrowth"`                // NISA (成長)預り
	NisaReserve               *FundDeposit `json:"nisaReserve"`               // NISA (つみたて)預り
	NormalDeposit             *FundDeposit `json:"normalDeposit"`             // 普通預り
	SpecificDeposit           *FundDeposit `json:"specificDeposit"`           // 特定預り
	TnisaDeposit              *FundDeposit `json:"tnisaDeposit"`              // 旧つみたてNISA預り

	HoldingType HoldingType `json:"-"`
}

func (*FundHoldings) Deposits

func (h *FundHoldings) Deposits() []*FundDeposit

type FundInfo

type FundInfo struct {
	AmountBuyable                    string  `json:"amountBuyable"`                    // ?
	AssociationCode                  string  `json:"associationCode"`                  // https://member.c.sbisec.co.jp/fund/detail/${AssociationCode}
	CancellationOrderDuringUnit      string  `json:"cancellationOrderDuringUnit"`      // ?
	CancellationOrderDuringValuation string  `json:"cancellationOrderDuringValuation"` // ?
	Cost                             int     `json:"cost"`                             // 取得金額 (円)
	DividendChangeType               string  `json:"dividendChangeType"`               // ?
	EstimateAmount                   string  `json:"estimateAmount"`                   // 評価額 (円)
	EstimateAmountPrevious           string  `json:"estimateAmountPrivious"`           // 前日の評価額 (円)
	EstimateChange                   string  `json:"estimateChange"`                   // 評価額の前日比 (円)
	EstimateChangeRate               float64 `json:"estimateChangeRate"`               // 評価額の前日比 (%)
	EstimateProfitLoss               string  `json:"estimateProfitLoss"`               // 評価損益 (円)
	EstimateProfitLossPrevious       string  `json:"estimateProfitLossPrivious"`       // 前日の評価損益 (円)
	EstimateProfitLossRate           float64 `json:"estimateProfitLossRate"`           // 評価損益 / 取得金額 (%)
	EstimateProfitLossRatePrevious   float64 `json:"estimateProfitLossRatePrivious"`   // 前日の評価損益 / 取得金額 (%)
	FavoriteFlag                     bool    `json:"favoriteFlag"`                     // ?
	FundName                         string  `json:"fundName"`                         // ファンド名
	FundType                         string  `json:"fundType"`                         // ?
	KaisuGou                         string  `json:"kaisuGou"`                         // ?
	MsCategoryCode                   string  `json:"msCategoryCode"`                   // ?
	ParticularPrincipal              float64 `json:"particularPrincipal"`              // ?
	Position                         string  `json:"position"`                         // 保有口数 (口)
	Price                            float64 `json:"price"`                            // 取得単価 (円)
	Reinvest                         string  `json:"reinvest"`                         // ?
	ReserveBuyable                   string  `json:"reserveBuyable"`                   // ?
	ReserveSellable                  string  `json:"reserveSellable"`                  // ?
	StandardPrice                    int     `json:"standardPrice"`                    // 基準価額 (円)
	StandardPriceDate                string  `json:"standardPriceDate"`                // yyyymmdd
	StandardPricePrevious            int     `json:"standardPricePrivious"`            // 前日の基準価額 (円)
	StandardPriceUnit                int     `json:"standardPriceUnit"`                // ?
	UnitBuyable                      string  `json:"unitBuyable"`                      // ?
	WebHandlingType                  string  `json:"webHandlingType"`                  // ?
}

type HoldingType

type HoldingType string
const (
	HoldingTypeAmount HoldingType = "amount" // 金額指定保有
	HoldingTypeUnit   HoldingType = "unit"   // 口数指定保有
)

func (HoldingType) Label

func (t HoldingType) Label() string

type Plugin

type Plugin struct {
	Username string `toml:"-" env:"SBI_SECURITIES_USERNAME"`
	Password string `toml:"-" env:"SBI_SECURITIES_PASSWORD"`
	// contains filtered or unexported fields
}

func (*Plugin) Gather

func (p *Plugin) Gather(accumulator telegraf.Accumulator) error

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) SampleConfig

func (p *Plugin) SampleConfig() string

type SBISecuritiesClient

type SBISecuritiesClient struct {
	// contains filtered or unexported fields
}

func NewSBISecuritiesClient

func NewSBISecuritiesClient() (*SBISecuritiesClient, error)

func (*SBISecuritiesClient) GetFundAssets

func (c *SBISecuritiesClient) GetFundAssets(ctx context.Context) (*FundAssets, error)

func (*SBISecuritiesClient) Login

func (c *SBISecuritiesClient) Login(ctx context.Context, username, password string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL