Documentation
¶
Index ¶
- Constants
- Variables
- type AuthenticationError
- type Available
- func (available *Available) AppendPrice(update []float64)
- func (available *Available) Clear()
- func (available *Available) RemovePrice(i int)
- func (available *Available) Sort()
- func (available *Available) Update(updates [][]float64)
- func (available *Available) UpdatePrice(count int, update []float64)
- type AvailableInterface
- type AvailablePosition
- func (available *AvailablePosition) AppendPrice(update []float64)
- func (available *AvailablePosition) Clear()
- func (available *AvailablePosition) RemovePrice(i int)
- func (available *AvailablePosition) Sort()
- func (available *AvailablePosition) Update(updates [][]float64)
- func (available *AvailablePosition) UpdatePrice(count int, update []float64)
- type ByPosition
- type ByPrice
- type CachedMarkets
- type CachedOrders
- type ConnectionError
- type EndpointError
- type ExchangePrices
- type IMarketHandler
- type IOrderHandler
- type MarketBook
- type MarketCache
- type MarketDataFilterFlag
- type MarketSubscriptionResponse
- type NoConnectionError
- type OrderBookCache
- type PositionPriceSize
- type PriceSize
- type Runner
- type RunnerCache
- type Stream
- type StreamChannels
Constants ¶
const ( LiveEndpoint = "stream-api.betfair.com:443" IntegrationEndpoint = "stream-api-integration.betfair.com:443" )
const MaxSubscriptionLimit = 200
MarketSubscriptionLimit is the max number of markets that can be subscribed to via the Betfair Stream API
Variables ¶
var MarketDataFilterEnum = struct { ExBestOffersDisp, ExBestOffers, ExAllOffers, ExTraded, ExTradedVol, ExLTP, ExMarketDef, SPTraded, SPProjected MarketDataFilterFlag }{ ExBestOffersDisp: "EX_BEST_OFFERS_DISP", ExBestOffers: "EX_BEST_OFFERS", ExAllOffers: "EX_ALL_OFFERS", ExTraded: "EX_TRADED", ExTradedVol: "EX_TRADED_VOL", ExLTP: "EX_LTP", ExMarketDef: "EX_MARKET_DEF", SPTraded: "SP_TRADED", SPProjected: "SP_PROJECTED", }
MarketDataFilterEnum describes the various field flags that can be passed in to the "fields" array of a MarketSubscription. see https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Exchange+Stream+API#ExchangeStreamAPI-Marketdatafieldfiltering/MarketDataFilter
Functions ¶
This section is empty.
Types ¶
type AuthenticationError ¶
type AuthenticationError struct{}
func (*AuthenticationError) Error ¶
func (err *AuthenticationError) Error() string
type Available ¶
func (*Available) AppendPrice ¶
func (*Available) RemovePrice ¶
func (*Available) UpdatePrice ¶
type AvailableInterface ¶
type AvailablePosition ¶
type AvailablePosition struct {
Prices ByPosition
Reverse bool
}
func (*AvailablePosition) AppendPrice ¶
func (available *AvailablePosition) AppendPrice(update []float64)
func (*AvailablePosition) Clear ¶
func (available *AvailablePosition) Clear()
func (*AvailablePosition) RemovePrice ¶
func (available *AvailablePosition) RemovePrice(i int)
func (*AvailablePosition) Sort ¶
func (available *AvailablePosition) Sort()
func (*AvailablePosition) Update ¶
func (available *AvailablePosition) Update(updates [][]float64)
func (*AvailablePosition) UpdatePrice ¶
func (available *AvailablePosition) UpdatePrice(count int, update []float64)
type ByPosition ¶
type ByPosition []PositionPriceSize
sort.Interface for []PositionPriceSize based on position
func (ByPosition) GetLastItem ¶
func (a ByPosition) GetLastItem() PositionPriceSize
func (ByPosition) Len ¶
func (a ByPosition) Len() int
func (ByPosition) Less ¶
func (a ByPosition) Less(i, j int) bool
func (ByPosition) Swap ¶
func (a ByPosition) Swap(i, j int)
type ByPrice ¶
type ByPrice []PriceSize
sort.Interface for []PriceSize based on price
func (ByPrice) GetLastItem ¶
type CachedMarkets ¶
type CachedMarkets map[string]*MarketCache
type CachedOrders ¶
type CachedOrders map[string]*OrderBookCache
CachedOrders maps MarketID's to Orders on the Exchange
type ConnectionError ¶
type ConnectionError struct{}
func (*ConnectionError) Error ¶
func (err *ConnectionError) Error() string
type EndpointError ¶
type EndpointError struct{}
func (*EndpointError) Error ¶
func (err *EndpointError) Error() string
type ExchangePrices ¶
type ExchangePrices struct {
BestAvailableToBack PositionPriceSize
BestAvailableToLay PositionPriceSize
AvailableToBack PriceSize
AvailableToLay PriceSize
TradedVolume PriceSize
}
type IMarketHandler ¶
type IMarketHandler interface {
OnSubscribe(ChangeMessage models.MarketChangeMessage)
OnResubscribe(ChangeMessage models.MarketChangeMessage)
OnHeartbeat(ChangeMessage models.MarketChangeMessage)
OnUpdate(ChangeMessage models.MarketChangeMessage)
}
type IOrderHandler ¶
type IOrderHandler interface {
OnSubscribe(ChangeMessage models.OrderChangeMessage)
OnResubscribe(ChangeMessage models.OrderChangeMessage)
OnHeartbeat(ChangeMessage models.OrderChangeMessage)
OnUpdate(ChangeMessage models.OrderChangeMessage)
}
type MarketBook ¶
type MarketCache ¶
type MarketCache struct {
PublishTime *int64
MarketID string
TradedVolume *float64
MarketDefinition *models.MarketDefinition
Runners map[int64]RunnerCache
}
func (*MarketCache) GetRunnerDefinition ¶
func (cache *MarketCache) GetRunnerDefinition(selectionId int64) models.RunnerDefinition
func (*MarketCache) Snap ¶
func (cache *MarketCache) Snap() MarketBook
func (*MarketCache) UpdateCache ¶
func (cache *MarketCache) UpdateCache(changeMessage *models.MarketChangeMessage, marketChange *models.MarketChange)
type MarketDataFilterFlag ¶
type MarketDataFilterFlag string
type MarketSubscriptionResponse ¶
type MarketSubscriptionResponse struct {
SubscribedMarketIDs []string
}
type NoConnectionError ¶
type NoConnectionError struct{}
func (*NoConnectionError) Error ¶
func (err *NoConnectionError) Error() string
type OrderBookCache ¶
type OrderBookCache struct {
MarketID string
LastPublishTime int64
Runners map[int64]*models.OrderRunnerChange
Closed bool
}
func (*OrderBookCache) Snap ¶
func (cache *OrderBookCache) Snap() *OrderBookCache
type PositionPriceSize ¶
type RunnerCache ¶
type RunnerCache struct {
SelectionId int64
LastTradedPrice *float64
TradedVolume *float64
StartingPriceNear *float64
StartingPriceFar *float64
Traded *Available
AvailableToBack *Available
AvailableToLay *Available
StartingPriceBack *Available
StartingPriceLay *Available
BestAvailableToBack *AvailablePosition
BestAvailableToLay *AvailablePosition
BestDisplayAvailableToBack *AvailablePosition
BestDisplayAvailableToLay *AvailablePosition
}
func (*RunnerCache) Snap ¶
func (cache *RunnerCache) Snap(definition models.RunnerDefinition) Runner
func (*RunnerCache) UpdateCache ¶
func (cache *RunnerCache) UpdateCache(change *models.RunnerChange)
type Stream ¶
type Stream struct {
MarketCache CachedMarkets
OrderCache CachedOrders
Channels *StreamChannels
// contains filtered or unexported fields
}
func NewStream ¶
func NewStream(certs *tls.Certificate, appKey string) (*Stream, error)
NewStream generates a Stream object which can be subsequently used to connect to an Exchange Stream endpoint
func (*Stream) Start ¶
Start performs the Connection and Authentication steps and initializes the read/write goroutines
func (*Stream) Stop ¶
func (stream *Stream) Stop()
Stop tears down the underlying TLS session to the Streaming endpoint
func (*Stream) SubscribeToMarkets ¶
func (stream *Stream) SubscribeToMarkets(marketFilter *models.MarketFilter, marketDataFilter *models.MarketDataFilter)
func (*Stream) SubscribeToOrders ¶
func (stream *Stream) SubscribeToOrders()
type StreamChannels ¶
type StreamChannels struct {
// Incoming Responses
Err chan error
MarketUpdate chan MarketBook
OrderUpdate chan OrderBookCache
Status chan models.StatusMessage
// contains filtered or unexported fields
}