jquants

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 13 Imported by: 0

README

jquants-go

J-Quants API Client for Go

Documentation

Index

Constants

View Source
const BaseURL = "https://api.jquants.com/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequest

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

func (BadRequest) Error

func (e BadRequest) Error() string

func (BadRequest) Unwrap

func (e BadRequest) Unwrap() error

type Client

type Client struct {
	HttpClient    *http.Client
	BaseURL       string
	MailAddress   string
	Password      string
	RefreshToken  string
	IDToken       string
	RetryInterval time.Duration
	LoopTimeout   time.Duration
}

func NewClient

func NewClient(ctx context.Context, httpClient *http.Client) (*Client, error)

func (*Client) IndexOptionPrice

func (c *Client) IndexOptionPrice(ctx context.Context, req IndexOptionPriceRequest) ([]IndexOptionPrice, error)

func (*Client) IndexOptionPriceWithChannel

func (c *Client) IndexOptionPriceWithChannel(ctx context.Context, req IndexOptionPriceRequest, ch chan<- IndexOptionPrice) error

func (*Client) IndexPrice

func (c *Client) IndexPrice(ctx context.Context, req IndexPriceRequest) ([]IndexPrice, error)

func (*Client) IssueInformation added in v0.2.0

func (c *Client) IssueInformation(ctx context.Context, req IssueInformationRequest) ([]IssueInformation, error)

func (*Client) MarginTradingVolume

func (c *Client) MarginTradingVolume(ctx context.Context, req MarginTradingVolumeRequest) ([]MarginTradingVolume, error)

MarginTradingVolume provides margin trading outstandings. https://jpx.gitbook.io/j-quants-en/api-reference/weekly_margin_interest

func (*Client) SendGetRequest added in v0.4.0

func (c *Client) SendGetRequest(ctx context.Context, u *url.URL) (*http.Response, error)

func (*Client) ShortSellingValue

func (c *Client) ShortSellingValue(ctx context.Context, req ShortSellingValueRequest) ([]ShortSellingValue, error)

func (*Client) StockPrice

func (c *Client) StockPrice(ctx context.Context, req StockPriceRequest) ([]StockPrice, error)

func (*Client) StockPriceWithChannel

func (c *Client) StockPriceWithChannel(ctx context.Context, req StockPriceRequest, ch chan<- StockPrice) error

func (*Client) StockTradingValue

func (c *Client) StockTradingValue(ctx context.Context, req StockTradingValueRequest) ([]StockTradingValue, error)

StockTradingValue provides trading by type of investors. https://jpx.gitbook.io/j-quants-en/api-reference/trades_spec

func (*Client) TopixPrices

func (c *Client) TopixPrices(ctx context.Context, req TopixPriceRequest) ([]TopixPrice, error)

func (*Client) TradingCalendar

func (c *Client) TradingCalendar(ctx context.Context, req TradingCalendarRequest) ([]TradingCalendar, error)

type ErrResponse

type ErrResponse struct {
	Message string `json:"message"`
}

type Forbidden

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

func (Forbidden) Error

func (e Forbidden) Error() string

func (Forbidden) Unwrap

func (e Forbidden) Unwrap() error

type IndexOptionPrice

type IndexOptionPrice struct {
	Date                           string       `json:"Date"`
	Code                           string       `json:"Code"`
	WholeDayOpen                   *int16       `json:"WholeDayOpen"`
	WholeDayHigh                   *int16       `json:"WholeDayHigh"`
	WholeDayLow                    *int16       `json:"WholeDayLow"`
	WholeDayClose                  *int16       `json:"WholeDayClose"`
	NightSessionOpen               *int16       `json:"NightSessionOpen"`
	NightSessionHigh               *int16       `json:"NightSessionHigh"`
	NightSessionLow                *int16       `json:"NightSessionLow"`
	NightSessionClose              *int16       `json:"NightSessionClose"`
	DaySessionOpen                 *int16       `json:"DaySessionOpen"`
	DaySessionHigh                 *int16       `json:"DaySessionHigh"`
	DaySessionLow                  *int16       `json:"DaySessionLow"`
	DaySessionClose                *int16       `json:"DaySessionClose"`
	Volume                         int64        `json:"Volume"`
	OpenInterest                   int64        `json:"OpenInterest"`
	TurnoverValue                  int64        `json:"TurnoverValue"`
	ContractMonth                  string       `json:"ContractMonth"`
	StrikePrice                    int16        `json:"StrikePrice"`
	VolumeOnlyAuction              *int64       `json:"Volume(OnlyAuction)"`
	EmergencyMarginTriggerDivision string       `json:"EmergencyMarginTriggerDivision"`
	PutCallDivision                int8         `json:"PutCallDivision"`
	LastTradingDay                 *string      `json:"LastTradingDay"`
	SpecialQuotationDay            *string      `json:"SpecialQuotationDay"`
	SettlementPrice                *int16       `json:"SettlementPrice"`
	TheoreticalPrice               *json.Number `json:"TheoreticalPrice"`
	BaseVolatility                 *json.Number `json:"BaseVolatility"`
	UnderlyingPrice                *json.Number `json:"UnderlyingPrice"`
	ImpliedVolatility              *json.Number `json:"ImpliedVolatility"`
	InterestRate                   *json.Number `json:"InterestRate"`
}

func (*IndexOptionPrice) UnmarshalJSON

func (iop *IndexOptionPrice) UnmarshalJSON(b []byte) error

type IndexOptionPriceRequest

type IndexOptionPriceRequest struct {
	Date string
}

type IndexPrice

type IndexPrice struct {
	Date  string      `json:"Date"`
	Code  string      `json:"Code"`
	Open  json.Number `json:"Open"`
	High  json.Number `json:"High"`
	Low   json.Number `json:"Low"`
	Close json.Number `json:"Close"`
}

func (*IndexPrice) UnmarshalJSON

func (ip *IndexPrice) UnmarshalJSON(b []byte) error

type IndexPriceRequest

type IndexPriceRequest struct {
	Code *string
	Date *string
	From *string
	To   *string
}

type InternalServerError

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

func (InternalServerError) Error

func (e InternalServerError) Error() string

func (InternalServerError) Unwrap

func (e InternalServerError) Unwrap() error

type IssueInformation added in v0.2.0

type IssueInformation struct {
	Date               string `json:"Date"`
	Code               string `json:"Code"`
	CompanyName        string `json:"CompanyName"`
	CompanyNameEnglish string `json:"CompanyNameEnglish"`
	Sector17Code       int8   `json:"Sector17Code"`
	Sector33Code       string `json:"Sector33Code"`
	ScaleCategory      string `json:"ScaleCategory"`
	MarketCode         string `json:"MarketCode"`
	MarginCode         *int8  `json:"MarginCode"`
}

func (*IssueInformation) UnmarshalJSON added in v0.2.0

func (ii *IssueInformation) UnmarshalJSON(b []byte) error

type IssueInformationRequest added in v0.2.0

type IssueInformationRequest struct {
	Code *string
	Date *string
}

type MarginTradingVolume

type MarginTradingVolume struct {
	Date                               string `json:"Date"`
	Code                               string `json:"Code"`
	ShortMarginTradeVolume             int64  `json:"ShortMarginTradeVolume"`
	LongMarginTradeVolume              int64  `json:"LongMarginTradeVolume"`
	ShortNegotiableMarginTradeVolume   int64  `json:"ShortNegotiableMarginTradeVolume"`
	LongNegotiableMarginTradeVolume    int64  `json:"LongNegotiableMarginTradeVolume"`
	ShortStandardizedMarginTradeVolume int64  `json:"ShortStandardizedMarginTradeVolume"`
	LongStandardizedMarginTradeVolume  int64  `json:"LongStandardizedMarginTradeVolume"`
	IssueType                          int8   `json:"IssueType"`
}

func (*MarginTradingVolume) UnmarshalJSON

func (mtv *MarginTradingVolume) UnmarshalJSON(b []byte) error

type MarginTradingVolumeRequest

type MarginTradingVolumeRequest struct {
	Code *string
	Date *string
	From *string
	To   *string
}

type PayloadTooLarge

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

func (PayloadTooLarge) Error

func (e PayloadTooLarge) Error() string

func (PayloadTooLarge) Unwrap

func (e PayloadTooLarge) Unwrap() error

type ShortSellingValue

type ShortSellingValue struct {
	Date                                         string `json:"Date"`
	Sector33Code                                 string `json:"Sector33Code"`
	SellingExcludingShortSellingTurnoverValue    int64  `json:"SellingExcludingShortSellingTurnoverValue"`
	ShortSellingWithRestrictionsTurnoverValue    int64  `json:"ShortSellingWithRestrictionsTurnoverValue"`
	ShortSellingWithoutRestrictionsTurnoverValue int64  `json:"ShortSellingWithoutRestrictionsTurnoverValue"`
}

func (*ShortSellingValue) UnmarshalJSON

func (ssv *ShortSellingValue) UnmarshalJSON(b []byte) error

type ShortSellingValueRequest

type ShortSellingValueRequest struct {
	Sector33Code *string
	Date         *string
	From         *string
	To           *string
}

type StockPrice

type StockPrice struct {
	Date             string       `json:"Date"`
	Code             string       `json:"Code"`
	Open             *json.Number `json:"Open"`
	High             *json.Number `json:"High"`
	Low              *json.Number `json:"Low"`
	Close            *json.Number `json:"Close"`
	UpperLimit       bool         `json:"UpperLimit"`
	LowerLimit       bool         `json:"LowerLimit"`
	Volume           *int64       `json:"Volume"`
	TurnoverValue    *int64       `json:"TurnoverValue"`
	AdjustmentFactor json.Number  `json:"AdjustmentFactor"`
}

func (*StockPrice) UnmarshalJSON

func (sp *StockPrice) UnmarshalJSON(b []byte) error

type StockPriceRequest

type StockPriceRequest struct {
	Code *string
	Date *string
	From *string
	To   *string
}

type StockTradingValue

type StockTradingValue struct {
	PublishedDate                       string `json:"PublishedDate"`
	StartDate                           string `json:"StartDate"`
	EndDate                             string `json:"EndDate"`
	Section                             string `json:"Section"`
	ProprietarySales                    int64  `json:"ProprietarySales"`
	ProprietaryPurchases                int64  `json:"ProprietaryPurchases"`
	ProprietaryTotal                    int64  `json:"ProprietaryTotal"`
	ProprietaryBalance                  int64  `json:"ProprietaryBalance"`
	BrokerageSales                      int64  `json:"BrokerageSales"`
	BrokeragePurchases                  int64  `json:"BrokeragePurchases"`
	BrokerageTotal                      int64  `json:"BrokerageTotal"`
	BrokerageBalance                    int64  `json:"BrokerageBalance"`
	NetSales                            int64  `json:"TotalSales"`
	NetPurchases                        int64  `json:"TotalPurchases"`
	NetTotal                            int64  `json:"TotalTotal"`
	NetBalance                          int64  `json:"TotalBalance"`
	IndividualsSales                    int64  `json:"IndividualsSales"`
	IndividualsPurchases                int64  `json:"IndividualsPurchases"`
	IndividualsTotal                    int64  `json:"IndividualsTotal"`
	IndividualsBalance                  int64  `json:"IndividualsBalance"`
	ForeignersSales                     int64  `json:"ForeignersSales"`
	ForeignersPurchases                 int64  `json:"ForeignersPurchases"`
	ForeignersTotal                     int64  `json:"ForeignersTotal"`
	ForeignersBalance                   int64  `json:"ForeignersBalance"`
	SecuritiesCosSales                  int64  `json:"SecuritiesCosSales"`
	SecuritiesCosPurchases              int64  `json:"SecuritiesCosPurchases"`
	SecuritiesCosTotal                  int64  `json:"SecuritiesCosTotal"`
	SecuritiesCosBalance                int64  `json:"SecuritiesCosBalance"`
	InvestmentTrustsSales               int64  `json:"InvestmentTrustsSales"`
	InvestmentTrustsPurchases           int64  `json:"InvestmentTrustsPurchases"`
	InvestmentTrustsTotal               int64  `json:"InvestmentTrustsTotal"`
	InvestmentTrustsBalance             int64  `json:"InvestmentTrustsBalance"`
	BusinessCosSales                    int64  `json:"BusinessCosSales"`
	BusinessCosPurchases                int64  `json:"BusinessCosPurchases"`
	BusinessCosTotal                    int64  `json:"BusinessCosTotal"`
	BusinessCosBalance                  int64  `json:"BusinessCosBalance"`
	OtherCosSales                       int64  `json:"OtherCosSales"`
	OtherCosPurchases                   int64  `json:"OtherCosPurchases"`
	OtherCosTotal                       int64  `json:"OtherCosTotal"`
	OtherCosBalance                     int64  `json:"OtherCosBalance"`
	InsuranceCosSales                   int64  `json:"InsuranceCosSales"`
	InsuranceCosPurchases               int64  `json:"InsuranceCosPurchases"`
	InsuranceCosTotal                   int64  `json:"InsuranceCosTotal"`
	InsuranceCosBalance                 int64  `json:"InsuranceCosBalance"`
	BanksSales                          int64  `json:"CityBKsRegionalBKsEtcSales"`
	BanksPurchases                      int64  `json:"CityBKsRegionalBKsEtcPurchases"`
	BanksTotal                          int64  `json:"CityBKsRegionalBKsEtcTotal"`
	BanksBalance                        int64  `json:"CityBKsRegionalBKsEtcBalance"`
	TrustBanksSales                     int64  `json:"TrustBanksSales"`
	TrustBanksPurchases                 int64  `json:"TrustBanksPurchases"`
	TrustBanksTotal                     int64  `json:"TrustBanksTotal"`
	TrustBanksBalance                   int64  `json:"TrustBanksBalance"`
	OtherFinancialInstitutionsSales     int64  `json:"OtherFinancialInstitutionsSales"`
	OtherFinancialInstitutionsPurchases int64  `json:"OtherFinancialInstitutionsPurchases"`
	OtherFinancialInstitutionsTotal     int64  `json:"OtherFinancialInstitutionsTotal"`
	OtherFinancialInstitutionsBalance   int64  `json:"OtherFinancialInstitutionsBalance"`
}

func (*StockTradingValue) UnmarshalJSON

func (stv *StockTradingValue) UnmarshalJSON(b []byte) error

type StockTradingValueRequest

type StockTradingValueRequest struct {
	Section *string
	From    *string
	To      *string
}

type TopixPrice

type TopixPrice struct {
	Date  string      `json:"Date"`
	Open  json.Number `json:"Open"`
	High  json.Number `json:"High"`
	Low   json.Number `json:"Low"`
	Close json.Number `json:"Close"`
}

func (*TopixPrice) UnmarshalJSON

func (p *TopixPrice) UnmarshalJSON(b []byte) error

type TopixPriceRequest

type TopixPriceRequest struct {
	From *string
	To   *string
}

type TradingCalendar

type TradingCalendar struct {
	Date            string `json:"Date"`
	HolidayDivision int8   `json:"HolidayDivision"`
}

func (*TradingCalendar) UnmarshalJSON

func (tc *TradingCalendar) UnmarshalJSON(b []byte) error

type TradingCalendarRequest

type TradingCalendarRequest struct {
	HolidayDivision *int8
	From            *string
	To              *string
}

type Unauthorized

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

func (Unauthorized) Error

func (e Unauthorized) Error() string

func (Unauthorized) Unwrap

func (e Unauthorized) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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