Documentation ¶
Overview ¶
Package marketdata contains code to assist in building services that handle market data.
Index ¶
- Constants
- func NewMarketDataSource(quoteDistributor quoteDistributor) marketdatasource.MarketDataSourceServer
- type ConflatedQuoteStream
- type DistributorQuoteStream
- type GetMdsClientFn
- type GrpcConnection
- type MdsQuoteStream
- type QuoteDistributor
- type QuoteSource
- type QuoteStream
- func NewMdsQuoteStreamFromFn(parentCtx context.Context, id string, targetAddress string, outBufferSize int, ...) (QuoteStream, error)
- func NewQuoteStreamFromMarketDataService(ctx context.Context, subscriberId string, targetAddress string, ...) (QuoteStream, error)
- func NewQuoteStreamFromMdSource(ctx context.Context, id string, targetAddress string, ...) (QuoteStream, error)
Constants ¶
const SubscriberIdKey = "subscriber_id"
Variables ¶
This section is empty.
Functions ¶
func NewMarketDataSource ¶
func NewMarketDataSource(quoteDistributor quoteDistributor) marketdatasource.MarketDataSourceServer
Types ¶
type ConflatedQuoteStream ¶ added in v1.3.0
type ConflatedQuoteStream struct {
// contains filtered or unexported fields
}
ConflatedQuoteStream conflates quotes from a quote stream such that the most recent quote for a listing is read from the stream even if the client is reading quotes at a slower rate than they are being published.
func NewConflatedQuoteStream ¶
func NewConflatedQuoteStream(id string, stream QuoteStream, maxSubscriptions int) *ConflatedQuoteStream
func (*ConflatedQuoteStream) Chan ¶ added in v1.3.0
func (c *ConflatedQuoteStream) Chan() <-chan *model.ClobQuote
func (*ConflatedQuoteStream) Close ¶ added in v1.3.0
func (c *ConflatedQuoteStream) Close()
func (*ConflatedQuoteStream) Subscribe ¶ added in v1.3.0
func (c *ConflatedQuoteStream) Subscribe(listingId int32) error
type DistributorQuoteStream ¶ added in v1.3.0
type DistributorQuoteStream struct {
// contains filtered or unexported fields
}
func (*DistributorQuoteStream) Chan ¶ added in v1.3.0
func (q *DistributorQuoteStream) Chan() <-chan *model.ClobQuote
func (*DistributorQuoteStream) Close ¶ added in v1.3.0
func (q *DistributorQuoteStream) Close()
func (*DistributorQuoteStream) Subscribe ¶ added in v1.3.0
func (q *DistributorQuoteStream) Subscribe(listingId int32) error
type GetMdsClientFn ¶
type GetMdsClientFn = func(targetAddress string) (commonMds, GrpcConnection, error)
type GrpcConnection ¶
type GrpcConnection interface { GetState() connectivity.State WaitForStateChange(ctx context.Context, sourceState connectivity.State) bool }
type MdsQuoteStream ¶
type MdsQuoteStream struct {
// contains filtered or unexported fields
}
MdsQuoteStream wraps the API of a market data service such that it conforms to the QuoteStream interface.
func (*MdsQuoteStream) Chan ¶ added in v1.3.0
func (m *MdsQuoteStream) Chan() <-chan *model.ClobQuote
func (*MdsQuoteStream) Close ¶
func (m *MdsQuoteStream) Close()
func (*MdsQuoteStream) Subscribe ¶
func (m *MdsQuoteStream) Subscribe(listingId int32) error
type QuoteDistributor ¶
type QuoteDistributor struct {
// contains filtered or unexported fields
}
QuoteDistributor fans out quote data sourced from a quote stream to multiple clients.
func NewQuoteDistributor ¶
func NewQuoteDistributor(ctx context.Context, stream QuoteStream, sendBufferSize int) *QuoteDistributor
func (*QuoteDistributor) NewQuoteStream ¶ added in v1.3.0
func (q *QuoteDistributor) NewQuoteStream() *DistributorQuoteStream
type QuoteSource ¶
type QuoteSource interface {
Subscribe(listingId int)
}
type QuoteStream ¶ added in v1.3.0
type QuoteStream interface { // Subscribe to quotes for the given listing id. Subscribe(listingId int32) error // Chan returns a channel that will receive quotes for the subscribed listings. Chan() <-chan *model.ClobQuote // Close the quote stream. Close() }
QuoteStream is a standardised interface for quote stream interaction.
func NewMdsQuoteStreamFromFn ¶
func NewMdsQuoteStreamFromFn(parentCtx context.Context, id string, targetAddress string, outBufferSize int, getConnection GetMdsClientFn) (QuoteStream, error)
func NewQuoteStreamFromMarketDataService ¶ added in v1.3.0
func NewQuoteStreamFromMarketDataService(ctx context.Context, subscriberId string, targetAddress string, maxReconnectInterval time.Duration, quoteBufferSize int) (QuoteStream, error)
NewQuoteStreamFromMarketDataService returns a quote stream that sources quote data from a market data service.