quote

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

View Source
const (
	// SubType
	SubTypeUnknown SubType = SubType(quotev1.SubType_UNKNOWN_TYPE)
	SubTypeQuote   SubType = SubType(quotev1.SubType_QUOTE)
	SubTypeDepth   SubType = SubType(quotev1.SubType_DEPTH)
	SubTypeBrokers SubType = SubType(quotev1.SubType_BROKERS)
	SubTypeTrade   SubType = SubType(quotev1.SubType_TRADE)

	// SubEvent
	EventQuote EventType = iota
	EventBroker
	EventTrade
	EventDepth

	// Period
	PeriodOneMinute     = Period(quotev1.Period_ONE_MINUTE)
	PeriodFiveMinute    = Period(quotev1.Period_FIVE_MINUTE)
	PeriodFifteenMinute = Period(quotev1.Period_FIFTEEN_MINUTE)
	PeriodThirtyMinute  = Period(quotev1.Period_THIRTY_MINUTE)
	PeriodSixtyMinute   = Period(quotev1.Period_SIXTY_MINUTE)
	PeriodDay           = Period(quotev1.Period_DAY)
	PeriodWeek          = Period(quotev1.Period_WEEK)
	PeriodMonth         = Period(quotev1.Period_MONTH)
	PeriodYear          = Period(quotev1.Period_YEAR)

	// AdjustType
	AdjustTypeNo      = AdjustType(quotev1.AdjustType_NO_ADJUST)
	AdjustTypeForward = AdjustType(quotev1.AdjustType_FORWARD_ADJUST)

	// TradeSession
	TradeSessionNormal    = TradeSession(quotev1.TradeSession_NORMAL_TRADE)
	TradeSessionPreTrade  = TradeSession(quotev1.TradeSession_PRE_TRADE)
	TradeSessionPostTrade = TradeSession(quotev1.TradeSession_POST_TRADE)
	TradeSessionOvernight = TradeSession(quotev1.TradeSession_OVERNIGHT_TRADE)

	// CandlestickTradeSessionNormal includes normal trade session
	CandlestickTradeSessionNormal = CandlestickTradeSession(0)
	// CandlestickTradeSessionAll includes all trade sessions
	CandlestickTradeSessionAll = CandlestickTradeSession(100)

	// CalcIndex
	CalcIndexUnknown               CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_UNKNOWN)
	CalcIndexLastDone              CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_LAST_DONE)
	CalcIndexChangeVal             CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_CHANGE_VAL)
	CalcIndexChangeRate            CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_CHANGE_RATE)
	CalcIndexVolume                CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_VOLUME)
	CalcIndexTurnover              CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_TURNOVER)
	CalcIndexYtdChangeRate         CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_YTD_CHANGE_RATE)
	CalcIndexTurnoverRate          CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_TURNOVER_RATE)
	CalcIndexTotalMarketValue      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_TOTAL_MARKET_VALUE)
	CalcIndexCapitalFlow           CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_CAPITAL_FLOW)
	CalcIndexAmplitude             CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_AMPLITUDE)
	CalcIndexVolumeRatio           CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_VOLUME_RATIO)
	CalcIndexPeTTMRatio            CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_PE_TTM_RATIO)
	CalcIndexPbRatio               CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_PB_RATIO)
	CalcIndexDividendRatioTTM      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_DIVIDEND_RATIO_TTM)
	CalcIndexFiveDayChangeRate     CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_FIVE_DAY_CHANGE_RATE)
	CalcIndexTenDayChangeRate      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_TEN_DAY_CHANGE_RATE)
	CalcIndexHalfYearChangeRate    CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_HALF_YEAR_CHANGE_RATE)
	CalcIndexFiveMinutesChangeRate CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_FIVE_MINUTES_CHANGE_RATE)
	CalcIndexExpiryDate            CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_EXPIRY_DATE)
	CalcIndexStrikePrice           CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_STRIKE_PRICE)
	CalcIndexUpperStrikePrice      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_UPPER_STRIKE_PRICE)
	CalcIndexLowerStrikePrice      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_LOWER_STRIKE_PRICE)
	CalcIndexOutstandingQTY        CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_OUTSTANDING_QTY)
	CalcIndexOutstandingRatio      CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_OUTSTANDING_RATIO)
	CalcIndexPremium               CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_PREMIUM)
	CalcIndexItmOtm                CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_ITM_OTM)
	CalcIndexImpliedVolatility     CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_IMPLIED_VOLATILITY)
	CalcIndexWarrantDelta          CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_WARRANT_DELTA)
	CalcIndexCallPrice             CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_CALL_PRICE)
	CalcIndexToCallPrice           CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_TO_CALL_PRICE)
	CalcIndexEffectiveLeverage     CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_EFFECTIVE_LEVERAGE)
	CalcIndexLeverageRatio         CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_LEVERAGE_RATIO)
	CalcIndexConversionRatio       CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_CONVERSION_RATIO)
	CalcIndexBalancePoint          CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_BALANCE_POINT)
	CalcIndexOpenInterest          CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_OPEN_INTEREST)
	CalcIndexDELTA                 CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_DELTA)
	CalcIndexGAMMA                 CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_GAMMA)
	CalcIndexTHETA                 CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_THETA)
	CalcIndexVEGA                  CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_VEGA)
	CalcIndexRHO                   CalcIndex = CalcIndex(quotev1.CalcIndex_CALCINDEX_RHO)
)
View Source
const (
	DefaultQuoteUrl = "wss://openapi-quote.longbridge.com/v2"
)

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type AdjustType ΒΆ

type AdjustType int32

type Brokers ΒΆ

type Brokers struct {
	Position  int32
	BrokerIds []int32
}

type BrokersData ΒΆ

type BrokersData struct {
	Sequence   int64
	AskBrokers []*Brokers
	BidBrokers []*Brokers
}

type CalcIndex ΒΆ

type CalcIndex int32

type Candlestick ΒΆ

type Candlestick struct {
	Close     *decimal.Decimal
	Open      *decimal.Decimal
	Low       *decimal.Decimal
	High      *decimal.Decimal
	Volume    int64
	Turnover  *decimal.Decimal
	Timestamp int64
}

Candlestick is candlestick details

type CandlestickRequestOption ΒΆ

type CandlestickRequestOption func(*quotev1.SecurityHistoryCandlestickRequest)

CandlestickRequestOption is the option for the candlestick request

func CandlestickRequestTradeSession ΒΆ

func CandlestickRequestTradeSession(session CandlestickTradeSession) CandlestickRequestOption

CandlestickRequestTradeSession sets the trade session of the candlestick request

type CandlestickTradeSession ΒΆ

type CandlestickTradeSession int32

type Capital ΒΆ

type Capital struct {
	Large  *decimal.Decimal
	Medium *decimal.Decimal
	Small  *decimal.Decimal
}

Capital infomartion

type CapitalDistribution ΒΆ

type CapitalDistribution struct {
	Symbol     string
	Timestamp  int64   // data update timestamp
	CapitalIn  Capital // inflow capital data
	CapitalOut Capital // outflow capital data
}

CapitalDistribution information

type CapitalFlowLine ΒΆ

type CapitalFlowLine struct {
	Inflow    *decimal.Decimal
	Timestamp int64
}

CapitalFlowLine

type DailyOptionVolume ΒΆ added in v0.24.1

type DailyOptionVolume struct {
	// Underlying security symbol
	Symbol string
	// Settlement date (unix timestamp string)
	Timestamp string
	// Total option volume (calls + puts)
	TotalVolume string
	// Total put volume
	TotalPutVolume string
	// Total call volume
	TotalCallVolume string
	// Put/call volume ratio
	PutCallVolumeRatio string
	// Total open interest
	TotalOpenInterest string
	// Total put open interest
	TotalPutOpenInterest string
	// Total call open interest
	TotalCallOpenInterest string
	// Put/call open interest ratio
	PutCallOpenInterestRatio string
}

DailyOptionVolume is a single daily option volume data point

type Depth ΒΆ

type Depth struct {
	Position int32
	Price    *decimal.Decimal
	Volume   int64
	OrderNum int64
}

Depth store depth details

type DepthData ΒΆ

type DepthData struct {
	Sequence int64
	Ask      []*Depth
	Bid      []*Depth
}

type EventType ΒΆ

type EventType int8

type FilingItem ΒΆ added in v0.21.0

type FilingItem struct {
	// Filing ID
	Id string
	// Title
	Title string
	// Description
	Description string
	// File name
	FileName string
	// File URLs
	FileUrls []string
	// Published time
	PublishAt time.Time
}

FilingItem is a filing document for a security

type IntradayLine ΒΆ

type IntradayLine struct {
	Price     *decimal.Decimal
	Timestamp int64
	Volume    int64
	Turnover  *decimal.Decimal
	AvgPrice  *decimal.Decimal
}

IntradayLine is k line

type Issuer ΒΆ

type Issuer struct {
	ID     int32
	NameCn string
	NameEn string
	NameHk string
}

Issuer to save issuer id

type IssuerInfo ΒΆ

type IssuerInfo struct {
	Id     int32
	NameCn string
	NameEn string
	NameHk string
}

IssuerInfo is issuer infomation

type MarketPackageDetail ΒΆ

type MarketPackageDetail struct {
	MarketCode string
	Limit      int32
	Burst      int32
}

type MarketTradingDay ΒΆ

type MarketTradingDay struct {
	TradeDay     []time.Time
	HalfTradeDay []time.Time
}

MarketTradingDay contains market open trade days

type MarketTradingSession ΒΆ

type MarketTradingSession struct {
	Market       openapi.Market
	TradeSession []*TradePeriod
}

MarketTradingSession is market's session details

type Option ΒΆ

type Option func(*Options)

Option for quote context

func OnReconnect ΒΆ

func OnReconnect(fn func(successResub bool)) Option

OnReconnect to set reconnect callbacks for quote context

func WithEnableOvernight ΒΆ

func WithEnableOvernight(enable bool) Option

WithEnableOvernight to set enable overnight for quote context

func WithHttpClient ΒΆ

func WithHttpClient(client *http.Client) Option

WithHttpClient to set http client for quote context

func WithLanguage ΒΆ

func WithLanguage(language openapi.Language) Option

WithLanguage to set language for quote context

func WithLbOptions ΒΆ

func WithLbOptions(opts *longbridge.Options) Option

WithLbOptions to set longbridge options for quote context

func WithLogLevel ΒΆ

func WithLogLevel(level string) Option

WithLogLevel to set log level for quote context

func WithLogger ΒΆ

func WithLogger(l log.Logger) Option

WithLogger to set logger for quote context

func WithQuoteURL ΒΆ

func WithQuoteURL(url string) Option

WithQuoteURL to set url for quote context

type OptionExtend ΒΆ

type OptionExtend struct {
	ImpliedVolatility    string
	OpenInterest         int64
	ExpiryDate           string // YYMMDD
	StrikePrice          *decimal.Decimal
	ContractMultiplier   string
	ContractType         string
	ContractSize         string
	Direction            string
	HistoricalVolatility string
	UnderlyingSymbol     string
}

OptionExtend is option extended properties

type OptionQuote ΒΆ

type OptionQuote struct {
	Symbol       string
	LastDone     *decimal.Decimal
	PrevClose    *decimal.Decimal
	Open         *decimal.Decimal
	High         *decimal.Decimal
	Low          *decimal.Decimal
	Timestamp    int64
	Volume       int64
	Turnover     *decimal.Decimal
	TradeStatus  TradeStatus
	OptionExtend *OptionExtend
}

OptionQuote to option quote details

type OptionVolumeStats ΒΆ added in v0.24.1

type OptionVolumeStats struct {
	// Total call volume
	CallVolume string
	// Total put volume
	PutVolume string
}

OptionVolumeStats contains aggregated call/put volume for a security

type Options ΒΆ

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

Options for quote context

type PackageDetail ΒΆ

type PackageDetail struct {
	PackageKey string
	Limit      int32
	Burst      int32
}

type ParticipantInfo ΒΆ

type ParticipantInfo struct {
	BrokerIds         []int32
	ParticipantNameCn string
	ParticipantNameEn string
	ParticipantNameHk string
}

ParticipantInfo has all participant brokers

type Period ΒΆ

type Period int32

type PinnedMode ΒΆ added in v0.24.1

type PinnedMode int32
const (
	// PinnedModeAdd pins securities to the top of the watchlist
	PinnedModeAdd PinnedMode = iota
	// PinnedModeRemove unpins securities from the top of the watchlist
	PinnedModeRemove
)

PinnedMode constants for UpdatePinned

func (PinnedMode) String ΒΆ added in v0.24.1

func (m PinnedMode) String() string

type PrePostQuote ΒΆ

type PrePostQuote struct {
	LastDone  *decimal.Decimal
	Timestamp int64
	Volume    int64
	Turnover  *decimal.Decimal
	High      *decimal.Decimal
	Low       *decimal.Decimal
	PrevClose *decimal.Decimal
}

PrePostQuote is pre or post quote details

type PushBrokers ΒΆ

type PushBrokers struct {
	Symbol     string
	Sequence   int64
	AskBrokers []*Brokers
	BidBrokers []*Brokers
}

PushBrokers is brokers info push from server

type PushDepth ΒΆ

type PushDepth struct {
	Symbol   string
	Sequence int64
	Ask      []*Depth
	Bid      []*Depth
}

PushDepth is depth info push from server

type PushQuote ΒΆ

type PushQuote struct {
	Symbol       string
	Sequence     int64
	LastDone     *decimal.Decimal
	Open         *decimal.Decimal
	High         *decimal.Decimal
	Low          *decimal.Decimal
	Timestamp    int64
	Volume       int64
	Turnover     *decimal.Decimal
	TradeStatus  TradeStatus
	TradeSession TradeSessionType
}

PushQuote is quote info push from server

type PushTrade ΒΆ

type PushTrade struct {
	Symbol   string
	Sequence int64
	Trade    []*Trade
}

PushTrade is trade info push from server

type Quote ΒΆ

type Quote struct {
	Symbol       string
	LastDone     *decimal.Decimal
	Open         *decimal.Decimal
	High         *decimal.Decimal
	Low          *decimal.Decimal
	Timestamp    int64
	Volume       int64
	Turnover     *decimal.Decimal
	TradeStatus  TradeStatus
	TradeSession TradeSessionType
}

Quote is quote details

type QuoteContext ΒΆ

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

func New ΒΆ

func New(opt ...Option) (*QuoteContext, error)

New return QuoteContext with option. A connection will be created with quote server.

func NewFormEnv deprecated

func NewFormEnv() (*QuoteContext, error)

Deprecated: NewFromEnv return QuoteContext, use NewFromCfg plz

func NewFromCfg ΒΆ

func NewFromCfg(cfg *config.Config) (*QuoteContext, error)

NewFromCfg return QuoteContext with config.Config

func (*QuoteContext) Brokers ΒΆ

func (c *QuoteContext) Brokers(ctx context.Context, symbol string) (securityBrokers *SecurityBrokers, err error)

Brokers obtain the real-time broker queue data of security. Reference: https://open.longbridge.com/en/docs/quote/pull/brokers

Example:

qctx, err := quote.NewFromEnv()
brokers, err := qctx.Brokers(context.Background(), "AAPL.HK")

func (*QuoteContext) CalcIndex ΒΆ

func (c *QuoteContext) CalcIndex(ctx context.Context, symbols []string, indexes []CalcIndex) (calcIndexes []*SecurityCalcIndex, err error)

CalcIndex is used to obtain the calculate indexes of securities. Reference: https://open.longbridge.com/en/docs/quote/pull/calc-index

Example:

qctx, err := quote.NewFromEnv()
flowlines, err := qctx.CapitalFlow(context.Background(), "700.HK")

func (*QuoteContext) Candlesticks ΒΆ

func (c *QuoteContext) Candlesticks(ctx context.Context, symbol string, period Period, count int32, adjustType AdjustType) (sticks []*Candlestick, err error)

Candlesticks obtain the candlestick data of security. Reference: https://open.longbridge.com/en/docs/quote/pull/candlestick periond support values:

  • quote.PeriodOneMinute - 1m
  • quote.PeriodFiveMinute - 5m
  • quote.PeriodFifteenMinute - 15m
  • quote.PeriodThirtyMinute - 40m
  • quote.PeriodDay - 1 day
  • quote.PeriodWeek - 1 week
  • quote.PeriodMonth - 1 month
  • quote.PeriodYear - 1 year

adjustType support values:

  • quote.AdjustTypeNo
  • quote.AdjustTypeForward

Example:

qctx, err := quote.NewFromEnv()
klines, err := qctx.Candlesticks(context.Background(), "AAPL.US", quote.PeriodDay, 10, quote.AdjustTypeNo)

func (*QuoteContext) CapitalDistribution ΒΆ

func (c *QuoteContext) CapitalDistribution(ctx context.Context, symbol string) (capitalDib CapitalDistribution, err error)

CapitalDistribution is used to obtain the daily capital distribution of security. Reference: https://open.longbridge.com/en/docs/quote/pull/capital-distribution

Example:

qctx, err := quote.NewFromEnv()
dist, err := qctx.CapitalDistribution(context.Background(), "700.HK")

func (*QuoteContext) CapitalFlow ΒΆ

func (c *QuoteContext) CapitalFlow(ctx context.Context, symbol string) (capitalFlowLines []CapitalFlowLine, err error)

CapitalFlow is used to obtain the daily capital flow intraday of security. Reference: https://open.longbridge.com/en/docs/quote/pull/capital-flow-intraday

Example:

qctx, err := quote.NewFromEnv()
flowlines, err := qctx.CapitalFlow(context.Background(), "700.HK")

func (*QuoteContext) Close ΒΆ

func (c *QuoteContext) Close() error

Close

func (*QuoteContext) CreateWatchlistGroup ΒΆ

func (c *QuoteContext) CreateWatchlistGroup(ctx context.Context, name string, symbols []string) (gid int64, err error)

CreateWatchlistGroup use to create watchlist group. Doc: https://open.longbridge.com/en/docs/quote/individual/watchlist_create_group

Example:

qctx, err := quote.NewFromCfg(conf)
// handle error
err = qctx.CreateWatchlistGroup(context.Background(), "test", []string{"AAPL.US"})
qctx, err := quote.NewFromCfg(conf)
// ignore handle error
err = qctx.CreateWatchlistGroup(context.Background(), "test", []string{"AAPL.US"})

func (*QuoteContext) DeleteWatchlistGroup ΒΆ

func (c *QuoteContext) DeleteWatchlistGroup(ctx context.Context, id int64, purge bool) (err error)

func (*QuoteContext) Depth ΒΆ

func (c *QuoteContext) Depth(ctx context.Context, symbol string) (securityDepth *SecurityDepth, err error)

Depth obtain the depth data of security. Reference: https://open.longbridge.com/en/docs/quote/pull/depth

Example:

qctx, err := quote.NewFromEnv()
depth, err := qctx.Depth(context.Background(), []string{"AAPL.HK"})

func (*QuoteContext) Filings ΒΆ added in v0.21.0

func (c *QuoteContext) Filings(ctx context.Context, symbol string) (items []*FilingItem, err error)

Filings returns the filings list for a symbol.

func (*QuoteContext) HistoryCandlesticksByDate ΒΆ

func (c *QuoteContext) HistoryCandlesticksByDate(ctx context.Context, symbol string, period Period, adjustType AdjustType, startDate *time.Time, endDate *time.Time, opts ...CandlestickRequestOption) (sticks []*Candlestick, err error)

HistoryCandlesticksByOffset obtains the history candlestick data of security after or before an offset time. Reference: https://open.longbridge.com/en/docs/quote/pull/history-candlestick periond support values:

  • quote.PeriodOneMinute - 1m
  • quote.PeriodFiveMinute - 5m
  • quote.PeriodFifteenMinute - 15m
  • quote.PeriodThirtyMinute - 40m
  • quote.PeriodDay - 1 day
  • quote.PeriodWeek - 1 week
  • quote.PeriodMonth - 1 month
  • quote.PeriodYear - 1 year

adjustType support values:

  • quote.AdjustTypeNo
  • quote.AdjustTypeForward

Example:

qctx, err := quote.NewFromEnv()
startDate := time.Date(2022, 5, 10, 0, 0, 0, 0, time.UTC)
endDate := time.Date(2022, 6, 10, 0, 0, 0, 0, time.UTC)
klines, err := qctx.HistoryCandlesticksByDate(context.Background(), "AAPL.US", quote.PeriodDay, quote.AdjustTypeNo, &startDate, &endDate)

func (*QuoteContext) HistoryCandlesticksByOffset ΒΆ

func (c *QuoteContext) HistoryCandlesticksByOffset(ctx context.Context, symbol string, period Period, adjustType AdjustType, isForward bool, dateTime *time.Time, count int32, opts ...CandlestickRequestOption) (sticks []*Candlestick, err error)

HistoryCandlesticksByDate obtains the history candlestick data of security within a date range. Reference: https://open.longbridge.com/en/docs/quote/pull/history-candlestick periond support values:

  • quote.PeriodOneMinute - 1m
  • quote.PeriodFiveMinute - 5m
  • quote.PeriodFifteenMinute - 15m
  • quote.PeriodThirtyMinute - 40m
  • quote.PeriodDay - 1 day
  • quote.PeriodWeek - 1 week
  • quote.PeriodMonth - 1 month
  • quote.PeriodYear - 1 year

adjustType support values:

  • quote.AdjustTypeNo
  • quote.AdjustTypeForward

Example:

qctx, err := quote.NewFromEnv()
dateTime := time.Date(2022, 5, 10, 11, 10, 0, 0, time.UTC)
klines, err := qctx.HistoryCandlesticksByOffset(context.Background(), "AAPL.US", quote.PeriodDay, quote.AdjustTypeNo, true, &dateTime, 100)

func (*QuoteContext) Intraday ΒΆ

func (c *QuoteContext) Intraday(ctx context.Context, symbol string) (lines []*IntradayLine, err error)

Intraday obtain the intraday data of security. Reference: https://open.longbridge.com/en/docs/quote/pull/intraday Example:

qctx, err := quote.NewFromEnv()
trades, err := qctx.Intraday(context.Background(), "AAPL.US")

func (*QuoteContext) OnBrokers ΒΆ

func (c *QuoteContext) OnBrokers(f func(*PushBrokers))

OnBrokers set callback function which will be called when server push brokers events.

func (*QuoteContext) OnDepth ΒΆ

func (c *QuoteContext) OnDepth(f func(*PushDepth))

OnDepth set callback function which will be called when server push depth events.

func (*QuoteContext) OnQuote ΒΆ

func (c *QuoteContext) OnQuote(f func(*PushQuote))

OnQuote set callback function which will be called when server push quote events.

func (*QuoteContext) OnTrade ΒΆ

func (c *QuoteContext) OnTrade(f func(*PushTrade))

OnTrade set callback function which will be called when server push trade events.

func (*QuoteContext) OptionChainExpiryDateList ΒΆ

func (c *QuoteContext) OptionChainExpiryDateList(ctx context.Context, symbol string) (times []time.Time, err error)

OptionChainExpiryDateList obtain the the list of expiration dates of option chain Reference: https://open.longbridge.com/en/docs/quote/pull/optionchain-date

Example:

qctx, err := quote.NewFromEnv()
list, err := qctx.OptionChainExpiryDateList(context.Background(), "AAPL.US")

func (*QuoteContext) OptionChainInfoByDate ΒΆ

func (c *QuoteContext) OptionChainInfoByDate(ctx context.Context, symbol string, expiryDate *time.Time) (strikePriceInfos []*StrikePriceInfo, err error)

OptionChainInfoByDate obtain a list of option securities by the option chain expiry date. Reference: https://open.longbridge.com/en/docs/quote/pull/optionchain-date-strike

Example:

qctx, err := quote.NewFromEnv()
date := time.Date(2022, 5, 10, 0, 0, 0, 0, time.UTC)
list, err := qctx.OptionChainInfoByDate(context.Background(), "AAPL.US", &date)

func (*QuoteContext) OptionQuote ΒΆ

func (c *QuoteContext) OptionQuote(ctx context.Context, symbols []string) (optionQuotes []*OptionQuote, err error)

OptionQuote obtain the real-time quotes of US stock options, including the option-specific data. Reference: https://open.longbridge.com/en/docs/quote/pull/option-quote

Example:

qctx, err := quote.NewFromEnv()
optionQuotes, err := qctx.OptionQuote(context.Background(), []string{"AAPL240531P192500.US"})

func (*QuoteContext) OptionVolume ΒΆ added in v0.24.1

func (c *QuoteContext) OptionVolume(ctx context.Context, symbol string) (*OptionVolumeStats, error)

OptionVolume returns aggregated call/put volume stats for a security. Path: GET /v1/quote/option-volume-stats

func (*QuoteContext) OptionVolumeDaily ΒΆ added in v0.24.1

func (c *QuoteContext) OptionVolumeDaily(ctx context.Context, symbol string, start time.Time, end time.Time) ([]*DailyOptionVolume, error)

OptionVolumeDaily returns daily option volume data for a security within a time range. Path: GET /v1/quote/option-volume-stats/daily

func (*QuoteContext) Participants ΒΆ

func (c *QuoteContext) Participants(ctx context.Context) (infos []*ParticipantInfo, err error)

Participants obtain participant IDs data (which can be synchronized once a day). Reference: https://open.longbridge.com/en/docs/quote/pull/broker-ids

Example:

qctx, err := quote.NewFromEnv()
participants, err := qctx.Participants(context.Background())

func (*QuoteContext) Profile ΒΆ

func (c *QuoteContext) Profile() *UserProfile

Profile obtain the user quote profile

func (*QuoteContext) Quote ΒΆ

func (c *QuoteContext) Quote(ctx context.Context, symbols []string) (quotes []*SecurityQuote, err error)

Quote obtain the real-time quotes of securities, and supports all types of securities. Reference: https://open.longbridge.com/en/docs/quote/pull/quote

Example:

qctx, err := quote.NewFromEnv()
quotes, err := qctx.Quote(context.Background(), []string{"AAPL.US"})

func (*QuoteContext) RealtimeBrokers ΒΆ

func (c *QuoteContext) RealtimeBrokers(ctx context.Context, symbol string) (*SecurityBrokers, error)

RealtimeBrokers to get broker infomations on local store

Example:

qctx, err := quote.NewFromEnv()
brokers, err := qctx.RealtimeBrokers(context.Background(), "700.HK")

func (*QuoteContext) RealtimeDepth ΒΆ

func (c *QuoteContext) RealtimeDepth(ctx context.Context, symbol string) (*SecurityDepth, error)

RealtimeDepth to get depth infomations on local store

Example:

qctx, err := quote.NewFromEnv()
depth, err := qctx.RealtimeDepth(context.Background(), "700.HK")

func (*QuoteContext) RealtimeQuote ΒΆ

func (c *QuoteContext) RealtimeQuote(ctx context.Context, symbols []string) ([]*Quote, error)

RealtimeQuote to get quote infomations on local store

Example:

qctx, err := quote.NewFromEnv()
flowlines, err := qctx.RealtimeQuote(context.Background(), []string{"700.HK", "9988.HK"})

func (*QuoteContext) RealtimeTrades ΒΆ

func (c *QuoteContext) RealtimeTrades(ctx context.Context, symbol string) ([]*Trade, error)

RealtimeTrades to get trade infomations on local store

Example:

qctx, err := quote.NewFromEnv()
trades, err := qctx.RealtimeTrades(context.Background(), "700.HK")

func (*QuoteContext) SecurityList ΒΆ

func (c *QuoteContext) SecurityList(ctx context.Context, market openapi.Market, category SecurityListCategory) (list []*Security, err error)

SecurityList used to list securities. Doc: https://open.longbridge.com/en/docs/quote/security/security_list

func (*QuoteContext) ShortPositions ΒΆ added in v0.24.1

func (c *QuoteContext) ShortPositions(ctx context.Context, symbol string, count uint32) (*ShortPositionsResponse, error)

ShortPositions returns short interest / short position data for a US or HK security.

Market is auto-detected from the symbol suffix:

  • ".HK" β†’ GET /v1/quote/short-positions/hk (HKEX daily data)
  • otherwise β†’ GET /v1/quote/short-positions/us (FINRA bi-monthly data)

count controls the number of records returned (1–100, default 20).

func (*QuoteContext) ShortTrades ΒΆ added in v0.24.1

func (c *QuoteContext) ShortTrades(ctx context.Context, symbol string, count uint32) (*ShortTradesResponse, error)

ShortTrades returns short trade records for a HK or US security.

The endpoint is automatically chosen based on the symbol suffix:

  • ".HK" β†’ GET /v1/quote/short-trades/hk
  • ".US" β†’ GET /v1/quote/short-trades/us

func (*QuoteContext) StaticInfo ΒΆ

func (c *QuoteContext) StaticInfo(ctx context.Context, symbols []string) (staticInfos []*StaticInfo, err error)

func (*QuoteContext) Subscribe ΒΆ

func (c *QuoteContext) Subscribe(ctx context.Context, symbols []string, subTypes []SubType, isFirstPush bool) (err error)

Subscribe quote Reference: https://open.longbridge.com/en/docs/quote/subscribe/subscribe

func (*QuoteContext) Subscriptions ΒΆ

func (c *QuoteContext) Subscriptions(ctx context.Context) (subscriptions map[string][]SubType, err error)

Subscriptions obtain the subscription information. Reference: https://open.longbridge.com/en/docs/quote/subscribe/subscription

Example:

qctx, err := quote.NewFromEnv()
subs, err := qctx.Subscriptions(context.Background())

func (*QuoteContext) Trades ΒΆ

func (c *QuoteContext) Trades(ctx context.Context, symbol string, count int32) (trades []*Trade, err error)

Trades obtain the trades data of security. Reference: https://open.longbridge.com/en/docs/quote/pull/trade

Example:

qctx, err := quote.NewFromEnv()
trades, err := qctx.Trades(context.Background())

func (*QuoteContext) TradingDays ΒΆ

func (c *QuoteContext) TradingDays(ctx context.Context, market openapi.Market, begin *time.Time, end *time.Time) (days *MarketTradingDay, err error)

TradingDays obtain the trading days of the market. Reference: https://open.longbridge.com/en/docs/quote/pull/trade-day

Example:

qctx, err := quote.NewFromEnv()
begin := time.Date(2024, 5, 1, 0, 0, 0, 0, time.UTC)
end := time.Date(2024, 6, 1, 0, 0, 0, 0, time.UTC)
days, err := qctx.TradingDays(context.Background(), openapi.MarketUS, &begin, &end)

func (*QuoteContext) TradingSession ΒΆ

func (c *QuoteContext) TradingSession(ctx context.Context) (sessions []*MarketTradingSession, err error)

TradingSession obtain the daily trading hours of each market. Reference: https://open.longbridge.com/en/docs/quote/pull/trade-session

Example:

qctx, err := quote.NewFromEnv()
sess, err := qctx.TradingSession(context.Background())

func (*QuoteContext) Unsubscribe ΒΆ

func (c *QuoteContext) Unsubscribe(ctx context.Context, unSubAll bool, symbols []string, subTypes []SubType) (err error)

Unsubscribe quote Reference: https://open.longbridge.com/en/docs/quote/subscribe/unsubscribe

func (*QuoteContext) UpdatePinned ΒΆ added in v0.24.1

func (c *QuoteContext) UpdatePinned(ctx context.Context, mode PinnedMode, symbols []string) error

UpdatePinned pins or unpins securities in the watchlist. Path: POST /v1/watchlist/pinned

func (*QuoteContext) UpdateWatchlistGroup ΒΆ

func (c *QuoteContext) UpdateWatchlistGroup(ctx context.Context, id int64, name string, symbols []string, mode WatchlistUpdateMode) (err error)

func (*QuoteContext) WarrantIssuers ΒΆ

func (c *QuoteContext) WarrantIssuers(ctx context.Context) (infos []*IssuerInfo, err error)

WarrantIssuers obtain the warrant issuer IDs data (which can be synchronized once a day). Reference: https://open.longbridge.com/en/docs/quote/pull/issuer

Example:

qctx, err := quote.NewFromEnv()
infos, err := qctx.WarrantIssuers(context.Background())

func (*QuoteContext) WarrantList ΒΆ

func (c *QuoteContext) WarrantList(ctx context.Context, symbol string, config WarrantFilter, lang WarrantLanguage) (infos []*WarrantInfo, err error)

WarrantIssuers obtain the quotes of HK warrants, and supports sorting and filtering. Reference: https://open.longbridge.com/en/docs/quote/pull/warrant-filter

Example:

qctx, err := quote.NewFromEnv()
list, err := qctx.WarrantList(context.Background(), "9988.HK", quote.WarrantFilter{
  SortBy: quote.WarrantLastDone,
  SortOrder quote.WarrantAsc,
  SortOffset: 0,
  SortCount: 20,
  Type: []quote.WarrantType{quote.WarrantCall, quote.WarrantPut},
}, quote. WarrantZH_CN)

func (*QuoteContext) WarrantQuote ΒΆ

func (c *QuoteContext) WarrantQuote(ctx context.Context, symbols []string) (warrantQuotes []*WarrantQuote, err error)

WarrantQuote obtain the real-time quotes of HK warrants, including the warrant-specific data. Reference: https://open.longbridge.com/en/docs/quote/pull/warrant-quote

Example:

qctx, err := quote.NewFromEnv()
warrantQuotes, err := qctx.WarrantQuote(context.Background(), []string{"9988.HK"})

func (*QuoteContext) WatchedGroups ΒΆ

func (c *QuoteContext) WatchedGroups(ctx context.Context) (groupList []*WatchedGroup, err error)

type QuoteData ΒΆ

type QuoteData struct {
	Sequence int64
	Quote    *PushQuote
}

type RateLimit ΒΆ

type RateLimit struct {
	Cmd   uint32
	Limit int32
	Burst int32
}

type Security ΒΆ

type Security = jsontypes.Security

Security is base info contains symbol and name

type SecurityBrokers ΒΆ

type SecurityBrokers struct {
	Symbol     string
	AskBrokers []*Brokers
	BidBrokers []*Brokers
}

SecurityBrokers is security brokers details

type SecurityCalcIndex ΒΆ

type SecurityCalcIndex struct {
	Symbol                string
	LastDone              *decimal.Decimal
	ChangeVal             *decimal.Decimal
	ChangeRate            *decimal.Decimal
	Volume                int64
	Turnover              *decimal.Decimal
	YtdChangeRate         *decimal.Decimal
	TurnoverRate          *decimal.Decimal
	TotalMarketValue      *decimal.Decimal
	CapitalFlow           *decimal.Decimal
	Amplitude             *decimal.Decimal
	VolumeRatio           *decimal.Decimal
	PeTtmRatio            *decimal.Decimal
	PbRatio               *decimal.Decimal
	DividendRatioTtm      *decimal.Decimal
	FiveDayChangeRate     *decimal.Decimal
	TenDayChangeRate      *decimal.Decimal
	HalfYearChangeRate    *decimal.Decimal
	FiveMinutesChangeRate *decimal.Decimal
	ExpiryDate            string
	StrikePrice           *decimal.Decimal
	UpperStrikePrice      *decimal.Decimal
	LowerStrikePrice      *decimal.Decimal
	OutstandingQty        *decimal.Decimal
	OutstandingRatio      *decimal.Decimal
	Premium               *decimal.Decimal
	ItmOtm                *decimal.Decimal
	ImpliedVolatility     *decimal.Decimal
	WarrantDelta          *decimal.Decimal
	CallPrice             *decimal.Decimal
	ToCallPrice           *decimal.Decimal
	EffectiveLeverage     *decimal.Decimal
	LeverageRatio         *decimal.Decimal
	ConversionRatio       *decimal.Decimal
	BalancePoint          *decimal.Decimal
	OpenInterest          int64
	Delta                 *decimal.Decimal
	Gamma                 *decimal.Decimal
	Theta                 *decimal.Decimal
	Vega                  *decimal.Decimal
	Rho                   *decimal.Decimal
}

SecurityCalcIndex the infomation of calculate indexes's security

type SecurityDepth ΒΆ

type SecurityDepth struct {
	Symbol string
	Ask    []*Depth
	Bid    []*Depth
}

SecurityDepth

type SecurityListCategory ΒΆ

type SecurityListCategory string
const (
	Overnight SecurityListCategory = "Overnight"
)

type SecurityQuote ΒΆ

type SecurityQuote struct {
	Symbol          string
	LastDone        *decimal.Decimal
	PrevClose       *decimal.Decimal
	Open            *decimal.Decimal
	High            *decimal.Decimal
	Low             *decimal.Decimal
	Timestamp       int64
	Volume          int64
	Turnover        *decimal.Decimal
	TradeStatus     TradeStatus
	PreMarketQuote  *PrePostQuote
	PostMarketQuote *PrePostQuote
	OverNightQuote  *PrePostQuote
}

SecurityQuote is quote details with pre market and post market

type ShortPositionsItem ΒΆ added in v0.24.1

type ShortPositionsItem struct {
	// Timestamp β€” RFC 3339 (e.g. "2024-01-15T00:00:00Z")
	Timestamp string
	// Rate β€” short ratio
	Rate string
	// Close β€” closing price
	Close string
	// [US only] CurrentSharesShort β€” number of short shares outstanding
	CurrentSharesShort string
	// [US only] AvgDailyShareVolume β€” average daily share volume
	AvgDailyShareVolume string
	// [US only] DaysToCover β€” days-to-cover ratio
	DaysToCover string
	// [HK only] Amount β€” short sale amount (HKD)
	Amount string
	// [HK only] Balance β€” short position balance
	Balance string
	// [HK only] Cost β€” closing price (HK naming)
	Cost string
}

ShortPositionsItem is one short-position record, unified for US and HK. US-specific fields (CurrentSharesShort, AvgDailyShareVolume, DaysToCover) are empty for HK records. HK-specific fields (Amount, Balance, Cost) are empty for US records.

type ShortPositionsResponse ΒΆ added in v0.24.1

type ShortPositionsResponse struct {
	Data []*ShortPositionsItem
}

ShortPositionsResponse is the response for QuoteContext.ShortPositions.

type ShortTradesItem ΒΆ added in v0.24.1

type ShortTradesItem struct {
	// Timestamp β€” RFC 3339
	Timestamp string
	// Rate β€” short ratio
	Rate string
	// Close β€” closing price
	Close string
	// [US only] NusAmount β€” NASDAQ short sale volume
	NusAmount string
	// [US only] NyAmount β€” NYSE short sale volume
	NyAmount string
	// [US only] TotalAmount β€” total trading volume
	TotalAmount string
	// [HK only] Amount β€” short sale turnover amount (HKD)
	Amount string
	// [HK only] Balance β€” short position balance
	Balance string
}

ShortTradesItem is one short-trade record, unified for US and HK.

type ShortTradesResponse ΒΆ added in v0.24.1

type ShortTradesResponse struct {
	Data []*ShortTradesItem
}

ShortTradesResponse is the response for QuoteContext.ShortTrades.

type StaticInfo ΒΆ

type StaticInfo struct {
	Symbol            string
	NameCn            string
	NameEn            string
	NameHk            string
	Exchange          string
	Currency          string
	LotSize           int32
	TotalShares       int64
	CirculatingShares int64
	HkShares          int64
	Eps               *decimal.Decimal
	EpsTtm            *decimal.Decimal
	Bps               *decimal.Decimal
	DividendYield     string
	StockDerivatives  []int32
}

StaticInfo store static details

type StrikePriceInfo ΒΆ

type StrikePriceInfo struct {
	Price      *decimal.Decimal
	CallSymbol string
	PutSymbol  string
	Standard   bool
}

StrikePriceInfo is strike price details

type SubType ΒΆ

type SubType uint8

type Trade ΒΆ

type Trade struct {
	Price     string
	Volume    int64
	Timestamp int64
	// TradeType
	// HK
	//
	// - `*` - Overseas trade
	// - `D` - Odd-lot trade
	// - `M` - Non-direct off-exchange trade
	// - `P` - Late trade (Off-exchange previous day)
	// - `U` - Auction trade
	// - `X` - Direct off-exchange trade
	// - `Y` - Automatch internalized
	// - `<empty string>` -  Automatch normal
	//
	// US
	//
	// - `<empty string>` - Regular sale
	// - `A` - Acquisition
	// - `B` - Bunched trade
	// - `D` - Distribution
	// - `F` - Intermarket sweep
	// - `G` - Bunched sold trades
	// - `H` - Price variation trade
	// - `I` - Odd lot trade
	// - `K` - Rule 155 trde(NYSE MKT)
	// - `M` - Market center close price
	// - `P` - Prior reference price
	// - `Q` - Market center open price
	// - `S` - Split trade
	// - `V` - Contingent trade
	// - `W` - Average price trade
	// - `X` - Cross trade
	// - `1` - Stopped stock(Regular trade)
	TradeType    string
	Direction    int32
	TradeSession TradeSession
}

Trade store trade details

type TradeDate ΒΆ

type TradeDate struct {
	Date          string
	TradeDateType int32 // 0 full day, 1 morning only, 2 afternoon only(not happened before)
}

TradeDate

type TradePeriod ΒΆ

type TradePeriod struct {
	BegTime      int32
	EndTime      int32
	TradeSession TradeSession
}

TradePeriod

type TradeSession ΒΆ

type TradeSession int32

type TradeSessionType ΒΆ

type TradeSessionType int32

type TradeStatus ΒΆ

type TradeStatus int32

type TradesData ΒΆ

type TradesData struct {
	Sequence int64
	Trades   []*Trade
}

type UserProfile ΒΆ

type UserProfile struct {
	MemberId                int64
	QuoteLevel              string
	SubscribeLimit          int32
	HistoryCandlestickLimit int32
	RateLimit               []*RateLimit
	QuoteLevelDetail        *UserQuoteLevelDetail
}

type UserQuoteLevelDetail ΒΆ

type UserQuoteLevelDetail struct {
	ByPackageKey map[string]*PackageDetail
	ByMarketCode map[string]*MarketPackageDetail
}

type WarrantExpiryDateType ΒΆ

type WarrantExpiryDateType int32
const (
	WarrantLT3    WarrantExpiryDateType = iota + 1 // Less than three months
	WarrantBT3_6                                   // between three and six months
	WarrantBT6_12                                  // between six and twelve months
	WarrantGT12                                    // greate than twelve months
)

type WarrantExtend ΒΆ

type WarrantExtend struct {
	ImpliedVolatility string
	ExpiryDate        string
	LastTradeDate     string
	OutstandingRatio  string
	OutstandingQty    int64
	ConversionRatio   string
	Category          string
	StrikePrice       *decimal.Decimal
	UpperStrikePrice  *decimal.Decimal
	LowerStrikePrice  *decimal.Decimal
	CallPrice         *decimal.Decimal
	UnderlyingSymbol  string
}

WarrantExtend is warrant extended properties

type WarrantFilter ΒΆ

type WarrantFilter struct {
	SortBy     WarrantSortBy
	SortOrder  WarrantSortOrder
	SortOffset int32
	SortCount  int32
	Type       []WarrantType
	Issuer     []int32
	ExpiryDate []WarrantExpiryDateType
	PriceType  []WarrantInOutBoundsType
	Status     []WarrantStatus
	Language   WarrantLanguage
}

type WarrantInOutBoundsType ΒΆ

type WarrantInOutBoundsType int32
const (
	WarrantInBounds WarrantInOutBoundsType = iota + 1
	WarrantOutBounds
)

type WarrantInfo ΒΆ

type WarrantInfo struct {
	Symbol            string
	Name              string
	LastDone          *decimal.Decimal
	ChangeRate        *decimal.Decimal
	ChangeVal         *decimal.Decimal
	Volume            int64
	Turnover          *decimal.Decimal
	ExpiryDate        string
	StrikePrice       *decimal.Decimal
	UpperStrikePrice  *decimal.Decimal
	LowerStrikePrice  *decimal.Decimal
	OutstandingQty    *decimal.Decimal
	OutstandingRatio  *decimal.Decimal
	Premium           *decimal.Decimal
	ItmOtm            *decimal.Decimal
	ImpliedVolatility *decimal.Decimal
	Delta             *decimal.Decimal
	CallPrice         *decimal.Decimal
	ToCallPrice       *decimal.Decimal
	EffectiveLeverage *decimal.Decimal
	LeverageRatio     *decimal.Decimal
	ConversionRatio   *decimal.Decimal
	BalancePoint      *decimal.Decimal
	Status            WarrantStatus
}

WarrantInfo is info of warrant asset

type WarrantLanguage ΒΆ

type WarrantLanguage int32
const (
	WarrantZH_CN WarrantLanguage = iota
	WarrantEN
	WarrantHK_CN
)

type WarrantQuote ΒΆ

type WarrantQuote struct {
	Symbol        string
	LastDone      *decimal.Decimal
	PrevClose     *decimal.Decimal
	Open          *decimal.Decimal
	High          *decimal.Decimal
	Low           *decimal.Decimal
	Timestamp     int64
	Volume        int64
	Turnover      *decimal.Decimal
	TradeStatus   TradeStatus
	WarrantExtend *WarrantExtend
}

WarrantQuote is warrant quote details

type WarrantSortBy ΒΆ

type WarrantSortBy int32
const (
	WarrantLastDone WarrantSortBy = iota
	WarrantChangeRate
	WarrantChangeVal
	WarrantVolume
	WarrantTurnover
	WarrantExpiryDate
	WarrantStrikePrice
	WarrantUpperStrikePrice
	WarrantLowerStrikePrice
	WarrantOutstandingQty
	WarrantOutstandingRatio
	WarrantPremiun
	WarrantItmOtm
	WarrantImpliedVolatility
	WarrantDelta
	WarrantCallPrice
	WarrantToCallPrice
	WarrantEffectiveLeverage
	WarrantLeverageRatio
	WarrantConversionRatio
	WarrantBalancePoint
	WarrantSortStatus
)

type WarrantSortOrder ΒΆ

type WarrantSortOrder int32
const (
	WarrantAsc WarrantSortOrder = iota
	WarrantDesc
)

type WarrantStatus ΒΆ

type WarrantStatus int32
const (
	WarrantSuspend    WarrantStatus = iota + 2 // can't trade
	WarrantPapareList                          // wait to be listed
	WarrantNormal                              // Tradable
)

Warrant status

type WarrantType ΒΆ

type WarrantType int32
const (
	WarrantCall WarrantType = iota
	WarrantPut
	WarrantBull
	WarrantBear
	WarrantInline
)

type WatchedGroup ΒΆ

type WatchedGroup struct {
	Id        int64  // group id
	Name      string // group name
	Securites []*WatchedSecurity
}

WatchedGroup a group of the security is watched

type WatchedSecurity ΒΆ

type WatchedSecurity struct {
	Symbol    string
	Market    string
	Name      string
	Price     *decimal.Decimal
	WatchedAt int64 // timestamp
	IsPinned  bool
}

WatchedSecurity the security is watched

type WatchlistUpdateMode ΒΆ

type WatchlistUpdateMode string
const (
	// AddWatchlist will add securities to watchlist group
	AddWatchlist WatchlistUpdateMode = "add"
	// RemoveWatchlist will remove securities from watchlist group
	RemoveWatchlist WatchlistUpdateMode = "remove"
	// ReplaceWatchlist will replace securities in watchlist group
	// For example:
	//   If the original group contains APPL.US, BABA.US, TSLA.US,
	//   and it is updated with ["BABA.US", "AAPL.US", "MSFT.US"],
	//   it will become BABA.US, AAPL.US, MSFT.US,
	//   removing TSLA.US and adding MSFT.US, while adjusting the order of BABA.US and AAPL.US.
	ReplaceWatchlist WatchlistUpdateMode = "replace"
)

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

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