Documentation
¶
Index ¶
- Constants
- func GetTLSConfig(certFilePath string, keyFilePath string) (*tls.Config, error)
- func GetTLSConfigFromBytes(certBytes, keyBytes []byte) (*tls.Config, error)
- func ReadJson(res *http.Response, response any) error
- func ReadStream[T any](connection *tls.Conn) chan T
- type ActionPerformed
- type AuthenticationMessage
- type BetDelayModel
- type BetStatus
- type BetTargetType
- type BettingType
- type CancelInstruction
- type CancelOrdersInstructionReport
- type CancelOrdersParams
- type CancelOrdersReport
- type ChangeType
- type Client
- func (client *Client) CancelOrders(ctx context.Context, params CancelOrdersParams) (CancelOrdersReport, error)
- func (client *Client) Do(req *http.Request) (*http.Response, error)
- func (client *Client) GetAccountDetails(ctx context.Context) (GetAccountDetailsResponse, error)
- func (client *Client) GetAccountFunds(ctx context.Context, params GetAccountFundsParams) (GetAccountFundsResponse, error)
- func (client *Client) GetAccountStatement(ctx context.Context, params GetAccountStatementParams) (GetAccountStatementReport, error)
- func (client *Client) GetAccounts(ctx context.Context, method string, params any, response any) error
- func (client *Client) GetDeveloperAppKeys(ctx context.Context) ([]GetDeveloperAppKeysResult, error)
- func (client *Client) GetHeartbeats(ctx context.Context, method string, params any, response any) error
- func (client *Client) GetScores(ctx context.Context, method string, params any, response any) error
- func (client *Client) GetSports(ctx context.Context, method string, params any, response any) error
- func (client *Client) GetStream(config *StreamingClientConfig) (*StreamingClient, error)
- func (client *Client) Heartbeat(ctx context.Context, params HeartbeatParams) (HeartbeatReport, error)
- func (client *Client) KeepAlive(ctx context.Context) (*KeepAliveResponse, error)
- func (client *Client) ListClearedOrders(ctx context.Context, params ListClearedOrdersParams) (ListClearedOrdersReport, error)
- func (client *Client) ListCompetitions(ctx context.Context, params ListCompetitionsParams) ([]ListCompetitionsResult, error)
- func (client *Client) ListCountries(ctx context.Context, params ListCountriesParams) ([]ListCountriesResult, error)
- func (client *Client) ListCurrencyRates(ctx context.Context, params ListCurrencyRatesParams) ([]ListCurrencyRatesResult, error)
- func (client *Client) ListCurrentOrders(ctx context.Context, params ListCurrentOrdersParams) (ListCurrentOrdersReport, error)
- func (client *Client) ListEventTypes(ctx context.Context, params ListEventTypesParams) ([]ListEventTypesResult, error)
- func (client *Client) ListEvents(ctx context.Context, params ListEventsParams) ([]ListEventsResult, error)
- func (client *Client) ListMarketBook(ctx context.Context, params ListMarketBookParams) ([]ListMarketBookResult, error)
- func (client *Client) ListMarketCatalogue(ctx context.Context, params ListMarketCatalogueParams) ([]ListMarketCatalogueResult, error)
- func (client *Client) ListMarketProfitAndLoss(ctx context.Context, params ListMarketProfitAndLossParams) ([]ListMarketProfitAndLossResult, error)
- func (client *Client) ListMarketTypes(ctx context.Context, params ListMarketTypesParams) ([]ListMarketTypesResult, error)
- func (client *Client) ListRaceDetails(ctx context.Context, params ListRaceDetailsParams) ([]ListRaceDetailsResult, error)
- func (client *Client) ListRunnerBook(ctx context.Context, params ListRunnerBookParams) ([]ListRunnerBookResult, error)
- func (client *Client) ListTimeRanges(ctx context.Context, params ListTimeRangesParams) ([]ListTimeRangesResult, error)
- func (client *Client) ListVenues(ctx context.Context, params ListVenuesParams) ([]ListVenuesResult, error)
- func (client *Client) Login(ctx context.Context, username string, password string) (*LoginResponse, error)
- func (client *Client) Logout(ctx context.Context) (*LogoutResponse, error)
- func (client *Client) PlaceOrders(ctx context.Context, params PlaceOrdersParams) (PlaceOrdersReport, error)
- func (client *Client) ReplaceOrders(ctx context.Context, params ReplaceOrdersParams) (ReplaceOrdersReport, error)
- func (client *Client) Resume(ctx context.Context, sessionToken string) (*ResumeResponse, error)
- func (client *Client) UpdateOrders(ctx context.Context, params UpdateOrdersParams) (UpdateOrdersReport, error)
- type ClientConfig
- type Competition
- type ConnectionMessage
- type CurrencyRate
- type CurrentItemDescription
- type DeveloperApp
- type DeveloperAppVersion
- type Event
- type EventType
- type ExchangePrices
- type ExecutionReportErrorCode
- type ExecutionReportStatus
- type GetAccountDetailsResponse
- type GetAccountFundsParams
- type GetAccountFundsResponse
- type GetAccountStatementParams
- type GetAccountStatementReport
- type GetAccountStatementResult
- type GetDeveloperAppKeysResult
- type GroupBy
- type HeartbeatParams
- type HeartbeatReport
- type IncludeItem
- type InstructionReportErrorCode
- type InstructionReportStatus
- type ItemClass
- type ItemDescription
- type JsonAPINGException
- type JsonAPINGExceptionErrorCode
- type JsonData
- type JsonError
- type JsonRPC
- type JsonRestErrorResponse
- type JsonRpcResponse
- type Jurisdiction
- type KeepAliveResponse
- type KeyLineDescription
- type KeyLineSelection
- type LimitOnCloseOrder
- type LimitOrder
- type ListClearedOrdersParams
- type ListClearedOrdersReport
- type ListClearedOrdersResult
- type ListCompetitionsParams
- type ListCompetitionsResult
- type ListCountriesParams
- type ListCountriesResult
- type ListCurrencyRatesParams
- type ListCurrencyRatesResult
- type ListCurrentOrdersParams
- type ListCurrentOrdersReport
- type ListCurrentOrdersResult
- type ListEventTypesParams
- type ListEventTypesResult
- type ListEventsParams
- type ListEventsResult
- type ListMarketBookParams
- type ListMarketBookResult
- type ListMarketCatalogueParams
- type ListMarketCatalogueResult
- type ListMarketProfitAndLossParams
- type ListMarketProfitAndLossResult
- type ListMarketTypesParams
- type ListMarketTypesResult
- type ListRaceDetailsParams
- type ListRaceDetailsResult
- type ListRunnerBookParams
- type ListRunnerBookResult
- type ListTimeRangesParams
- type ListTimeRangesResult
- type ListVenuesParams
- type ListVenuesResult
- type LoginResponse
- type LoginStatus
- type LogoutResponse
- type MarketBettingType
- type MarketBook
- type MarketChange
- type MarketChangeMessage
- type MarketDataFilter
- type MarketDataFilterField
- type MarketDefinition
- type MarketDescription
- type MarketFilter
- type MarketLineRangeInfo
- type MarketOnCloseOrder
- type MarketProfitAndLoss
- type MarketProjection
- type MarketSort
- type MarketStatus
- type MarketSubscriptionMessage
- type MarketType
- type MarketVersion
- type Match
- type MatchProjection
- type OffersOverrides
- type Order
- type OrderAccountChange
- type OrderBy
- type OrderChange
- type OrderChangeMessage
- type OrderFilter
- type OrderProjection
- type OrderStatus
- type OrderSubscriptionMessage
- type OrderType
- type PersistenceType
- type PlaceInstruction
- type PlaceOrdersInstructionReport
- type PlaceOrdersParams
- type PlaceOrdersReport
- type PriceData
- type PriceLadderDefinition
- type PriceLadderDescription
- type PriceLadderType
- type PriceProjection
- type PriceSize
- type RaceStatus
- type RaceType
- type ReplaceInstruction
- type ReplaceOrdersInstructionReport
- type ReplaceOrdersParams
- type ReplaceOrdersReport
- type ResponseCode
- type ResumeResponse
- type RollupModel
- type Runner
- type RunnerCatalog
- type RunnerChange
- type RunnerProfitAndLoss
- type RunnerStatus
- type SegmentType
- type SessionStatus
- type SessionStatusError
- type SessionStatusResponse
- type Side
- type SortDir
- type StartingPrices
- type StatementLegacyData
- type StatusMessage
- type StatusMessageErrorCode
- type StreamMarketFilter
- type StreamingClient
- func (client *StreamingClient) Authenticate(config *tls.Config, applicationKey, sessionToken string) (err error)
- func (client *StreamingClient) Close() error
- func (client *StreamingClient) Read(response any) error
- func (client *StreamingClient) SubscribeToMarkets(marketFilter StreamMarketFilter, marketDataFilter MarketDataFilter) (chan MarketChangeMessage, error)
- func (client *StreamingClient) SubscribeToOrders(orderFilter OrderFilter) (chan OrderChangeMessage, error)
- func (client *StreamingClient) Write(request any, isRequest bool) error
- type StreamingClientConfig
- type TimeGranularity
- type TimeInForce
- type TimeRange
- type UnmatchedOrder
- type UpdateInstruction
- type UpdateOrdersInstructionReport
- type UpdateOrdersParams
- type UpdateOrdersReport
- type Wallet
- type WinLose
Constants ¶
const ( RM_STAKE = "STAKE" RM_PAYOUT = "PAYOUT" RM_NONE = "NONE" )
Variables ¶
This section is empty.
Functions ¶
func GetTLSConfigFromBytes ¶
func ReadStream ¶
Types ¶
type ActionPerformed ¶
type ActionPerformed string
ActionPerformed is the action performed since your last heartbeat request.
const ( AP_NONE ActionPerformed = "NONE" // AP_NONE indicates no action was performed since last heartbeat, or this is the first heartbeat. AP_CANCELLATION_REQUEST_SUBMITTED ActionPerformed = "CANCELLATION_REQUEST_SUBMITTED" // AP_CANCELLATION_REQUEST_SUBMITTED indicates a request to cancel all unmatched bets was submitted since last heartbeat. AP_ALL_BETS_CANCELLED ActionPerformed = "ALL_BETS_CANCELLED" // AP_ALL_BETS_CANCELLED indicates all unmatched bets were cancelled since last heartbeat. AP_SOME_BETS_NOT_CANCELLED ActionPerformed = "SOME_BETS_NOT_CANCELLED" // AP_SOME_BETS_NOT_CANCELLED indicates not all unmatched bets were cancelled since last heartbeat. AP_CANCELLATION_REQUEST_ERROR ActionPerformed = "CANCELLATION_REQUEST_ERROR" // AP_CANCELLATION_REQUEST_ERROR indicates there was an error requesting cancellation, no bets have been cancelled. AP_CANCELLATION_STATUS_UNKNOWN ActionPerformed = "CANCELLATION_STATUS_UNKNOWN" // AP_CANCELLATION_STATUS_UNKNOWN indicates there was no response from requesting cancellation, cancellation status unknown. )
type AuthenticationMessage ¶
type BetDelayModel ¶
type BetDelayModel string
BetDelayModel indicates which bet delay models are applied to a market if applicable.
const ( BDM_PASSIVE BetDelayModel = "PASSIVE" // For in-play markets where betDelay > 0, orders that are guaranteed not to match immediately are accepted straight away, bypassing the bet delay wait. Order requirements (otherwise bets will be subject to the usual bet delay before being placed). Only plain LIMIT orders are supported. Allowed persistenceType: LAPSE. The following attributes are not supported and must be omitted: timeInForce, minFillSize, betTargetType. BDM_DYNAMIC BetDelayModel = "DYNAMIC" // Indicates market is subject to dynamic in-play bet delays. This mean that the in-play betDelay will vary while the market is turned in-play. Please note: Currently returned for Tennis markets only. Specifically, every game 3,5,7,9,11 or game which decides a set (potentially 6,8,10,12) the betDelay is reduced to 1 second. )
type BetStatus ¶
type BetStatus string
BetStatus restricts the results to the specified status.
const ( BS_SETTLED BetStatus = "SETTLED" // BS_SETTLED is a matched bet that was settled normally. BS_VOIDED BetStatus = "VOIDED" // BS_VOIDED is a matched bet that was subsequently voided by Betfair, before, during or after settlement. BS_LAPSED BetStatus = "LAPSED" // BS_LAPSED is an unmatched bet that was cancelled by Betfair (for example at turn in play). BS_CANCELLED BetStatus = "CANCELLED" // BS_CANCELLED is an unmatched bet that was cancelled by an explicit customer action. )
type BetTargetType ¶
type BetTargetType string
BetTargetType is an optional field to allow betting to a targeted PAYOUT or BACKERS_PROFIT.
const ( BTT_BACKER_PROFIT BetTargetType = "BACKERS_PROFIT" // BTT_BACKER_PROFIT is the payout requested minus the calculated size at which this LimitOrder is to be placed. BetTargetType bets are invalid for LINE markets. BTT_PAYOUT BetTargetType = "PAYOUT" // BTT_PAYOUT is the total payout requested on a LimitOrder. )
type BettingType ¶
type BettingType string
BettingType restricts Exchange Stream API markets by betting type.
const ( BT_ODDS BettingType = "ODDS" // Odds Market - Any market that doesn't fit any any of the below categories. BT_LINE BettingType = "LINE" // Line Market - LINE markets operate at even-money odds of 2.0. However, price for these markets refers to the line positions available as defined by the markets min-max range and interval steps. Customers either Buy a line (LAY bet, winning if outcome is greater than the taken line (price)) or Sell a line (BACK bet, winning if outcome is less than the taken line (price)). If settled outcome equals the taken line, stake is returned. BT_RANGE BettingType = "RANGE" // Range Market - Now Deprecated. BT_ASIAN_HANDICAP_DOUBLE_LINE BettingType = "ASIAN_HANDICAP_DOUBLE_LINE" // Asian Handicap Market - A traditional Asian handicap market. Can be identified by marketType ASIAN_HANDICAP. BT_ASIAN_HANDICAP_SINGLE_LINE BettingType = "ASIAN_HANDICAP_SINGLE_LINE" // Asian Single Line Market - A market in which there can be 0 or multiple winners. e,.g marketType TOTAL_GOALS. BT_FIXED_ODDS BettingType = "FIXED_ODDS" // Sportsbook Odds Market. This type is deprecated and will be removed in future releases, when Sportsbook markets will be represented as ODDS market but with a different product type. )
type CancelInstruction ¶
type CancelInstruction struct {
BetID string `json:"betId,omitempty"` // BetID is the bet ID to cancel.
SizeReduction float64 `json:"sizeReduction,omitempty"` // SizeReduction if supplied this is a partial cancel.
}
CancelInstruction is an instruction to cancel a bet.
type CancelOrdersInstructionReport ¶
type CancelOrdersInstructionReport struct {
Status InstructionReportStatus `json:"status"` // Status is whether the command succeeded or failed
ErrorCode InstructionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is cause of failure, or null if command succeeds
Instruction CancelInstruction `json:"instruction,omitempty"` // Instruction is the instruction that was requested
SizeCancelled float64 `json:"sizeCancelled"` // SizeCancelled is sizeCancelled.
CancelledDate time.Time `json:"cancelledDate,omitempty"` // CancelledDate is cancelledDate.
}
CancelOrdersInstructionReport is the response to a CancelInstruction.
type CancelOrdersParams ¶
type CancelOrdersParams struct {
MarketID string `json:"marketId,omitempty"` // MarketID if marketId and betId aren't supplied all bets are cancelled.
Instructions []CancelInstruction `json:"instructions,omitempty"` // Instructions are the cancel instructions. The limit of cancel instructions per request is 60.
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is an optional parameter allowing the client to pass a unique string (up to 32 chars) that is used to de-dupe mistaken re-submissions.
}
CancelOrdersParams are the request parameters for cancelOrders.
type CancelOrdersReport ¶
type CancelOrdersReport struct {
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is the customer reference passed in the request.
Status ExecutionReportStatus `json:"status"` // Status is the status of the execution report.
ErrorCode ExecutionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the operation failed.
MarketID string `json:"marketId,omitempty"` // MarketID is the market id these orders were cancelled on.
InstructionReports []CancelOrdersInstructionReport `json:"instructionReports,omitempty"` // InstructionReports is the list of instruction reports.
}
CancelOrdersReport is the response from cancelOrders (CancelExecutionReport).
type ChangeType ¶
type ChangeType string
ChangeType identifies the type of change in an Exchange Stream API ChangeMessage.
const ( CT_SUB_IMAGE ChangeType = "SUB_IMAGE" // The initial image returned from a subscription. May also happen while the subscription is ongoing and should replace local cache entirely. CT_RESUB_DELTA ChangeType = "RESUB_DELTA" // A patch returned from a resubscribe. CT_HEARTBEAT ChangeType = "HEARTBEAT" // An empty message published if no data has been sent within heartbeatMs. )
type Client ¶
type Client struct {
HttpClient *http.Client
Config *ClientConfig
SessionToken string
}
ClientConfig configures the Betfair API client.
func NewClient ¶
func NewClient(config *ClientConfig) *Client
func (*Client) CancelOrders ¶
func (client *Client) CancelOrders(ctx context.Context, params CancelOrdersParams) (CancelOrdersReport, error)
CancelOrders cancels all bets OR cancel all bets on a market OR fully or partially cancel particular orders on a market. Only LIMIT orders can be cancelled or partially cancelled once placed.
func (*Client) GetAccountDetails ¶
func (client *Client) GetAccountDetails(ctx context.Context) (GetAccountDetailsResponse, error)
GetAccountDetails returns the details relating your account, including your discount rate and Betfair point balance.
func (*Client) GetAccountFunds ¶
func (client *Client) GetAccountFunds(ctx context.Context, params GetAccountFundsParams) (GetAccountFundsResponse, error)
GetAccountFunds returns the available to bet amount, exposure and commission information.
func (*Client) GetAccountStatement ¶
func (client *Client) GetAccountStatement(ctx context.Context, params GetAccountStatementParams) (GetAccountStatementReport, error)
GetAccountStatement returns account statement items chronologically ordered plus moreAvailable boolean to facilitate paging. Please note: You can only retrieve account statement items for the last 90 days.
func (*Client) GetAccounts ¶
func (*Client) GetDeveloperAppKeys ¶
func (client *Client) GetDeveloperAppKeys(ctx context.Context) ([]GetDeveloperAppKeysResult, error)
GetDeveloperAppKeys gets all application keys owned by the given developer/vendor.
func (*Client) GetHeartbeats ¶
func (*Client) GetStream ¶
func (client *Client) GetStream(config *StreamingClientConfig) (*StreamingClient, error)
func (*Client) Heartbeat ¶
func (client *Client) Heartbeat(ctx context.Context, params HeartbeatParams) (HeartbeatReport, error)
Heartbeat helps customers have their positions managed automatically in the event of their API clients losing connectivity with the Betfair API. If a heartbeat request is not received within a prescribed time period, then Betfair will attempt to cancel all 'LIMIT' type bets for the given customer on the given exchange.
func (*Client) KeepAlive ¶
func (client *Client) KeepAlive(ctx context.Context) (*KeepAliveResponse, error)
KeepAlive extends the session timeout period.
func (*Client) ListClearedOrders ¶
func (client *Client) ListClearedOrders(ctx context.Context, params ListClearedOrdersParams) (ListClearedOrdersReport, error)
ListClearedOrders returns a list of settled bets based on the bet status, ordered by settled date. To retrieve more than 1000 records, you need to make use of the fromRecord and recordCount parameters.
func (*Client) ListCompetitions ¶
func (client *Client) ListCompetitions(ctx context.Context, params ListCompetitionsParams) ([]ListCompetitionsResult, error)
ListCompetitions returns a list of Competitions (i.e., World Cup 2013) associated with the markets selected by the MarketFilter. Please Note: for horse and greyhounds racing, please use listVenues
func (*Client) ListCountries ¶
func (client *Client) ListCountries(ctx context.Context, params ListCountriesParams) ([]ListCountriesResult, error)
ListCountries returns a list of Countries associated with the markets selected by the MarketFilter.
func (*Client) ListCurrencyRates ¶
func (client *Client) ListCurrencyRates(ctx context.Context, params ListCurrencyRatesParams) ([]ListCurrencyRatesResult, error)
ListCurrencyRates returns a list of currency rates based on given currency. Please note: the currency rates are updated once every hour a few seconds after the hour.
func (*Client) ListCurrentOrders ¶
func (client *Client) ListCurrentOrders(ctx context.Context, params ListCurrentOrdersParams) (ListCurrentOrdersReport, error)
ListCurrentOrders returns a list of your current orders. Optionally you can filter and sort your current orders using the various parameters, setting none of the parameters will return all of your current orders up to a maximum of 1000 bets, ordered BY_BET and sorted EARLIEST_TO_LATEST. To retrieve more than 1000 orders, you need to make use of the fromRecord and recordCount parameters.
func (*Client) ListEventTypes ¶
func (client *Client) ListEventTypes(ctx context.Context, params ListEventTypesParams) ([]ListEventTypesResult, error)
ListEventTypes returns a list of Event Types (i.e. Sports) associated with the markets selected by the MarketFilter.
func (*Client) ListEvents ¶
func (client *Client) ListEvents(ctx context.Context, params ListEventsParams) ([]ListEventsResult, error)
ListEvents returns a list of Events (i.e, Reading vs. Man United) associated with the markets selected by the MarketFilter.
func (*Client) ListMarketBook ¶
func (client *Client) ListMarketBook(ctx context.Context, params ListMarketBookParams) ([]ListMarketBookResult, error)
ListMarketBook returns a list of dynamic data about markets. Dynamic data includes prices, the status of the market, the status of selections, the traded volume, and the status of any orders you have placed in the market. Please note: Separate requests should be made for OPEN & CLOSED markets. Requests that include both OPEN & CLOSED markets will only return those markets that are OPEN.
func (*Client) ListMarketCatalogue ¶
func (client *Client) ListMarketCatalogue(ctx context.Context, params ListMarketCatalogueParams) ([]ListMarketCatalogueResult, error)
ListMarketCatalogue returns a list of information about published (ACTIVE/SUSPENDED) markets that does not change (or changes very rarely). You use listMarketCatalogue to retrieve the name of the market, the names of selections and other information about markets. Market Data Request Limits apply to requests made to listMarketCatalogue. Please note: listMarketCatalogue does not return markets that are CLOSED.
func (*Client) ListMarketProfitAndLoss ¶
func (client *Client) ListMarketProfitAndLoss(ctx context.Context, params ListMarketProfitAndLossParams) ([]ListMarketProfitAndLossResult, error)
ListMarketProfitAndLoss retrieves profit and loss for a given list of OPEN markets. The values are calculated using matched bets and optionally settled bets. Only odds (MarketBettingType= ODDS) markets are implemented; markets of other types are silently ignored. To retrieve your profit and loss for CLOSED markets, please use the listClearedOrders request. Please note: Market Data Request Limits apply to requests made to listMarketProfitAndLoss.
func (*Client) ListMarketTypes ¶
func (client *Client) ListMarketTypes(ctx context.Context, params ListMarketTypesParams) ([]ListMarketTypesResult, error)
ListMarketTypes returns a list of market types (i.e. MATCH_ODDS, NEXT_GOAL) associated with the markets selected by the MarketFilter. The market types are always the same, regardless of locale.
func (*Client) ListRaceDetails ¶
func (client *Client) ListRaceDetails(ctx context.Context, params ListRaceDetailsParams) ([]ListRaceDetailsResult, error)
ListRaceDetails searches for races to get their details. This information is available for UK, Ireland and South African races only and is provided for information purposes only.
func (*Client) ListRunnerBook ¶
func (client *Client) ListRunnerBook(ctx context.Context, params ListRunnerBookParams) ([]ListRunnerBookResult, error)
ListRunnerBook returns a list of dynamic data about a market and a specified runner. Dynamic data includes prices, the status of the market, the status of selections, the traded volume, and the status of any orders you have placed in the market.
func (*Client) ListTimeRanges ¶
func (client *Client) ListTimeRanges(ctx context.Context, params ListTimeRangesParams) ([]ListTimeRangesResult, error)
ListTimeRanges returns a list of time ranges in the granularity specified in the request (i.e. 3PM to 4PM, Aug 14th to Aug 15th) associated with the markets selected by the MarketFilter.
func (*Client) ListVenues ¶
func (client *Client) ListVenues(ctx context.Context, params ListVenuesParams) ([]ListVenuesResult, error)
ListVenues returns a list of Venues (i.e. Cheltenham, Ascot) associated with the markets selected by the MarketFilter. Only Horse Racing & Greyhound markets are associated with a Venue.
func (*Client) Login ¶
func (client *Client) Login(ctx context.Context, username string, password string) (*LoginResponse, error)
Login submits a HTTP POST request to certlogin with username/password and certificate.
func (*Client) Logout ¶
func (client *Client) Logout(ctx context.Context) (*LogoutResponse, error)
Logout terminates your existing session.
func (*Client) PlaceOrders ¶
func (client *Client) PlaceOrders(ctx context.Context, params PlaceOrdersParams) (PlaceOrdersReport, error)
PlaceOrders places new orders into market. Please note that additional bet sizing rules apply to bets placed into the Italian Exchange. In normal circumstances the placeOrders is an atomic operation. PLEASE NOTE: if the 'Best Execution' features is switched off, placeOrders can return 'PROCESSED_WITH_ERRORS' meaning that some bets can be rejected and other placed when submitted in the same PlaceInstruction.
func (*Client) ReplaceOrders ¶
func (client *Client) ReplaceOrders(ctx context.Context, params ReplaceOrdersParams) (ReplaceOrdersReport, error)
ReplaceOrders is logically a bulk cancel followed by a bulk place. The cancel is completed first then the new orders are placed. The new orders will be placed atomically in that they will all be placed or none will be placed. In the case where the new orders cannot be placed the cancellations will not be rolled back.
func (*Client) UpdateOrders ¶
func (client *Client) UpdateOrders(ctx context.Context, params UpdateOrdersParams) (UpdateOrdersReport, error)
UpdateOrders updates non-exposure changing fields.
type ClientConfig ¶
type ClientConfig struct {
Tls *tls.Config // TLS client configuration for certificate-based non-interactive login.
ApplicationName string // Optional application name identifier.
ApplicationKey string // Application key sent in the X-Application header.
Rest bool // Use REST API instead of JSON-RPC when true.
Jurisdiction Jurisdiction // Betfair identity and API domain jurisdiction suffix.
}
ClientConfig configures the Betfair API client.
func (*ClientConfig) GetApiUrl ¶
func (config *ClientConfig) GetApiUrl() string
func (*ClientConfig) GetCertIdentityUrl ¶
func (config *ClientConfig) GetCertIdentityUrl() string
func (*ClientConfig) GetIdentityUrl ¶
func (config *ClientConfig) GetIdentityUrl() string
type Competition ¶
type Competition struct {
ID string `json:"id"` // ID is id.
Name string `json:"name"` // Name is name.
}
Competition is a competition the market is contained within.
type ConnectionMessage ¶
type CurrencyRate ¶
type CurrencyRate struct {
CurrencyCode string `json:"currencyCode"` // The currency code.
Rate float64 `json:"rate"` // The conversion rate.
}
CurrencyRate is a currency conversion rate.
type CurrentItemDescription ¶
type CurrentItemDescription struct {
MarketVersion MarketVersion `json:"marketVersion,omitempty"` // MarketVersion is the version of the market.
}
CurrentItemDescription contains extra description parameters for a current order.
type DeveloperApp ¶
type DeveloperApp struct {
AppName string `json:"appName"` // The unique name of the application.
AppID int64 `json:"appId"` // A unique id of this application.
AppVersions []DeveloperAppVersion `json:"appVersions"` // The application versions (including application keys).
}
DeveloperApp describes developer/vendor specific application.
type DeveloperAppVersion ¶
type DeveloperAppVersion struct {
Owner string `json:"owner"` // The user who owns the specific version of the application.
VersionID int64 `json:"versionId"` // The unique Id of the application version.
Version string `json:"version"` // The version identifier string such as 1.0, 2.0. Unique for a given application.
ApplicationKey string `json:"applicationKey"` // The unqiue application key associated with this application version.
DelayData bool `json:"delayData"` // Indicates whether the data exposed by platform services as seen by this application key is delayed or realtime.
SubscriptionRequired bool `json:"subscriptionRequired"` // Indicates whether the application version needs explicit subscription.
OwnerManaged bool `json:"ownerManaged"` // Indicates whether the application version needs explicit management by the software owner. A value of false indicates, this is a version meant for personal developer use.
Active bool `json:"active"` // Indicates whether the application version is currently active.
VendorID string `json:"vendorId,omitempty"` // Public unique string provided to the Vendor that they can use to pass to the Betfair API in order to identify themselves.
VendorSecret string `json:"vendorSecret,omitempty"` // Private unique string provided to the Vendor that they pass with certain calls to confirm their identity. Linked to a particular App Key.
}
DeveloperAppVersion describes a version of an external application.
type Event ¶
type Event struct {
ID string `json:"id,omitempty"` // ID is the unique id for the event
Name string `json:"name,omitempty"` // Name is the name of the event
CountryCode string `json:"countryCode,omitempty"` // CountryCode is the ISO-2 code for the event. A list of ISO-2 codes is available via http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Please note: default value is 'GB' when the correct country code cannot be determined.
Timezone string `json:"timezone,omitempty"` // Timezone is this is timezone in which the event is taking place.
Venue string `json:"venue,omitempty"` // Venue is venue.
OpenDate time.Time `json:"openDate,omitempty"` // OpenDate is the scheduled start date and time of the event. This is Europe/London (GMT) by default
}
Event is an event the market is contained within.
type EventType ¶
type EventType struct {
ID string `json:"id,omitempty"` // ID is id.
Name string `json:"name,omitempty"` // Name is name.
}
EventType is the Event Type the market is contained within.
type ExchangePrices ¶
type ExchangePrices struct {
AvailableToBack []PriceSize `json:"availableToBack,omitempty"`
AvailableToLay []PriceSize `json:"availableToLay,omitempty"`
TradedVolume []PriceSize `json:"tradedVolume,omitempty"`
}
ExchangePrices are exchange prices available for a runner.
type ExecutionReportErrorCode ¶
type ExecutionReportErrorCode string
ExecutionReportErrorCode is the error code if the operation failed.
const ( ERS_ERR_ERROR_IN_MATCHER ExecutionReportErrorCode = "ERROR_IN_MATCHER" // The matcher is not healthy. Please note: The error will also be returned is you attempt concurrent 'cancel all' bets requests using cancelOrders which isn't permitted. ERS_ERR_PROCESSED_WITH_ERRORS ExecutionReportErrorCode = "PROCESSED_WITH_ERRORS" // The order itself has been accepted, but at least one (possibly all) actions have generated errors. ERS_ERR_BET_ACTION_ERROR ExecutionReportErrorCode = "BET_ACTION_ERROR" // There is an error with an action that has caused the entire order to be rejected. Check the instructionReports errorCode for the reason for the rejection of the order. ERS_ERR_INVALID_ACCOUNT_STATE ExecutionReportErrorCode = "INVALID_ACCOUNT_STATE" // Order rejected due to the account's status (suspended, inactive, dup cards). ERS_ERR_INVALID_WALLET_STATUS ExecutionReportErrorCode = "INVALID_WALLET_STATUS" // Order rejected due to the account's wallet's status. ERS_ERR_INSUFFICIENT_FUNDS ExecutionReportErrorCode = "INSUFFICIENT_FUNDS" // Account has exceeded its exposure limit or available to bet limit. ERS_ERR_LOSS_LIMIT_EXCEEDED ExecutionReportErrorCode = "LOSS_LIMIT_EXCEEDED" // The account has exceed the self imposed loss limit. ERS_ERR_MARKET_SUSPENDED ExecutionReportErrorCode = "MARKET_SUSPENDED" // Market is suspended. ERS_ERR_MARKET_NOT_OPEN_FOR_BETTING ExecutionReportErrorCode = "MARKET_NOT_OPEN_FOR_BETTING" // Market is not open for betting. It is either not yet active, suspended or closed awaiting settlement. ERS_ERR_DUPLICATE_TRANSACTION ExecutionReportErrorCode = "DUPLICATE_TRANSACTION" // Duplicate customer reference data submitted - Please note: There is a time window associated with the de-duplication of duplicate submissions which is 60 second. ERS_ERR_INVALID_ORDER ExecutionReportErrorCode = "INVALID_ORDER" // Order cannot be accepted by the matcher due to the combination of actions. For example, bets being edited are not on the same market, or order includes both edits and placement. ERS_ERR_INVALID_MARKET_ID ExecutionReportErrorCode = "INVALID_MARKET_ID" // Market doesn't exist. ERS_ERR_PERMISSION_DENIED ExecutionReportErrorCode = "PERMISSION_DENIED" // Business rules do not allow order to be placed. You are either attempting to place the order using a Delayed Application Key or from a restricted jurisdiction (i.e. USA). ERS_ERR_DUPLICATE_BETIDS ExecutionReportErrorCode = "DUPLICATE_BETIDS" // Duplicate bet ids found. For example, you've included the same betId more than once in a single cancelOrders request. ERS_ERR_NO_ACTION_REQUIRED ExecutionReportErrorCode = "NO_ACTION_REQUIRED" // Order hasn't been passed to matcher as system detected there will be no state change. ERS_ERR_SERVICE_UNAVAILABLE ExecutionReportErrorCode = "SERVICE_UNAVAILABLE" // The requested service is unavailable. ERS_ERR_REJECTED_BY_REGULATOR ExecutionReportErrorCode = "REJECTED_BY_REGULATOR" // The regulator rejected the order. On the Italian Exchange this error will occur if more than 50 bets are sent in a single placeOrders request. ERS_ERR_NO_CHASING ExecutionReportErrorCode = "NO_CHASING" // A specific error code that relates to Spanish Exchange markets only which indicates that the bet placed contravenes the Spanish regulatory rules relating to loss chasing. ERS_ERR_REGULATOR_IS_NOT_AVAILABLE ExecutionReportErrorCode = "REGULATOR_IS_NOT_AVAILABLE" // The underlying regulator service is not available. ERS_ERR_TOO_MANY_INSTRUCTIONS ExecutionReportErrorCode = "TOO_MANY_INSTRUCTIONS" // The amount of orders exceeded the maximum amount allowed to be executed. ERS_ERR_INVALID_MARKET_VERSION ExecutionReportErrorCode = "INVALID_MARKET_VERSION" // The supplied market version is invalid. Max length allowed for market version is 12. ERS_ERR_INVALID_PROFIT_RATIO ExecutionReportErrorCode = "INVALID_PROFIT_RATIO" // The order falls outside the permitted price and size combination. )
type ExecutionReportStatus ¶
type ExecutionReportStatus string
ExecutionReportStatus is the status of the execution report.
const ( ERS_SUCCESS ExecutionReportStatus = "SUCCESS" // Order processed successfully. ERS_FAILURE ExecutionReportStatus = "FAILURE" // Order failed. ERS_PROCESSED_WITH_ERRORS ExecutionReportStatus = "PROCESSED_WITH_ERRORS" // The order itself has been accepted, but at least one (possibly all) actions have generated errors. This error only occurs for replaceOrders, cancelOrders and updateOrders operations. In normal circumstances the placeOrders operation will not return PROCESSED_WITH_ERRORS status as it is an atomic operation. PLEASE NOTE: if the 'Best Execution' features is switched off, placeOrders can return 'PROCESSED_WITH_ERRORS' meaning that some bets can be rejected and other placed when submitted in the same PlaceInstruction. ERS_TIMEOUT ExecutionReportStatus = "TIMEOUT" // The order timed out & the status of the bet is unknown. If a TIMEOUT error occurs on a placeOrders/replaceOrders request, you should check listCurrentOrders to verify the status of your bets before placing further orders. Please Note: Timeouts will occur after 5 seconds of attempting to process the bet but please allow up to 15 seconds for a timed out order to appear. After this time any unprocessed bets will automatically be Lapsed and no longer be available on the Exchange. )
type GetAccountDetailsResponse ¶
type GetAccountDetailsResponse struct {
CurrencyCode string `json:"currencyCode"` // ISO currency code for the account.
FirstName string `json:"firstName"` // The first name of the user.
LastName string `json:"lastName"` // The last name of the user.
LocaleCode string `json:"localeCode"` // The locale code of the user.
Region string `json:"region"` // The region of the user.
Timezone string `json:"timezone"` // The timezone of the user.
DiscountRate float64 `json:"discountRate"` // User Discount Rate.
PointsBalance int `json:"pointsBalance"` // The Betfair points balance.
CountryCode string `json:"countryCode"` // The ISO-2 country code for the account.
}
GetAccountDetailsResponse is the response for retrieving account details.
type GetAccountFundsParams ¶
type GetAccountFundsParams struct {
Wallet Wallet `json:"wallet,omitempty"` // Name of the wallet in question. Global wallet is returned by default.
}
GetAccountFundsParams are the parameters for getAccountFunds.
type GetAccountFundsResponse ¶
type GetAccountFundsResponse struct {
AvailableToBetBalance float64 `json:"availableToBetBalance"` // Amount available to bet.
Exposure float64 `json:"exposure"` // Current exposure.
RetainedCommission float64 `json:"retainedCommission"` // Sum of retained commission.
ExposureLimit float64 `json:"exposureLimit"` // Exposure limit.
DiscountRate float64 `json:"discountRate"` // User Discount Rate. Please note: Betfair AUS/NZ customers should not rely on this to determine their discount rates which are now applied at the account level.
PointsBalance int `json:"pointsBalance"` // The Betfair points balance.
Wallet Wallet `json:"wallet"` // Name of the wallet in question.
}
GetAccountFundsResponse is the response for retrieving available to bet.
type GetAccountStatementParams ¶
type GetAccountStatementParams struct {
Locale string `json:"locale,omitempty"` // The language to be used where applicable. If not specified, the customer account default is returned.
FromRecord int `json:"fromRecord,omitempty"` // Specifies the first record that will be returned. Records start at index zero. If not specified then it will default to 0.
RecordCount int `json:"recordCount,omitempty"` // Specifies the maximum number of records to be returned. Note that there is a page size limit of 100.
ItemDateRange TimeRange `json:"itemDateRange,omitempty"` // Return items with an itemDate within this date range. Both from and to date times are inclusive.
IncludeItem IncludeItem `json:"includeItem,omitempty"` // Which items to include, if not specified then defaults to ALL.
Wallet Wallet `json:"wallet,omitempty"` // Which wallet to return statementItems for. If unspecified then the UK wallet will be selected.
}
GetAccountStatementParams are the parameters for getAccountStatement.
type GetAccountStatementReport ¶
type GetAccountStatementReport struct {
AccountStatements []GetAccountStatementResult `json:"accountStatement"` // List of statement items.
MoreAvailable bool `json:"moreAvailable"` // Indicates whether more records are available.
}
GetAccountStatementReport is a list of statement items chronologically ordered plus moreAvailable boolean to facilitate paging.
type GetAccountStatementResult ¶
type GetAccountStatementResult struct {
RefID string `json:"refId"` // The reference identifier for the statement item.
ItemDate time.Time `json:"itemDate"` // The date of the statement item.
Amount float64 `json:"amount"` // The amount of the statement item.
Balance float64 `json:"balance"` // The account balance after the statement item.
ItemClass ItemClass `json:"itemClass"` // The class of the statement item.
ItemClassData map[string]string `json:"itemClassData"` // Additional key/value data for the statement item.
LegacyData StatementLegacyData `json:"legacyData"` // Legacy data for exchange statement items.
}
GetAccountStatementResult is a single account statement item.
type GetDeveloperAppKeysResult ¶
type GetDeveloperAppKeysResult = DeveloperApp
type GroupBy ¶
type GroupBy string
GroupBy specifies how to aggregate the lines, if not supplied then the lowest level is returned, i.e. bet by bet. This is only applicable to SETTLED BetStatus.
const ( GB_EVENT_TYPE GroupBy = "EVENT_TYPE" // GB_EVENT_TYPE is a roll up of settled P&L, commission paid and number of bet orders, on a specified event type. GB_EVENT GroupBy = "EVENT" // GB_EVENT is a roll up of settled P&L, commission paid and number of bet orders, on a specified event. GB_MARKET GroupBy = "MARKET" // GB_MARKET is a roll up of settled P&L, commission paid and number of bet orders, on a specified market. GB_SIDE GroupBy = "SIDE" // GB_SIDE is an averaged roll up of settled P&L, and number of bets, on the specified side of a specified selection within a specified market, that are either settled or voided. GB_BET GroupBy = "BET" // GB_BET is the P&L, side and regulatory information etc, about each individual bet order. )
type HeartbeatParams ¶
type HeartbeatParams struct {
PreferredTimeoutSeconds int `json:"preferredTimeoutSeconds"` // PreferredTimeoutSeconds is the timeout requested.
}
HeartbeatParams are the request parameters for heartbeat.
type HeartbeatReport ¶
type HeartbeatReport struct {
ActionPerformed ActionPerformed `json:"actionPerformed"` // ActionPerformed is the action performed since your last heartbeat request.
ActualTimeoutSeconds int `json:"actualTimeoutSeconds"` // ActualTimeoutSeconds is the actual timeout applied.
}
HeartbeatReport is the response from heartbeat.
type IncludeItem ¶
type IncludeItem string
IncludeItem specifies which items to include, if not specified then defaults to ALL.
const ( IT_ALL IncludeItem = "ALL" // IT_ALL includes all items. IT_DEPOSITS_WITHDRAWALS IncludeItem = "DEPOSITS_WITHDRAWALS" // IT_DEPOSITS_WITHDRAWALS includes payments only. IT_EXCHANGE IncludeItem = "EXCHANGE" // IT_EXCHANGE includes exchange bets only. IT_POKER_ROOM IncludeItem = "POKER_ROOM" // IT_POKER_ROOM includes poker transactions only. )
type InstructionReportErrorCode ¶
type InstructionReportErrorCode string
InstructionReportErrorCode is cause of failure, or null if the command succeeds.
const ( IRS_ERR_INVALID_BET_SIZE InstructionReportErrorCode = "INVALID_BET_SIZE" // bet size is invalid for your currency or your regulator. IRS_ERR_INVALID_RUNNER InstructionReportErrorCode = "INVALID_RUNNER" // Runner does not exist, includes vacant traps in greyhound racing. IRS_ERR_BET_TAKEN_OR_LAPSED InstructionReportErrorCode = "BET_TAKEN_OR_LAPSED" // Bet cannot be cancelled or modified as it has already been taken or has been cancelled/lapsed Includes attempts to cancel/modify market on close BSP bets and cancelling limit on close BSP bets. The error may be returned on placeOrders request if for example a bet is placed at the point when a market admin event takes place (i.e. market is turned in-play). The error will also be returned if a market version is submitted and a material change has taken place since the bet was submitted causing the bet to be rejected. IRS_ERR_BET_IN_PROGRESS InstructionReportErrorCode = "BET_IN_PROGRESS" // No result was received from the matcher in a timeout configured for the system. IRS_ERR_RUNNER_REMOVED InstructionReportErrorCode = "RUNNER_REMOVED" // Runner has been removed from the event. IRS_ERR_MARKET_NOT_OPEN_FOR_BETTING InstructionReportErrorCode = "MARKET_NOT_OPEN_FOR_BETTING" // Attempt to edit a bet on a market that has closed. IRS_ERR_LOSS_LIMIT_EXCEEDED InstructionReportErrorCode = "LOSS_LIMIT_EXCEEDED" // The action has caused the account to exceed the self imposed loss limit. IRS_ERR_MARKET_NOT_OPEN_FOR_BSP_BETTING InstructionReportErrorCode = "MARKET_NOT_OPEN_FOR_BSP_BETTING" // Market now closed to bsp betting. Turned in-play or has been reconciled. IRS_ERR_INVALID_PRICE_EDIT InstructionReportErrorCode = "INVALID_PRICE_EDIT" // Attempt to edit down the price of a bsp limit on close lay bet, or edit up the price of a limit on close back bet. IRS_ERR_INVALID_ODDS InstructionReportErrorCode = "INVALID_ODDS" // Odds not on price ladder - either edit or placement. IRS_ERR_INSUFFICIENT_FUNDS InstructionReportErrorCode = "INSUFFICIENT_FUNDS" // Insufficient funds available to cover the bet action. Either the exposure limit or available to bet limit would be exceeded. IRS_ERR_INVALID_PERSISTENCE_TYPE InstructionReportErrorCode = "INVALID_PERSISTENCE_TYPE" // Invalid persistence type for this market, e.g. KEEP for a non in-play market or KEEP for markets with PASSIVE betDelayModels. IRS_ERR_ERROR_IN_MATCHER InstructionReportErrorCode = "ERROR_IN_MATCHER" // A problem with the matcher prevented this action completing successfully. IRS_ERR_INVALID_BACK_LAY_COMBINATION InstructionReportErrorCode = "INVALID_BACK_LAY_COMBINATION" // The order contains a back and a lay for the same runner at overlapping prices. This would guarantee a self match. This also applies to BSP limit on close bets. IRS_ERR_ERROR_IN_ORDER InstructionReportErrorCode = "ERROR_IN_ORDER" // The action failed because the parent order failed. IRS_ERR_INVALID_BID_TYPE InstructionReportErrorCode = "INVALID_BID_TYPE" // Bid type is mandatory. IRS_ERR_INVALID_BET_ID InstructionReportErrorCode = "INVALID_BET_ID" // Bet for id supplied has not been found. IRS_ERR_CANCELLED_NOT_PLACED InstructionReportErrorCode = "CANCELLED_NOT_PLACED" // Bet cancelled but replacement bet was not placed. IRS_ERR_RELATED_ACTION_FAILED InstructionReportErrorCode = "RELATED_ACTION_FAILED" // Action failed due to the failure of a action on which this action is dependent. IRS_ERR_NO_ACTION_REQUIRED InstructionReportErrorCode = "NO_ACTION_REQUIRED" // The action does not result in any state change. eg changing a persistence to it's current value. IRS_ERR_TIME_IN_FORCE_CONFLICT InstructionReportErrorCode = "TIME_IN_FORCE_CONFLICT" // You may only specify a time in force on either the place request OR on individual limit order instructions (not both), since the implied behaviors are incompatible. IRS_ERR_UNEXPECTED_PERSISTENCE_TYPE InstructionReportErrorCode = "UNEXPECTED_PERSISTENCE_TYPE" // You have specified a persistence type for a FILL_OR_KILL order, which is nonsensical because no unmatched portion can remain after the order has been placed. IRS_ERR_INVALID_ORDER_TYPE InstructionReportErrorCode = "INVALID_ORDER_TYPE" // You have specified a time in force of FILL_OR_KILL, but have included a non-LIMIT order type. IRS_ERR_UNEXPECTED_MIN_FILL_SIZE InstructionReportErrorCode = "UNEXPECTED_MIN_FILL_SIZE" // You have specified a minFillSize on a limit order, where the limit order's time in force is not FILL_OR_KILL. Using minFillSize is not supported where the time in force of the request (as opposed to an order) is FILL_OR_KILL. IRS_ERR_INVALID_CUSTOMER_ORDER_REF InstructionReportErrorCode = "INVALID_CUSTOMER_ORDER_REF" // The supplied customer order reference is too long. IRS_ERR_INVALID_MIN_FILL_SIZE InstructionReportErrorCode = "INVALID_MIN_FILL_SIZE" // The minFillSize must be greater than zero and less than or equal to the order's size. The minFillSize cannot be less than the minimum bet size for your currency. IRS_ERR_BET_LAPSED_PRICE_IMPROVEMENT_TOO_LARGE InstructionReportErrorCode = "BET_LAPSED_PRICE_IMPROVEMENT_TOO_LARGE" // Your bet is lapsed. There is better odds than requested available in the market, but your preferences don't allow the system to match your bet against better odds. Change your betting preferences to accept better odds if you don't want to receive this error. Please see https://support.betfair.com/app/answers/detail/a_id/404/ for more details regarding Best Execution and how to update your settings. )
type InstructionReportStatus ¶
type InstructionReportStatus string
InstructionReportStatus is whether the command succeeded or failed.
const ( IRS_SUCCESS InstructionReportStatus = "SUCCESS" // The instruction was successful. IRS_FAILURE InstructionReportStatus = "FAILURE" // The instruction failed. IRS_TIMEOUT InstructionReportStatus = "TIMEOUT" // The order timed out & the status of the bet is unknown. If a TIMEOUT error occurs on a placeOrders/replaceOrders request, you should check listCurrentOrders to verify the status of your bets before placing further orders. Please Note: Timeouts will occur after 5 seconds of attempting to process the bet but please allow up to 15 seconds for a timed out order to appear. After this time any unprocessed bets will automatically be Lapsed and no longer be available on the Exchange. )
type ItemClass ¶
type ItemClass string
ItemClass is the statement item class.
const ( IC_UNKNOWN ItemClass = "UNKNOWN" // IC_UNKNOWN indicates a statement item not mapped to a specific class. All values will be concatenated into a single key/value pair. The key will be 'unknownStatementItem' and the value will be a comma separated string. Please note: This is used to represent commission payment items. IC_DEPOSIT ItemClass = "DEPOSIT" // IC_DEPOSIT is a deposit item. IC_WITHDRAWAL ItemClass = "WITHDRAWAL" // IC_WITHDRAWAL is a withdrawal item. IC_COMMISSION ItemClass = "COMMISSION" // IC_COMMISSION is a commission item. IC_SETTLED_BET ItemClass = "SETTLED_BET" // IC_SETTLED_BET is a settled bet item. IC_VOIDED_BET ItemClass = "VOIDED_BET" // IC_VOIDED_BET is a voided bet item. IC_LAPSED_BET ItemClass = "LAPSED_BET" // IC_LAPSED_BET is a lapsed bet item. IC_CANCELLED_BET ItemClass = "CANCELLED_BET" // IC_CANCELLED_BET is a cancelled bet item. IC_TRANSFER ItemClass = "TRANSFER" // IC_TRANSFER is a transfer item. IC_TAX ItemClass = "TAX" // IC_TAX is a tax item. IC_DISCOUNT ItemClass = "DISCOUNT" // IC_DISCOUNT is a discount item. IC_BONUS ItemClass = "BONUS" // IC_BONUS is a bonus item. IC_ADJUSTMENT ItemClass = "ADJUSTMENT" // IC_ADJUSTMENT is an adjustment item. IC_ADMIN ItemClass = "ADMIN" // IC_ADMIN is an admin item. IC_DEPOSIT_FAIL ItemClass = "DEPOSIT_FAIL" // IC_DEPOSIT_FAIL is a failed deposit item. IC_WITHDRAWAL_FAIL ItemClass = "WITHDRAWAL_FAIL" // IC_WITHDRAWAL_FAIL is a failed withdrawal item. IC_TRANSFER_TO_EXCHANGE ItemClass = "TRANSFER_TO_EXCHANGE" // IC_TRANSFER_TO_EXCHANGE is a transfer to exchange item. IC_TRANSFER_FROM_EXCHANGE ItemClass = "TRANSFER_FROM_EXCHANGE" // IC_TRANSFER_FROM_EXCHANGE is a transfer from exchange item. )
type ItemDescription ¶
type ItemDescription struct {
EventTypeDesc string `json:"eventTypeDesc,omitempty"` // EventTypeDesc is the event type description.
EventDesc string `json:"eventDesc,omitempty"` // EventDesc is the event description.
MarketDesc string `json:"marketDesc,omitempty"` // MarketDesc is the market description.
MarketType string `json:"marketType,omitempty"` // MarketType is the market type.
MarketStartTime time.Time `json:"marketStartTime,omitempty"` // MarketStartTime is the market start time.
RunnerDesc string `json:"runnerDesc,omitempty"` // RunnerDesc is the runner description.
NumberOfWinners int `json:"numberOfWinners,omitempty"` // NumberOfWinners is the number of winners.
EachWayDivisor float64 `json:"eachWayDivisor,omitempty"` // EachWayDivisor is the each way divisor.
}
ItemDescription contains descriptive information about a cleared order item.
type JsonAPINGException ¶
type JsonAPINGException struct {
RequestUUID string `json:"requestUUID"`
ErrorCode JsonAPINGExceptionErrorCode `json:"errorCode"`
ErrorDetails string `json:"errorDetails"`
}
type JsonAPINGExceptionErrorCode ¶
type JsonAPINGExceptionErrorCode string
JsonAPINGExceptionErrorCode is returned in APINGException when a Betting API operation fails.
const ( EC_UNEXPECTED_ERROR JsonAPINGExceptionErrorCode = "UNEXPECTED_ERROR" // An unexpected internal error occurred that prevented successful request processing. EC_INVALID_INPUT_DATA JsonAPINGExceptionErrorCode = "INVALID_INPUT_DATA" // The data input is invalid. A specific description is returned via errorDetails. Please note: if the number of placeOrders, updateOrders, replaceOrders, or cancelOrders instructions exceeds the documented limit you will also receive this error. EC_INVALID_SESSION_INFORMATION JsonAPINGExceptionErrorCode = "INVALID_SESSION_INFORMATION" // The session token hasn't been provided, is invalid or has expired. Login again to create a new session. EC_INVALID_APP_KEY JsonAPINGExceptionErrorCode = "INVALID_APP_KEY" // The application key passed is invalid or is not present. EC_SERVICE_BUSY JsonAPINGExceptionErrorCode = "SERVICE_BUSY" // The service is currently too busy to service this request. EC_TIMEOUT_ERROR JsonAPINGExceptionErrorCode = "TIMEOUT_ERROR" // The Internal call to downstream service timed out. Please note: If a TIMEOUT error occurs on a placeOrders/replaceOrders request, you should check listCurrentOrders to verify the status of your bets before placing further orders. Please Note: Timeouts will occur after 5 seconds of attempting to process the bet but please allow up to 15 seconds for a timed out order to appear. After this time any unprocessed bets will automatically be Lapsed and no longer be available on the Exchange. EC_NO_SESSION JsonAPINGExceptionErrorCode = "NO_SESSION" // A session token header ('X-Authentication') has not been provided in the request. EC_NO_APP_KEY JsonAPINGExceptionErrorCode = "NO_APP_KEY" // An application key header ('X-Application') has not been provided in the request. EC_TOO_MANY_REQUESTS JsonAPINGExceptionErrorCode = "TOO_MANY_REQUESTS" // There are too many pending (in-flight) requests e.g. a listMarketBook with Order/Match projections is limited to 3 concurrent requests. The error also applies to listCurrentOrders, listMarketProfitAndLoss and listClearedOrders if you have 3 or more requests currently in execution. EC_SERVICE_UNAVAILABLE JsonAPINGExceptionErrorCode = "SERVICE_UNAVAILABLE" // The requested service is unavailable. EC_REQUEST_SIZE_EXCEEDS_LIMIT JsonAPINGExceptionErrorCode = "REQUEST_SIZE_EXCEEDS_LIMIT" // The request exceeds the request size limit. Requests are limited to a total of 250 betId's/marketId's (or a combination of both). EC_TOO_MUCH_DATA JsonAPINGExceptionErrorCode = "TOO_MUCH_DATA" // The operation requested too much data, exceeding the Market Data Request Limits. You must adjust your request parameters to stay with the documented limits. EC_ACCESS_DENIED JsonAPINGExceptionErrorCode = "ACCESS_DENIED" // The calling client is not permitted to perform the specific action e.g. they have an App Key restriction in place or attempting to place a bet from a restricted jurisdiction. )
type JsonData ¶
type JsonData struct {
APINGException JsonAPINGException `json:"APINGException"`
ExceptionName string `json:"exceptionname"`
}
type JsonRestErrorResponse ¶
type JsonRpcResponse ¶
type Jurisdiction ¶
type Jurisdiction string
Jurisdiction selects the Betfair identity and API domain suffix.
const ( JD_GLOBAL Jurisdiction = "com" // Global Exchange (.com). JD_AUSTRALIA Jurisdiction = "au" // Australian & New Zealand Exchange (.com.au). JD_ITALY Jurisdiction = "it" // Italian Exchange (.it). JD_SPAIN Jurisdiction = "es" // Spanish Exchange (.es). JD_ROMANIA Jurisdiction = "ro" // Romanian Exchange (.ro). JD_SWEDEN Jurisdiction = "se" // Swedish Exchange (.se). )
type KeepAliveResponse ¶
type KeepAliveResponse = SessionStatusResponse
ClientConfig configures the Betfair API client.
type KeyLineDescription ¶
type KeyLineDescription struct {
KeyLine []KeyLineSelection `json:"keyLine,omitempty"` // KeyLine is a list of KeyLineSelection objects
}
KeyLineDescription is a list of KeyLineSelection objects describing the key line for the market.
type KeyLineSelection ¶
type KeyLineSelection struct {
SelectionID int64 `json:"selectionId,omitempty"` // SelectionID is selection ID of the runner in the key line handicap.
Handicap float64 `json:"handicap,omitempty"` // Handicap is handicap value of the key line.
}
KeyLineSelection describes a markets key line selection, comprising the selectionId and handicap of the team it is applied to.
type LimitOnCloseOrder ¶
type LimitOnCloseOrder struct {
Liability float64 `json:"liability"` // Liability is the size of the bet.
Price float64 `json:"price"` // Price is the limit price of the bet.
}
LimitOnCloseOrder is the details of a limit on close order.
type LimitOrder ¶
type LimitOrder struct {
Size float64 `json:"size"` // Size is the bet size.
Price float64 `json:"price"` // Price is the bet price.
PersistenceType PersistenceType `json:"persistenceType"` // PersistenceType is what to do with the order at turn in play.
TimeInForce TimeInForce `json:"timeInForce,omitempty"` // TimeInForce is the type of TimeInForce value to use.
MinFillSize float64 `json:"minFillSize,omitempty"` // MinFillSize is the minimum fill size for FILL_OR_KILL orders.
BetTargetType BetTargetType `json:"betTargetType,omitempty"` // BetTargetType is an optional field to allow betting to a targeted PAYOUT or BACKERS_PROFIT.
BetTargetSize float64 `json:"betTargetSize,omitempty"` // BetTargetSize is the value of the payout or profit.
}
LimitOrder is the details of a limit order.
type ListClearedOrdersParams ¶
type ListClearedOrdersParams struct {
BetStatus BetStatus `json:"betStatus"` // BetStatus restricts the results to the specified status.
EventTypeIDs []string `json:"eventTypeIds,omitempty"` // EventTypeIDs optionally restricts the results to the specified Event Type IDs.
EventIDs []string `json:"eventIds,omitempty"` // EventIDs optionally restricts the results to the specified Event IDs.
MarketIDs []string `json:"marketIds,omitempty"` // MarketIDs optionally restricts the results to the specified market IDs.
RunnerIDs []int64 `json:"runnerIds,omitempty"` // RunnerIDs optionally restricts the results to the specified Runners.
BetIDs []string `json:"betIds,omitempty"` // BetIDs optionally restricts the results to the specified bet IDs. A maximum of 1000 betId's are allowed in a single request.
CustomerOrderRefs []string `json:"customerOrderRefs,omitempty"` // CustomerOrderRefs optionally restricts the results to the specified customer order references.
CustomerStrategyRefs []string `json:"customerStrategyRefs,omitempty"` // CustomerStrategyRefs optionally restricts the results to the specified customer strategy references.
Side Side `json:"side,omitempty"` // Side optionally restricts the results to the specified side.
SettledDateRange TimeRange `json:"settledDateRange,omitempty"` // SettledDateRange optionally restricts the results to be from/to the specified settled date.
GroupBy GroupBy `json:"groupBy,omitempty"` // GroupBy specifies how to aggregate the lines. This is only applicable to SETTLED BetStatus.
IncludeItemDescription bool `json:"includeItemDescription,omitempty"` // IncludeItemDescription if true then an ItemDescription object is included in the response.
Locale string `json:"locale,omitempty"` // Locale is the language used for the itemDescription. If not specified, the customer account default is returned.
FromRecord int `json:"fromRecord,omitempty"` // FromRecord specifies the first record that will be returned. Records start at index zero.
RecordCount int `json:"recordCount,omitempty"` // RecordCount specifies how many records will be returned, from the index position 'fromRecord'. Note that there is a page size limit of 1000.
IncludeSourceID bool `json:"includeSourceId,omitempty"` // IncludeSourceID specifies if sourceIdKey and sourceIdDescription should be returned. Defaults to false.
}
ListClearedOrdersParams are the request parameters for listClearedOrders.
type ListClearedOrdersReport ¶
type ListClearedOrdersReport struct {
ClearedOrders []ListClearedOrdersResult `json:"clearedOrders"` // ClearedOrders is the list of cleared orders.
MoreAvailable bool `json:"moreAvailable"` // MoreAvailable indicates whether more records are available.
}
ListClearedOrdersReport is the response from listClearedOrders (ClearedOrderSummaryReport).
type ListClearedOrdersResult ¶
type ListClearedOrdersResult struct {
EventTypeID string `json:"eventTypeId,omitempty"` // EventTypeID is the event type ID.
EventID string `json:"eventId,omitempty"` // EventID is the event ID.
MarketID string `json:"marketId,omitempty"` // MarketID is the market ID.
SelectionID int64 `json:"selectionId,omitempty"` // SelectionID is the selection ID.
Handicap float64 `json:"handicap,omitempty"` // Handicap is the handicap associated with the runner in case of Asian handicap market.
BetID string `json:"betId,omitempty"` // BetID is the bet ID.
PlacedDate time.Time `json:"placedDate,omitempty"` // PlacedDate is the date the order was placed.
PersistenceType PersistenceType `json:"persistenceType,omitempty"` // PersistenceType is what to do with the order at turn in play.
OrderType OrderType `json:"orderType,omitempty"` // OrderType is the type of the order.
Side Side `json:"side,omitempty"` // Side is the side of the bet.
ItemDescription ItemDescription `json:"itemDescription,omitempty"` // ItemDescription contains descriptive information about the cleared order item.
PriceRequested float64 `json:"priceRequested,omitempty"` // PriceRequested is the price requested.
SettledDate time.Time `json:"settledDate,omitempty"` // SettledDate is the date the order was settled.
LastMatchedDate time.Time `json:"lastMatchedDate,omitempty"` // LastMatchedDate is the date the order was last matched.
BetCount int `json:"betCount,omitempty"` // BetCount is the number of bets in this group.
Commission float64 `json:"commission,omitempty"` // Commission is the commission paid.
PriceMatched float64 `json:"priceMatched,omitempty"` // PriceMatched is the price matched at.
PriceReduced bool `json:"priceReduced,omitempty"` // PriceReduced indicates whether the price was reduced.
SizeSettled float64 `json:"sizeSettled,omitempty"` // SizeSettled is the amount settled.
Profit float64 `json:"profit,omitempty"` // Profit is the profit or loss incurred.
SizeCancelled float64 `json:"sizeCancelled,omitempty"` // SizeCancelled is the amount cancelled.
CustomerOrderRef string `json:"customerOrderRef,omitempty"` // CustomerOrderRef is an optional reference customers can use to specify which order has sent the order.
CustomerStrategyRef string `json:"customerStrategyRef,omitempty"` // CustomerStrategyRef is an optional reference customers can use to specify which strategy has sent the order.
SourceIDKey string `json:"sourceIdKey,omitempty"` // SourceIDKey is the source id key.
SourceIDDescription string `json:"sourceIdDescription,omitempty"` // SourceIDDescription is the source id description.
}
ListClearedOrdersResult holds a cleared order (ClearedOrderSummary).
type ListCompetitionsParams ¶
type ListCompetitionsParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListCompetitionsParams are the request parameters for listCompetitions.
type ListCompetitionsResult ¶
type ListCompetitionsResult struct {
Competition Competition `json:"competition"` // Competition is the competition associated with the markets.
MarketCount int `json:"marketCount"` // MarketCount is the number of markets associated with this Competition.
CompetitionRegion string `json:"competitionRegion"` // CompetitionRegion is the region in which this competition is taking place.
}
ListCompetitionsResult holds a Competition (CompetitionResult).
type ListCountriesParams ¶
type ListCountriesParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListCountriesParams are the request parameters for listCountries.
type ListCountriesResult ¶
type ListCountriesResult struct {
CountryCode string `json:"countryCode"` // CountryCode is the ISO-2 code for the country.
MarketCount int `json:"marketCount"` // MarketCount is the number of markets associated with this Country.
}
ListCountriesResult holds a country (CountryCodeResult).
type ListCurrencyRatesParams ¶
type ListCurrencyRatesParams struct {
FromCurrency string `json:"fromCurrency,omitempty"` // The currency from which the rates are computed. Please note: GBP is currently the only based currency support.
}
ListCurrencyRatesParams are the parameters for listCurrencyRates.
type ListCurrencyRatesResult ¶
type ListCurrencyRatesResult = CurrencyRate
type ListCurrentOrdersParams ¶
type ListCurrentOrdersParams struct {
BetIDs []string `json:"betIds,omitempty"` // BetIDs optionally restricts the results to the specified bet IDs. A maximum of 250 betId's, or a combination of 250 betId's & marketId's are permitted.
MarketIDs []string `json:"marketIds,omitempty"` // MarketIDs optionally restricts the results to the specified market IDs. A maximum of 250 marketId's, or a combination of 250 marketId's & betId's are permitted.
OrderProjection OrderProjection `json:"orderProjection,omitempty"` // OrderProjection optionally restricts the results to the specified order status.
CustomerOrderRefs []string `json:"customerOrderRefs,omitempty"` // CustomerOrderRefs optionally restricts the results to the specified customer order references.
CustomerStrategyRefs []string `json:"customerStrategyRefs,omitempty"` // CustomerStrategyRefs optionally restricts the results to the specified customer strategy references.
DateRange TimeRange `json:"dateRange,omitempty"` // DateRange optionally restricts the results to be from/to the specified date. The dates used to filter on will change to placed, matched, voided or settled dates depending on the orderBy.
OrderBy OrderBy `json:"orderBy,omitempty"` // OrderBy specifies how the results will be ordered.
SortDir SortDir `json:"sortDir,omitempty"` // SortDir specifies the direction the results will be sorted in.
FromRecord int `json:"fromRecord,omitempty"` // FromRecord specifies the first record that will be returned. Records start at index zero, not at index one.
RecordCount int `json:"recordCount,omitempty"` // RecordCount specifies how many records will be returned from the index position 'fromRecord'. Note that there is a page size limit of 1000.
IncludeItemDescription bool `json:"includeItemDescription,omitempty"` // IncludeItemDescription if true then extra description parameters are included in the CurrentOrderSummaryReport.
IncludeSourceID bool `json:"includeSourceId,omitempty"` // IncludeSourceID specifies if sourceIdKey and sourceIdDescription should be returned. Defaults to false.
}
ListCurrentOrdersParams are the request parameters for listCurrentOrders.
type ListCurrentOrdersReport ¶
type ListCurrentOrdersReport struct {
CurrentOrders []ListCurrentOrdersResult `json:"currentOrders"` // CurrentOrders is the list of current orders.
MoreAvailable bool `json:"moreAvailable"` // MoreAvailable indicates whether more records are available.
}
ListCurrentOrdersReport is the response from listCurrentOrders (CurrentOrderSummaryReport).
type ListCurrentOrdersResult ¶
type ListCurrentOrdersResult struct {
BetID string `json:"betId"` // BetID is the bet ID of this order.
MarketID string `json:"marketId"` // MarketID is the market ID these orders are to be placed on.
SelectionID int64 `json:"selectionId"` // SelectionID is the selection ID these orders are to be placed on.
Handicap float64 `json:"handicap"` // Handicap is the handicap associated with the runner in case of Asian handicap market.
PriceSize PriceSize `json:"priceSize"` // PriceSize is the price and size of this bet.
BspLiability float64 `json:"bspLiability"` // BspLiability is the BSP liability.
Side Side `json:"side"` // Side is the side of the bet.
OrderStatus OrderStatus `json:"status"` // OrderStatus is the status of the order.
PersistenceType PersistenceType `json:"persistenceType"` // PersistenceType is what to do with the order at turn in play.
OrderType OrderType `json:"orderType"` // OrderType is the type of the order.
PlacedDate time.Time `json:"placedDate"` // PlacedDate is the date the order was placed.
MatchedDate time.Time `json:"matchedDate"` // MatchedDate is the date the order was matched.
AveragePriceMatched float64 `json:"averagePriceMatched,omitempty"` // AveragePriceMatched is the average price matched at.
SizeMatched float64 `json:"sizeMatched,omitempty"` // SizeMatched is the amount matched.
SizeRemaining float64 `json:"sizeRemaining,omitempty"` // SizeRemaining is the amount remaining.
SizeLapsed float64 `json:"sizeLapsed,omitempty"` // SizeLapsed is the amount lapsed.
SizeCancelled float64 `json:"sizeCancelled,omitempty"` // SizeCancelled is the amount cancelled.
SizeVoided float64 `json:"sizeVoided,omitempty"` // SizeVoided is the amount voided.
RegulatorAuthCode string `json:"regulatorAuthCode,omitempty"` // RegulatorAuthCode is the regulator auth code.
RegulatorCode string `json:"regulatorCode,omitempty"` // RegulatorCode is the regulator code.
CustomerOrderRef string `json:"customerOrderRef,omitempty"` // CustomerOrderRef is an optional reference customers can use to specify which order has sent the order.
CustomerStrategyRef string `json:"customerStrategyRef,omitempty"` // CustomerStrategyRef is an optional reference customers can use to specify which strategy has sent the order.
CurrentItemDescription CurrentItemDescription `json:"currentItemDescription,omitempty"` // CurrentItemDescription contains extra description parameters.
SourceIdKey string `json:"sourceIdKey,omitempty"` // SourceIdKey is the source id key.
SourceIdDescription string `json:"sourceIdDescription,omitempty"` // SourceIdDescription is the source id description.
}
ListCurrentOrdersResult holds a current order (CurrentOrderSummary).
type ListEventTypesParams ¶
type ListEventTypesParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListEventTypesParams are the request parameters for listEventTypes.
type ListEventTypesResult ¶
type ListEventTypesResult struct {
EventType EventType `json:"eventType,omitempty"` // EventType is the Event Type (i.e. Sport).
MarketCount int `json:"marketCount,omitempty"` // MarketCount is the number of markets associated with this Event Type.
}
ListEventTypesResult holds an Event Type (EventTypeResult).
type ListEventsParams ¶
type ListEventsParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListEventsParams are the request parameters for listEvents.
type ListEventsResult ¶
type ListEventsResult struct {
Event Event `json:"event"` // Event is the event associated with the markets.
MarketCount int `json:"marketCount"` // MarketCount is the number of markets associated with this Event.
}
ListEventsResult holds an Event (EventResult).
type ListMarketBookParams ¶
type ListMarketBookParams struct {
MarketIDs []string `json:"marketIds"` // MarketIDs are one or more market ids. The number of markets returned depends on the amount of data you request via the price projection.
PriceProjection PriceProjection `json:"priceProjection,omitempty"` // PriceProjection is the projection of price data you want to receive in the response.
OrderProjection OrderProjection `json:"orderProjection,omitempty"` // OrderProjection is the orders you want to receive in the response.
MatchProjection MatchProjection `json:"matchProjection,omitempty"` // MatchProjection specifies the representation of matches if you ask for orders.
IncludeOverallPosition bool `json:"includeOverallPosition,omitempty"` // IncludeOverallPosition returns matches for each selection if you ask for orders. Defaults to true if unspecified.
PartitionMatchedByStrategyRef bool `json:"partitionMatchedByStrategyRef,omitempty"` // PartitionMatchedByStrategyRef returns the breakdown of matches by strategy for each selection if you ask for orders. Defaults to false if unspecified.
CustomerStrategyRefs []string `json:"customerStrategyRefs,omitempty"` // CustomerStrategyRefs restricts the results to orders matching any of the specified set of customer defined strategies.
CurrencyCode string `json:"currencyCode,omitempty"` // CurrencyCode is a Betfair standard currency code. If not specified, the default currency code is used.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
MatchedSince time.Time `json:"matchedSince,omitempty"` // MatchedSince restricts the results to orders that have at least one fragment matched since the specified date.
BetIDs []string `json:"betIds,omitempty"` // BetIDs restricts the results to orders with the specified bet IDs. A maximum of 250 betId's can be provided at a time.
}
ListMarketBookParams are the request parameters for listMarketBook.
type ListMarketBookResult ¶
type ListMarketBookResult = MarketBook
ListMarketBookResult is the dynamic data in a market (MarketBook).
type ListMarketCatalogueParams ¶
type ListMarketCatalogueParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
MarketProjections []MarketProjection `json:"marketProjection,omitempty"` // MarketProjections controls the type and amount of data returned about the market.
Sort MarketSort `json:"sort,omitempty"` // Sort controls the order of the results. Will default to RANK if not passed.
MaxResults int `json:"maxResults"` // MaxResults is the limit on the total number of results returned, must be greater than 0 and less than or equal to 1000.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListMarketCatalogueParams are the request parameters for listMarketCatalogue.
type ListMarketCatalogueResult ¶
type ListMarketCatalogueResult struct {
MarketID string `json:"marketId"` // MarketID is the unique identifier for the market. MarketId's are prefixed with '1.'.
MarketName string `json:"marketName"` // MarketName is the name of the market.
MarketStartTime time.Time `json:"marketStartTime,omitempty"` // MarketStartTime is the time this market starts at, only returned when the MARKET_START_TIME enum is passed in the marketProjections.
MarketDescription MarketDescription `json:"description,omitempty"` // MarketDescription contains details about the market.
TotalMatched float64 `json:"totalMatched,omitempty"` // TotalMatched is the total amount of money matched on the market. Please note: The returned value is cached. For the live total matched value please use listMarketBook.
Runners []RunnerCatalog `json:"runners,omitempty"` // Runners are the runners (selections) contained in the market.
EventType EventType `json:"eventType,omitempty"` // EventType is the Event Type the market is contained within.
Competition Competition `json:"competition,omitempty"` // Competition is the competition the market is contained within. Usually only applies to Football competitions.
Event Event `json:"event,omitempty"` // Event is the event the market is contained within.
}
ListMarketCatalogueResult holds information about a market (MarketCatalogue).
type ListMarketProfitAndLossParams ¶
type ListMarketProfitAndLossParams struct {
MarketIDs []string `json:"marketIds,omitempty"` // MarketIDs is the list of markets to calculate profit and loss.
IncludeSettledBets bool `json:"includeSettledBets,omitempty"` // IncludeSettledBets is the option to include settled bets (partially settled markets only). Defaults to false if not specified.
IncludeBspBets bool `json:"includeBspBets,omitempty"` // IncludeBspBets is the option to include BSP bets. Defaults to false if not specified.
NetOfCommission bool `json:"netOfCommission,omitempty"` // NetOfCommission is the option to return profit and loss net of users current commission rate for this market including any special tariffs. Defaults to false if not specified.
}
ListMarketProfitAndLossParams are the request parameters for listMarketProfitAndLoss.
type ListMarketProfitAndLossResult ¶
type ListMarketProfitAndLossResult = MarketProfitAndLoss
ListMarketProfitAndLossResult is profit and loss for a market.
type ListMarketTypesParams ¶
type ListMarketTypesParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListMarketTypesParams are the request parameters for listMarketTypes.
type ListMarketTypesResult ¶
type ListMarketTypesResult struct {
MarketType string `json:"marketType,omitempty"` // MarketType is the market type code (e.g. MATCH_ODDS, NEXT_GOAL).
MarketCount int `json:"marketCount,omitempty"` // MarketCount is the number of markets associated with this market type.
}
ListMarketTypesResult holds a market type (MarketTypeResult).
type ListRaceDetailsParams ¶
type ListRaceDetailsParams struct {
MeetingIDs []string `json:"meetingIds,omitempty"` // MeetingIDs optionally restricts the results to the specified meeting IDs.
RaceIDs []string `json:"raceIds,omitempty"` // RaceIDs optionally restricts the results to the specified race IDs in the format meetingid.raceTime (hhmm).
}
ListRaceDetailsParams are the request parameters for listRaceDetails.
type ListRaceDetailsResult ¶
type ListRaceDetailsResult struct {
MeetingID string `json:"meetingId,omitempty"` // MeetingID is the unique Id for the meeting equivalent to the eventId for that specific race as returned by listEvents.
RaceID string `json:"raceId,omitempty"` // RaceID is the unique Id for the race in the format meetingid.raceTime (hhmm).
RaceStatus RaceStatus `json:"raceStatus,omitempty"` // RaceStatus is the current status of the race.
LastUpdated time.Time `json:"lastUpdated,omitempty"` // LastUpdated is the time the data was last updated.
Sequence int64 `json:"sequence,omitempty"` // Sequence is the unique identifier associated to each update of the data.
ResponseCode ResponseCode `json:"responseCode,omitempty"` // ResponseCode is the response code for this race status update.
}
ListRaceDetailsResult holds race details (RaceDetails).
type ListRunnerBookParams ¶
type ListRunnerBookParams struct {
MarketID string `json:"marketId"` // MarketID is the unique id for the market.
SelectionID int64 `json:"selectionId"` // SelectionID is the unique id for the selection in the market.
Handicap float64 `json:"handicap,omitempty"` // Handicap is the handicap associated with the runner in case of Asian handicap market.
PriceProjection PriceProjection `json:"priceProjection,omitempty"` // PriceProjection is the projection of price data you want to receive in the response.
OrderProjection OrderProjection `json:"orderProjection,omitempty"` // OrderProjection is the orders you want to receive in the response.
MatchProjection MatchProjection `json:"matchProjection,omitempty"` // MatchProjection specifies the representation of matches if you ask for orders.
IncludeOverallPosition bool `json:"includeOverallPosition,omitempty"` // IncludeOverallPosition returns matches for each selection if you ask for orders. Defaults to true if unspecified.
PartitionMatchedByStrategyRef bool `json:"partitionMatchedByStrategyRef,omitempty"` // PartitionMatchedByStrategyRef returns the breakdown of matches by strategy for each selection if you ask for orders. Defaults to false if unspecified.
CustomerStrategyRefs []string `json:"customerStrategyRefs,omitempty"` // CustomerStrategyRefs restricts the results to orders matching any of the specified set of customer defined strategies.
CurrencyCode string `json:"currencyCode,omitempty"` // CurrencyCode is a Betfair standard currency code. If not specified, the default currency code is used.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
MatchedSince time.Time `json:"matchedSince,omitempty"` // MatchedSince restricts the results to orders that have at least one fragment matched since the specified date.
BetIDs []string `json:"betIds,omitempty"` // BetIDs restricts the results to orders with the specified bet IDs. A maximum of 250 betId's can be provided at a time.
}
ListRunnerBookParams are the request parameters for listRunnerBook.
type ListRunnerBookResult ¶
type ListRunnerBookResult = MarketBook
ListRunnerBookResult is the dynamic data in a market (MarketBook).
type ListTimeRangesParams ¶
type ListTimeRangesParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Granularity TimeGranularity `json:"granularity"` // Granularity is the granularity of time periods that correspond to markets selected by the market filter.
}
ListTimeRangesParams are the request parameters for listTimeRanges.
type ListTimeRangesResult ¶
type ListTimeRangesResult struct {
TimeRange TimeRange `json:"timeRange,omitempty"` // TimeRange is the time range associated with the markets.
MarketCount int `json:"marketCount,omitempty"` // MarketCount is the number of markets associated with this time range.
}
ListTimeRangesResult holds a time range (TimeRangeResult).
type ListVenuesParams ¶
type ListVenuesParams struct {
Filter MarketFilter `json:"filter"` // Filter selects desired markets. All markets that match the criteria in the filter are selected.
Locale string `json:"locale,omitempty"` // Locale is the language used for the response. If not specified, the default is returned.
}
ListVenuesParams are the request parameters for listVenues.
type ListVenuesResult ¶
type ListVenuesResult struct {
Venue string `json:"venue"` // Venue is the venue associated with the markets (e.g. Cheltenham, Ascot).
MarketCount int `json:"marketCount"` // MarketCount is the number of markets associated with this Venue.
}
ListVenuesResult holds a venue (VenueResult).
type LoginResponse ¶
type LoginResponse struct {
SessionToken string `json:"sessionToken"` // Session token created at login.
LoginStatus LoginStatus `json:"loginStatus"` // Login status (SUCCESS or failure reason).
}
LoginResponse is returned by the Non-Interactive (bot) login endpoint.
type LoginStatus ¶
type LoginStatus string
LoginStatus is returned by the Non-Interactive (bot) login and Interactive Login API endpoints.
const ( LS_SUCCESS LoginStatus = "SUCCESS" // Successful login. LS_INVALID_USERNAME_OR_PASSWORD LoginStatus = "INVALID_USERNAME_OR_PASSWORD" // The username or password are invalid. LS_ACCOUNT_NOW_LOCKED LoginStatus = "ACCOUNT_NOW_LOCKED" // The account was just locked. LS_ACCOUNT_ALREADY_LOCKED LoginStatus = "ACCOUNT_ALREADY_LOCKED" // The account is already locked. LS_PENDING_AUTH LoginStatus = "PENDING_AUTH" // Pending authentication. LS_TELBET_TERMS_CONDITIONS_NA LoginStatus = "TELBET_TERMS_CONDITIONS_NA" // Telbet terms and conditions rejected. LS_DUPLICATE_CARDS LoginStatus = "DUPLICATE_CARDS" // Duplicate cards. LS_SECURITY_QUESTION_WRONG_3X LoginStatus = "SECURITY_QUESTION_WRONG_3X" // The user has entered wrong the security answer 3 times. LS_KYC_SUSPEND LoginStatus = "KYC_SUSPEND" // KYC suspended. LS_SUSPENDED LoginStatus = "SUSPENDED" // The account is suspended. LS_CLOSED LoginStatus = "CLOSED" // The account is closed. LS_SELF_EXCLUDED LoginStatus = "SELF_EXCLUDED" // The account has been self-excluded. LS_INVALID_CONNECTIVITY_TO_REGULATOR_DK LoginStatus = "INVALID_CONNECTIVITY_TO_REGULATOR_DK" // The DK regulator cannot be accessed due to some internal problems in the system behind or in at regulator; timeout cases included. LS_NOT_AUTHORIZED_BY_REGULATOR_DK LoginStatus = "NOT_AUTHORIZED_BY_REGULATOR_DK" // The user identified by the given credentials is not authorized in the DK's jurisdictions due to the regulators' policies. Ex: the user for which this session should be created is not allowed to act(play, bet) in the DK's jurisdiction. LS_INVALID_CONNECTIVITY_TO_REGULATOR_IT LoginStatus = "INVALID_CONNECTIVITY_TO_REGULATOR_IT" // The IT regulator cannot be accessed due to some internal problems in the system behind or in at regulator; timeout cases included. LS_NOT_AUTHORIZED_BY_REGULATOR_IT LoginStatus = "NOT_AUTHORIZED_BY_REGULATOR_IT" // The user identified by the given credentials is not authorized in the IT's jurisdictions due to the regulators' policies. Ex: the user for which this session should be created is not allowed to act(play, bet) in the IT's jurisdiction. LS_SECURITY_RESTRICTED_LOCATION LoginStatus = "SECURITY_RESTRICTED_LOCATION" // The account is restricted due to security concerns. LS_BETTING_RESTRICTED_LOCATION LoginStatus = "BETTING_RESTRICTED_LOCATION" // The account is accessed from a location where betting is restricted. LS_TRADING_MASTER LoginStatus = "TRADING_MASTER" // Trading Master Account. LS_TRADING_MASTER_SUSPENDED LoginStatus = "TRADING_MASTER_SUSPENDED" // Suspended Trading Master Account. LS_AGENT_CLIENT_MASTER LoginStatus = "AGENT_CLIENT_MASTER" // Agent Client Master. LS_AGENT_CLIENT_MASTER_SUSPENDED LoginStatus = "AGENT_CLIENT_MASTER_SUSPENDED" // Suspended Agent Client Master. LS_DANISH_AUTHORIZATION_REQUIRED LoginStatus = "DANISH_AUTHORIZATION_REQUIRED" // Danish authorization required. LS_SPAIN_MIGRATION_REQUIRED LoginStatus = "SPAIN_MIGRATION_REQUIRED" // Spain migration required. LS_DENMARK_MIGRATION_REQUIRED LoginStatus = "DENMARK_MIGRATION_REQUIRED" // Denmark migration required. LS_SPANISH_TERMS_ACCEPTANCE_REQUIRED LoginStatus = "SPANISH_TERMS_ACCEPTANCE_REQUIRED" // The latest Spanish terms and conditions version must be accepted. You must login to the website to accept the new conditions. LS_ITALIAN_CONTRACT_ACCEPTANCE_REQUIRED LoginStatus = "ITALIAN_CONTRACT_ACCEPTANCE_REQUIRED" // The latest Italian contract version must be accepted. You must login to the website to accept the new conditions. LS_CERT_AUTH_REQUIRED LoginStatus = "CERT_AUTH_REQUIRED" // Certificate required or certificate present but could not authenticate with it. Please check that the correct file path is specified and ensure you are entering the correct password. LS_CHANGE_PASSWORD_REQUIRED LoginStatus = "CHANGE_PASSWORD_REQUIRED" // Change password required. LS_PERSONAL_MESSAGE_REQUIRED LoginStatus = "PERSONAL_MESSAGE_REQUIRED" // Personal message required for the user. LS_INTERNATIONAL_TERMS_ACCEPTANCE_REQUIRED LoginStatus = "INTERNATIONAL_TERMS_ACCEPTANCE_REQUIRED" // The latest international terms and conditions must be accepted prior to logging in. LS_EMAIL_LOGIN_NOT_ALLOWED LoginStatus = "EMAIL_LOGIN_NOT_ALLOWED" // This account has not opted in to log in with the email. LS_MULTIPLE_USERS_WITH_SAME_CREDENTIAL LoginStatus = "MULTIPLE_USERS_WITH_SAME_CREDENTIAL" // There is more than one account with the same credential. LS_ACCOUNT_PENDING_PASSWORD_CHANGE LoginStatus = "ACCOUNT_PENDING_PASSWORD_CHANGE" // The account must undergo password recovery to reactivate via https://identitysso.betfair.com/view/recoverpassword. LS_TEMPORARY_BAN_TOO_MANY_REQUESTS LoginStatus = "TEMPORARY_BAN_TOO_MANY_REQUESTS" // The limit for successful login requests per minute has been exceeded. New login attempts will be banned for 20 minutes. LS_ITALIAN_PROFILING_ACCEPTANCE_REQUIRED LoginStatus = "ITALIAN_PROFILING_ACCEPTANCE_REQUIRED" // You must login to the website to accept the new conditions. LS_AUTHORIZED_ONLY_FOR_DOMAIN_RO LoginStatus = "AUTHORIZED_ONLY_FOR_DOMAIN_RO" // You are attempting to login to the Betfair Romania domain with a non .ro account. LS_AUTHORIZED_ONLY_FOR_DOMAIN_SE LoginStatus = "AUTHORIZED_ONLY_FOR_DOMAIN_SE" // You are attempting to login to the Betfair Swedish domain with a non .se account. LS_SWEDEN_NATIONAL_IDENTIFIER_REQUIRED LoginStatus = "SWEDEN_NATIONAL_IDENTIFIER_REQUIRED" // You must provided your Swedish National identifier via Betfair.se before proceeding. LS_SWEDEN_BANK_ID_VERIFICATION_REQUIRED LoginStatus = "SWEDEN_BANK_ID_VERIFICATION_REQUIRED" // You must provided your Swedish bank id via Betfair.se before proceeding. LS_ACTIONS_REQUIRED LoginStatus = "ACTIONS_REQUIRED" // You must login to https://www.betfair.com to provide the missing information. LS_INPUT_VALIDATION_ERROR LoginStatus = "INPUT_VALIDATION_ERROR" // There is a problem with the data validity contained within the request. Please check that the request (including headers) is in the correct format. LS_MIGRATION_REQUIRED LoginStatus = "MIGRATION_REQUIRED" // Brazil customers only - you must login to betfair.bet.br to migrate your account (from 1st January 2025). LS_TERMS_AND_CONDITIONS LoginStatus = "TERMS_AND_CONDITIONS" // Brazil customers only - you must login to betfair.bet.br to accept the new terms and conditions (from 1st January 2025). LS_CONTACT_VERIFICATION_REQUIRED LoginStatus = "CONTACT_VERIFICATION_REQUIRED" // You must login via Betfair website (https://www.betfair.com) and complete KYC document verification. )
type LogoutResponse ¶
type LogoutResponse = SessionStatusResponse
ClientConfig configures the Betfair API client.
type MarketBettingType ¶
type MarketBettingType string
MarketBettingType restricts markets by the betting type of the market.
const ( MBT_ODDS MarketBettingType = "ODDS" // Odds Market - Any market that doesn't fit any any of the below categories. MBT_LINE MarketBettingType = "LINE" // Line Market - LINE markets operate at even-money odds of 2.0. However, price for these markets refers to the line positions available as defined by the markets min-max range and interval steps. Customers either Buy a line (LAY bet, winning if outcome is greater than the taken line (price)) or Sell a line (BACK bet, winning if outcome is less than the taken line (price)). If settled outcome equals the taken line, stake is returned. MBT_RANGE MarketBettingType = "RANGE" // Range Market - Now Deprecated. MBT_ASIAN_HANDICAP_SINGLE_LINE MarketBettingType = "ASIAN_HANDICAP_SINGLE_LINE" // Asian Single Line Market - A market in which there can be 0 or multiple winners. e,.g marketType TOTAL_GOALS. MBT_ASIAN_HANDICAP_DOUBLE_LINE MarketBettingType = "ASIAN_HANDICAP_DOUBLE_LINE" // Asian Handicap Market - A traditional Asian handicap market. Can be identified by marketType ASIAN_HANDICAP. MBT_FIXED_ODDS MarketBettingType = "FIXED_ODDS" // Sportsbook Odds Market. This type is deprecated and will be removed in future releases, when Sportsbook markets will be represented as ODDS market but with a different product type. )
type MarketBook ¶
type MarketBook struct {
MarketID string `json:"marketId"` // MarketID is the unique identifier for the market. MarketId's are prefixed with '1.'.
IsMarketDataDelayed bool `json:"isMarketDataDelayed"` // IsMarketDataDelayed is true if the data returned by listMarketBook will be delayed. The data may be delayed because you are not logged in with a funded account or you are using an Application Key that does not allow up to date data.
Status MarketStatus `json:"status,omitempty"` // Status is the status of the market, for example OPEN, SUSPENDED, CLOSED (settled), etc.
SuspendReason string `json:"suspendReason,omitempty"` // SuspendReason is currently returned only for Soccer markets, when status = SUSPENDED. Possible values are Goal, Third Party Unavailable, Penalty, Red Card, Non In Play Market,
BetDelay int `json:"betDelay,omitempty"` // BetDelay is the number of seconds an order is held until it is submitted into the market. Orders are usually delayed when the market is in-play
BspReconciled bool `json:"bspReconciled,omitempty"` // BspReconciled is true if the market starting price has been reconciled
Complete bool `json:"complete,omitempty"` // Complete is false if runners may be added to the market
Inplay bool `json:"inplay,omitempty"` // Inplay is true if the market is currently in play
NumberOfWinners int `json:"numberOfWinners,omitempty"` // NumberOfWinners is the number of selections that could be settled as winners
NumberOfRunners int `json:"numberOfRunners,omitempty"` // NumberOfRunners is the number of runners in the market
NumberOfActiveRunners int `json:"numberOfActiveRunners,omitempty"` // NumberOfActiveRunners is the number of runners that are currently active. An active runner is a selection available for betting
LastMatchTime time.Time `json:"lastMatchTime,omitempty"` // LastMatchTime is the most recent time an order was executed
TotalMatched float64 `json:"totalMatched,omitempty"` // TotalMatched is the total amount matched
TotalAvailable float64 `json:"totalAvailable,omitempty"` // TotalAvailable is the total amount of orders that remain unmatched
CrossMatching bool `json:"crossMatching,omitempty"` // CrossMatching is true if cross matching is enabled for this market.
RunnersVoidable bool `json:"runnersVoidable,omitempty"` // RunnersVoidable is true if runners in the market can be voided. Please note - this doesn't include horse racing markets under which bets are voided on non-runners with any applicable reduction factor applied/
Version int64 `json:"version,omitempty"` // Version is the version of the market. The version increments whenever the market status changes, for example, turning in-play, or suspended when a goal is scored.
Runners []Runner `json:"runners,omitempty"` // Runners is information about the runners (selections) in the market.
KeyLineDescription KeyLineDescription `json:"keyLineDescription,omitempty"` // KeyLineDescription is description of a markets key line for valid market types
BetDelayModels []BetDelayModel `json:"betDelayModels,omitempty"` // BetDelayModels indicates which bet delay models are applied to a market if applicable. i.e. PASSIVE, DYNAMIC or both.
}
MarketBook is the dynamic data in a market.
type MarketChange ¶
type MarketChange struct {
MarketID string `json:"id,omitempty"` // Market Id - the id of the market.
Image bool `json:"img,omitempty"` // Image - replace existing prices/data with the data supplied: it is not a delta (or null if delta).
TotalVolume float64 `json:"tv,omitempty"` // The total amount matched across the market. This value is truncated at 2dp (or null if un-changed).
MarketDefinition MarketDefinition `json:"marketDefinition,omitempty"` // Full Market Definition if changed.
RunnerChanges []RunnerChange `json:"rc"` // Runner Changes - a list of changes to runners (or null if un-changed).
}
MarketChange contains changes to a single market.
type MarketChangeMessage ¶
type MarketChangeMessage struct {
ID int `json:"id"` // Client generated unique id to link request with response (like json rpc).
Op string `json:"op"` // The operation type.
ChangeType ChangeType `json:"ct,omitempty"` // Change Type - set to indicate the type of change - if null this is a delta.
SegmentType SegmentType `json:"segmentType,omitempty"` // Segment Type - if the change is split into multiple segments, this denotes the beginning and end of a change.
ConflateMs int `json:"conflateMs"` // Conflate Milliseconds - the conflation rate (may differ from that requested if subscription is delayed).
Status string `json:"status"` // Stream status: set to null if the exchange stream data is up to date and 503 if the downstream services are experiencing latencies.
HeartbeatMs int `json:"heartbeatMs"` // Heartbeat Milliseconds - the heartbeat rate (may differ from requested: bounds are 500 to 30000).
PublishTime int64 `json:"pt"` // Publish Time (in millis since epoch) that the changes were generated.
InitialClk string `json:"initialClk"` // Token value (non-null) should be stored and passed in a MarketSubscriptionMessage to resume subscription (in case of disconnect).
Clk string `json:"clk"` // Token value (non-null) should be stored and passed in a MarketSubscriptionMessage to resume subscription (in case of disconnect).
MarketChanges []MarketChange `json:"mc"` // MarketChanges - the modifications to markets (will be null on a heartbeat).
}
MarketChangeMessage contains market price changes from the Exchange Stream API.
type MarketDataFilter ¶
type MarketDataFilter struct {
LadderLevels int `json:"ladderLevels,omitempty"` // Number of price ladder levels to return (1 to 10).
Fields []MarketDataFilterField `json:"fields,omitempty"` // Market data fields to include in the subscription.
}
MarketDataFilter selects which market data fields are returned in a market subscription.
type MarketDataFilterField ¶
type MarketDataFilterField string
MarketDataFilterField selects Exchange Stream API market data fields in a MarketDataFilter.
const ( MDFF_EX_BEST_OFFERS_DISP MarketDataFilterField = "EX_BEST_OFFERS_DISP" // Best prices including Virtual Bets - depth is controlled by ladderLevels (1 to 10). MDFF_EX_BEST_OFFERS MarketDataFilterField = "EX_BEST_OFFERS" // Best prices not including Virtual Bets - depth is controlled by ladderLevels (1 to 10). MDFF_EX_ALL_OFFERS MarketDataFilterField = "EX_ALL_OFFERS" // Full available to BACK/LAY ladder. MDFF_EX_TRADED MarketDataFilterField = "EX_TRADED" // Full traded ladder. This is the amount traded at any price on any selection in the market. MDFF_EX_TRADED_VOL MarketDataFilterField = "EX_TRADED_VOL" // Market and runner level traded volume. MDFF_EX_LTP MarketDataFilterField = "EX_LTP" // The "Last Price Matched" on a selection. MDFF_EX_MARKET_DEF MarketDataFilterField = "EX_MARKET_DEF" // Send market definitions. To receive updates to any of the MarketDefinition fields. MDFF_SP_TRADED MarketDataFilterField = "SP_TRADED" // Starting price ladder. MDFF_SP_PROJECTED MarketDataFilterField = "SP_PROJECTED" // Starting price projection prices. To receive any update to the Betfair SP Near and Far price. )
type MarketDefinition ¶
type MarketDefinition struct {
MarketID string `json:"id"` // Market Id - the id of the market.
Venue string `json:"venue"` // The venue - applies to horse racing and greyhound markets only.
RaceType RaceType `json:"raceType"` // Harness, Flat, Hurdle, Chase, Bumper, NH Flat, Steeple (AUS/NZ races), and NO_VALUE (when no valid race type has been mapped).
SettledTime time.Time `json:"settledTime"` // Market settled time.
TimeZone string `json:"timeZone"` // This is the timezone in which the event is taking place.
EachWayDivisor float64 `json:"eachWayDivisor"` // The divisor is returned for the marketType EACH_WAY only and refers to the fraction of the win odds at which the place portion of an each way bet is settled.
BspMarket bool `json:"bspMarket"` // If 'true' the market supports Betfair SP betting.
TurnInPlayEnabled bool `json:"turnInPlayEnabled"` // If 'true' the market is set to turn in-play.
PriceLadderDefinition PriceLadderDefinition `json:"priceLadderDefinition"` // Definition of the price ladder type "CLASSIC", "FINEST", "LINE_RANGE".
KeyLineDefinition KeyLineDescription `json:"keyLineDefinition,omitempty"` // Definition of a markets key line selection (for valid markets).
PersistenceEnabled bool `json:"persistenceEnabled"` // If 'true' the market supports 'Keep' bets if the market is to be turned in-play.
MarketBaseRate float64 `json:"marketBaseRate"` // The commission rate applicable to the market.
EventID string `json:"eventId"` // The unique id for the event.
EventTypeID string `json:"eventTypeId"` // The unique eventTypeId that the event belongs to.
NumberOfWinners int `json:"numberOfWinners"` // The number of winners on a market.
CountryCode string `json:"countryCode"` // The events ISO 3166-2 country code.
LineMaxUnit float64 `json:"lineMaxUnit"` // For Handicap and Line markets, the maximum value for the outcome, in market units for this market (eg 100 runs).
BettingType string `json:"bettingType"` // The market betting type i.e. ODDS, ASIAN_HANDICAP_DOUBLE_LINE, etc.
MarketType string `json:"marketType"` // Market base type.
MarketTime string `json:"marketTime"` // The market start time.
SuspendTime string `json:"suspendTime"` // The market suspend time.
BspReconciled bool `json:"bspReconciled"` // True if the market starting price has been reconciled.
Complete bool `json:"complete"` // If false, runners may be added to the market.
InPlay bool `json:"inPlay"` // True if the market is currently in play.
CrossMatching bool `json:"crossMatching"` // True if cross-matching is enabled for this market.
RunnersVoidable bool `json:"runnersVoidable"` // True if runners in the market can be voided.
NumberOfActiveRunners int `json:"numberOfActiveRunners"` // The number of runners that are currently active.
LineMinUnit float64 `json:"lineMinUnit"` // For Handicap and Line markets, the minimum value for the outcome, in market units for this market (eg 0 runs).
BetDelay int `json:"betDelay"` // The number of seconds an order is held until it is submitted into the market.
Status string `json:"status"` // The status of the market, for example, OPEN, SUSPENDED, CLOSED (settled), etc.
Regulators []string `json:"regulators"` // The market regulators.
DiscountAllowed bool `json:"discountAllowed"` // Indicate whether or not the user's discount rate is taken into account in this market.
OpenDate time.Time `json:"openDate"` // The scheduled start date and time of the event (GMT by default).
Version int64 `json:"version"` // A non-monotonically increasing number indicates market changes.
}
MarketDefinition is the full market definition from the Exchange Stream API.
type MarketDescription ¶
type MarketDescription struct {
PersistenceEnabled bool `json:"persistenceEnabled"` // PersistenceEnabled indicates whether the market supports persistence.
BspMarket bool `json:"bspMarket"` // BspMarket indicates whether the market is an BSP betting market.
MarketTime time.Time `json:"marketTime"` // MarketTime is the time this market starts at.
SuspendTime time.Time `json:"suspendTime"` // SuspendTime is the time this market is suspended at (or off time if turnInPlayEnabled is true).
SettleTime time.Time `json:"settleTime,omitempty"` // SettleTime is the settled time (may not be present).
BettingType MarketBettingType `json:"bettingType"` // BettingType is the betting type of the market.
TurnInPlayEnabled bool `json:"turnInPlayEnabled"` // TurnInPlayEnabled indicates whether the market will turn in play.
MarketType string `json:"marketType"` // MarketType is the market type e.g. MATCH_ODDS.
Regulator string `json:"regulator"` // Regulator is the regulator for the market.
MarketBaseRate float64 `json:"marketBaseRate"` // MarketBaseRate is the commission rate applicable to the market.
DiscountAllowed bool `json:"discountAllowed"` // DiscountAllowed indicates whether the user's discount rate is applied.
Wallet string `json:"wallet,omitempty"` // Wallet is the wallet from which the prices should be taken.
Rules string `json:"rules,omitempty"` // Rules are the rules for the market.
RulesHasDate bool `json:"rulesHasDate,omitempty"` // RulesHasDate indicates whether the rules include a date.
EachWayDivisor float64 `json:"eachWayDivisor,omitempty"` // EachWayDivisor is the divisor for each way markets.
Clarifications string `json:"clarifications,omitempty"` // Clarifications are any clarifications for the market.
LineRangeInfo MarketLineRangeInfo `json:"lineRangeInfo,omitempty"` // LineRangeInfo is the range of prices for a line market.
RaceType string `json:"raceType,omitempty"` // RaceType is the race type for horse racing markets.
PriceLadderDescription PriceLadderDescription `json:"priceLadderDescription,omitempty"` // PriceLadderDescription is the description of the price ladder for this market.
}
MarketDescription contains details about the market.
type MarketFilter ¶
type MarketFilter struct {
TextQuery string `json:"textQuery,omitempty"` // TextQuery restricts markets by any text associated with the Event name. You can include a wildcard (*) character as long as it is not the first character. Please note - the textQuery field doesn't evaluate market or selection names.
EventTypeIDs []string `json:"eventTypeIds,omitempty"` // EventTypeIDs restricts markets by event type associated with the market. (i.e., Football, Hockey, etc)
EventIDs []string `json:"eventIds,omitempty"` // EventIDs restricts markets by the event id associated with the market.
CompetitionIDs []string `json:"competitionIds,omitempty"` // CompetitionIDs restricts markets by the competitions associated with the market.
MarketIDs []string `json:"marketIds,omitempty"` // MarketIDs restricts markets by the market id associated with the market.
Venues []string `json:"venues,omitempty"` // Venues restricts markets by the venue associated with the market. Currently, only Horse & Greyhound racing markets have venues.
BspOnly bool `json:"bspOnly,omitempty"` // BspOnly restricts to bsp markets only, if True or non-bsp markets if False. If not specified then returns both BSP and non-BSP markets
TurnInPlayEnabled bool `json:"turnInPlayEnabled,omitempty"` // TurnInPlayEnabled restricts to markets that will turn in play if True or will not turn in play if false. If not specified, returns both.
InPlayOnly bool `json:"inPlayOnly,omitempty"` // InPlayOnly restricts to markets that are currently in play if True or are not currently in play if false. If not specified, returns both.
MarketBettingTypes []MarketBettingType `json:"marketBettingTypes,omitempty"` // MarketBettingTypes restricts to markets that match the betting type of the market (i.e. Odds, Asian Handicap Singles, Asian Handicap Doubles or Line)
MarketTypeCodes []string `json:"marketTypeCodes,omitempty"` // MarketTypeCodes restricts to markets that match the type of the market (i.e., MATCH_ODDS, HALF_TIME_SCORE). You should use this instead of relying on the market name as the market type codes are the same in all locales. Please note: All market types are available via the listMarketTypes operations.
MarketCountries []string `json:"marketCountries,omitempty"` // MarketCountries restricts to markets that are in the specified country or countries. Please note: the default value is 'GB' when the correct country code cannot be determined.
MarketStartTime TimeRange `json:"marketStartTime,omitempty"` // MarketStartTime restricts to markets with a market start time before or after the specified date
WithOrders []OrderStatus `json:"withOrders,omitempty"` // WithOrders restricts to markets where I have one or more orders in these states.
RaceTypes []RaceType `json:"raceTypes,omitempty"` // RaceTypes restricts to markets of a specific raceType. Valid values are - Harness, Flat, Hurdle, Chase, Bumper, NH Flat, Steeple (AUS/NZ races), and NO_VALUE (when no valid race type has been mapped).
BetDelayModels []BetDelayModel `json:"betDelayModels,omitempty"` // BetDelayModels restricts to markets specific betDelayModels. e.g. PASSIVE, DYNAMIC
}
MarketFilter selects markets for list* catalogue operations.
type MarketLineRangeInfo ¶
type MarketLineRangeInfo struct {
MaxUnitValue float64 `json:"maxUnitValue"` // MaxUnitValue is the maximum value for the line market.
MinUnitValue float64 `json:"minUnitValue"` // MinUnitValue is the minimum value for the line market.
Interval float64 `json:"interval"` // Interval is the increments in which the market shall be displayed.
MarketUnit string `json:"marketUnit"` // MarketUnit is the unit for the market (e.g. runs, goals).
}
MarketLineRangeInfo describes the range of prices for a line market.
type MarketOnCloseOrder ¶
type MarketOnCloseOrder struct {
Liability float64 `json:"liability"` // Liability is the size of the bet.
}
MarketOnCloseOrder is the details of a market on close order.
type MarketProfitAndLoss ¶
type MarketProfitAndLoss struct {
MarketID string `json:"marketId,omitempty"` // MarketID is the unique identifier for the market.
CommissionApplied float64 `json:"commissionApplied,omitempty"` // CommissionApplied is the commission for this market.
ProfitAndLosses []RunnerProfitAndLoss `json:"profitAndLosses,omitempty"` // ProfitAndLosses is the list of profit and loss per runner.
}
MarketProfitAndLoss holds profit and loss for a market.
type MarketProjection ¶
type MarketProjection string
MarketProjection controls the type and amount of data returned about the market.
const ( MP_COMPETITION MarketProjection = "COMPETITION" // MP_COMPETITION - If not selected then the competition will not be returned with marketCatalogue. MP_EVENT MarketProjection = "EVENT" // MP_EVENT - If not selected then the event will not be returned with marketCatalogue. MP_EVENT_TYPE MarketProjection = "EVENT_TYPE" // MP_EVENT_TYPE - If not selected then the eventType will not be returned with marketCatalogue. MP_MARKET_START_TIME MarketProjection = "MARKET_START_TIME" // MP_MARKET_START_TIME - If not selected then the start time will not be returned with marketCatalogue. MP_MARKET_DESCRIPTION MarketProjection = "MARKET_DESCRIPTION" // MP_MARKET_DESCRIPTION - If not selected then the description will not be returned with marketCatalogue. MP_RUNNER_DESCRIPTION MarketProjection = "RUNNER_DESCRIPTION" // MP_RUNNER_DESCRIPTION - If not selected then the runners will not be returned with marketCatalogue. MP_RUNNER_METADATA MarketProjection = "RUNNER_METADATA" // MP_RUNNER_METADATA - If not selected then the runner metadata will not be returned with marketCatalogue. If selected then RUNNER_DESCRIPTION will also be returned regardless of whether it is included as a market projection. )
type MarketSort ¶
type MarketSort string
MarketSort controls the order of the results. Will default to RANK if not passed.
const ( MS_MINIMUM_TRADED MarketSort = "MINIMUM_TRADED" // MS_MINIMUM_TRADED is minimum traded volume. MS_MAXIMUM_TRADED MarketSort = "MAXIMUM_TRADED" // MS_MAXIMUM_TRADED is maximum traded volume. MS_MINIMUM_AVAILABLE MarketSort = "MINIMUM_AVAILABLE" // MS_MINIMUM_AVAILABLE is minimum available to match. MS_MAXIMUM_AVAILABLE MarketSort = "MAXIMUM_AVAILABLE" // MS_MAXIMUM_AVAILABLE is maximum available to match. MS_FIRST_TO_START MarketSort = "FIRST_TO_START" // MS_FIRST_TO_START is the closest markets based on their expected start time. MS_LAST_TO_START MarketSort = "LAST_TO_START" // MS_LAST_TO_START is the most distant markets based on their expected start time. MS_RANK MarketSort = "RANK" // MS_RANK is the order of the results. Will default to RANK if not passed. )
type MarketStatus ¶
type MarketStatus string
MarketStatus is the status of the market, for example OPEN, SUSPENDED, CLOSED (settled), etc.
const ( MS_INACTIVE MarketStatus = "INACTIVE" // MS_INACTIVE indicates the market has been created but isn't yet available. MS_OPEN MarketStatus = "OPEN" // MS_OPEN indicates the market is open for betting. MS_SUSPENDED MarketStatus = "SUSPENDED" // MS_SUSPENDED indicates the market is suspended and not available for betting. MS_CLOSED MarketStatus = "CLOSED" // MS_CLOSED indicates the market has been settled and is no longer available for betting. )
type MarketSubscriptionMessage ¶
type MarketSubscriptionMessage struct {
ID int `json:"id"` // Client generated unique id to link request with response (like json rpc).
Op string `json:"op"` // The operation type.
SegmentationEnabled bool `json:"segmentationEnabled"` // Segmentation Enabled - allow the server to send large sets of data in segments, instead of a single block.
ConflateMs int `json:"conflateMs"` // Conflate Milliseconds - the conflation rate (looped back on initial image after validation: bounds are 0 to 120000).
HeartbeatMs int `json:"heartbeatMs"` // Heartbeat Milliseconds - the heartbeat rate (looped back on initial image after validation: bounds are 500 to 5000).
InitialClk string `json:"initialClk,omitempty"` // Token value (received in initial MarketChangeMessage) that should be passed to resume a subscription.
Clk string `json:"clk,omitempty"` // Token value delta (received in MarketChangeMessage) that should be passed to resume a subscription.
MarketFilter StreamMarketFilter `json:"marketFilter"` // Horizontal filter for market subscription.
MarketDataFilter MarketDataFilter `json:"marketDataFilter"` // Vertical filter for market data fields.
}
MarketSubscriptionMessage subscribes to market price changes on the Exchange Stream API.
type MarketType ¶
type MarketType string
MarketType is the market type for legacy statement data.
const ( MT_ASIAN_HANDICAP MarketType = "A" // MT_ASIAN_HANDICAP is an Asian Handicap market. MT_LINE_MARKET MarketType = "L" // MT_LINE_MARKET is a line market. MT_ODDS_MARKET MarketType = "O" // MT_ODDS_MARKET is an odds market. MT_RANGE_MARKET MarketType = "R" // MT_RANGE_MARKET is a range market. MT_NOT_APPLICABLE MarketType = "NOT_APPLICABLE" // MT_NOT_APPLICABLE indicates the market does not have an applicable marketType. )
type MarketVersion ¶
type MarketVersion struct {
Version int64 `json:"version,omitempty"` // Version is a non-monotonically increasing number indicating market changes
}
MarketVersion is the market version.
type Match ¶
type Match struct {
BetID string `json:"betId,omitempty"` // BetID is only present if no rollup
MatchID string `json:"matchId,omitempty"` // MatchID is only present if no rollup
Side Side `json:"side"` // Side indicates if the bet is a Back or a LAY
Price float64 `json:"price"` // Price is either actual match price or avg match price depending on rollup. This value is not meaningful for activity on LINE markets and is not guaranteed to be returned or maintained for these markets.
Size float64 `json:"size"` // Size is size matched at in this fragment, or at this price or avg price depending on rollup
MatchDate time.Time `json:"matchDate,omitempty"` // MatchDate is only present if no rollup
}
Match is an individual bet Match, or rollup by price or avg price. Rollup depends on the requested MatchProjection.
type MatchProjection ¶
type MatchProjection string
MatchProjection specifies the representation of matches if you ask for orders.
const ( MP_NO_ROLLUP MatchProjection = "NO_ROLLUP" // No rollup, return raw fragments. MP_ROLLED_UP MatchProjection = "ROLLED_UP_BY_PRICE" // Rollup matched amounts by distinct matched prices per side. MP_ROLLED_UP_BY_AVG_PRICE MatchProjection = "ROLLED_UP_BY_AVG_PRICE" // Rollup matched amounts by average matched price per side. )
type OffersOverrides ¶
type OffersOverrides struct {
BestPricesDepth int `json:"bestPricesDepth,omitempty"` // BestPricesDepth is the maximum number of prices to return on each side for each runner. If unspecified defaults to 3. The maximum returned price depth returned is 10.
RollupModel RollupModel `json:"rollupModel,omitempty"` // RollupModel is the model to use when rolling up available sizes. If unspecified defaults to STAKE rollup model with rollupLimit of minimum stake in the specified currency.
RollupLimit int `json:"rollupLimit,omitempty"` // RollupLimit is the volume limit to use when rolling up returned sizes. The exact definition of the limit depends on the rollupModel. If no limit is provided it will use minimum stake as default the value. Ignored if no rollup model is specified.
RollupLiability float64 `json:"rollupLiability,omitempty"` // RollupLiability is only applicable when rollupModel is MANAGED_LIABILITY. The rollup model switches from being stake-based to liability-based at the smallest lay price which is >= rollupLiabilityThreshold.service level default (TBD). Not supported as yet.
RollupLiabilityFactor int `json:"rollupLiabilityFactor,omitempty"` // RollupLiabilityFactor is only applicable when rollupModel is MANAGED_LIABILITY. (rollupLiabilityFactor * rollupLimit) is the minimum liability the user is deemed to be comfortable with. After the rollupLiabilityThreshold price subsequent volumes will be rolled up to minimum value such that the liability >= the minimum liability.service level default (5). Not supported as yet.
}
OffersOverrides are options to alter the default representation of best offer prices.
type Order ¶
type Order struct {
BetID string `json:"betId"` // BetID is the bet id.
OrderType OrderType `json:"orderType"` // OrderType is BSP Order type.
Status OrderStatus `json:"status"` // Status is either EXECUTABLE (an unmatched amount remains) or EXECUTION_COMPLETE (no unmatched amount remains).
PersistenceType PersistenceType `json:"persistenceType"` // PersistenceType is what to do with the order at turn-in-play
Side Side `json:"side"` // Side indicates if the bet is a Back or a LAY. For LINE markets customers either Buy a line (LAY bet, winning if outcome is greater than the taken line (price)) or Sell a line (BACK bet, winning if outcome is less than the taken line (price))
Price float64 `json:"price"` // Price is the price of the bet. Please note: LINE markets operate at even-money odds of 2.0. However, price for these markets refers to the line positions available as defined by the markets min-max range and interval steps
Size float64 `json:"size"` // Size is the size of the bet.
BspLiability float64 `json:"bspLiability"` // BspLiability is not to be confused with size. This is the liability of a given BSP bet.
PlacedDate time.Time `json:"placedDate"` // PlacedDate is the date, to the second, the bet was placed.
AvgPriceMatched float64 `json:"avgPriceMatched,omitempty"` // AvgPriceMatched is the average price matched at. Voided match fragments are removed from this average calculation. For MARKET_ON_CLOSE BSP bets this reports the matched SP price following the SP reconciliation process. This value is not meaningful for activity on LINE markets and is not guaranteed to be returned or maintained for these markets.
SizeMatched float64 `json:"sizeMatched,omitempty"` // SizeMatched is the current amount of this bet that was matched.
SizeRemaining float64 `json:"sizeRemaining,omitempty"` // SizeRemaining is the current amount of this bet that is unmatched.
SizeLapsed float64 `json:"sizeLapsed,omitempty"` // SizeLapsed is the current amount of this bet that was lapsed.
SizeCancelled float64 `json:"sizeCancelled,omitempty"` // SizeCancelled is the current amount of this bet that was cancelled.
SizeVoided float64 `json:"sizeVoided,omitempty"` // SizeVoided is the current amount of this bet that was voided.
CustomerOrderRef string `json:"customerOrderRef,omitempty"` // CustomerOrderRef is the customer order reference sent for this bet
CustomerStrategyRef string `json:"customerStrategyRef,omitempty"` // CustomerStrategyRef is the customer strategy reference sent for this bet
}
Order is an order in the market.
type OrderAccountChange ¶
type OrderAccountChange struct {
MarketID string `json:"id"` // Market Id - the id of the market the order is on.
Closed bool `json:"closed"` // True if the market is closed.
FullImage bool `json:"fullImage"` // True if this is a full image replacement.
OrderChanges []OrderChange `json:"orc"` // Order Changes - a list of changes to orders on a selection.
}
OrderAccountChange contains order changes for a market.
type OrderBy ¶
type OrderBy string
OrderBy specifies how the results will be ordered. If no value is passed in, it defaults to BY_BET. Also acts as a filter such that only orders with a valid value in the field being ordered by will be returned (i.e. BY_VOID_TIME returns only voided orders, BY_SETTLED_TIME (applies to partially settled markets) returns only settled orders and BY_MATCH_TIME returns only orders with a matched date (voided, settled, matched orders)). Note that specifying an orderBy parameter defines the context of the date filter applied by the dateRange parameter (placed, matched, voided or settled date).
const ( OB_BY_BET OrderBy = "BY_BET" // OB_BY_BET is deprecated; use BY_PLACE_TIME instead. Order by placed time, then bet id. OB_BY_MARKET OrderBy = "BY_MARKET" // OB_BY_MARKET orders by market id, then placed time, then bet id. OB_BY_MATCH_TIME OrderBy = "BY_MATCH_TIME" // OB_BY_MATCH_TIME orders by time of last matched fragment (if any), then placed time, then bet id. Filters out orders which have no matched date. OB_BY_PLACE_TIME OrderBy = "BY_PLACE_TIME" // OB_BY_PLACE_TIME orders by placed time, then bet id. This is an alias of to be deprecated BY_BET. OB_BY_SETTLED_TIME OrderBy = "BY_SETTLED_TIME" // OB_BY_SETTLED_TIME orders by time of last settled fragment (if any due to partial market settlement), then by last match time, then placed time, then bet id. Filters out orders which have not been settled. OB_BY_VOID_TIME OrderBy = "BY_VOID_TIME" // OB_BY_VOID_TIME orders by time of last voided fragment (if any), then by last match time, then placed time, then bet id. Filters out orders which have not been voided. )
type OrderChange ¶
type OrderChange struct {
FullImage bool `json:"fullImage"` // Replace existing data at runner level with the data supplied (null if delta).
SelectionID int64 `json:"id"` // Selection Id - the id of the runner (selection).
Handicap float64 `json:"hc,omitempty"` // Handicap - the handicap of the runner (null if not applicable).
UnmatchedOrders []UnmatchedOrder `json:"uo"` // Unmatched Orders on this runner.
MatchedBacks [][]float64 `json:"mb"` // Matched Backs - matched amounts by distinct matched price on the Back side for this runner.
MatchedLays [][]float64 `json:"ml"` // Matched Lays - matched amounts by distinct matched price on the Lay side for this runner.
}
OrderChange contains order changes for a runner.
type OrderChangeMessage ¶
type OrderChangeMessage struct {
ID int `json:"id"` // Client generated unique id to link request with response (like json rpc).
Op string `json:"op"` // The operation type.
ChangeType ChangeType `json:"ct,omitempty"` // Change Type - set to indicate the type of change - if null this is a delta.
SegmentType SegmentType `json:"segmentType,omitempty"` // Segment Type - if the change is split into multiple segments, this denotes the beginning and end of a change.
ConflateMs int `json:"conflateMs"` // Conflate Milliseconds - the conflation rate (may differ from that requested if subscription is delayed).
Status string `json:"status"` // Stream status: set to null if the exchange stream data is up to date and 503 if the downstream services are experiencing latencies.
HeartbeatMs int `json:"heartbeatMs"` // Heartbeat Milliseconds - the heartbeat rate (may differ from requested: bounds are 500 to 30000).
PublishTime int64 `json:"pt"` // Publish Time (in millis since epoch) that the changes were generated.
InitialClk string `json:"initialClk"` // Token value (non-null) should be stored and passed in an OrderSubscriptionMessage to resume subscription (in case of disconnect).
Clk string `json:"clk"` // Token value (non-null) should be stored and passed in an OrderSubscriptionMessage to resume subscription (in case of disconnect).
OrderAccountChange []OrderAccountChange `json:"oc"` // OrderMarketChanges - the modifications to account's orders (will be null on a heartbeat).
}
OrderChangeMessage contains order changes from the Exchange Stream API.
type OrderFilter ¶
type OrderFilter struct {
AccountIDs []int64 `json:"accountIds,omitempty"` // Internal use only & should not be set on your filter (your subscription is already locked to your account).
IncludeOverallPosition bool `json:"includeOverallPosition,omitempty"` // Returns overall / net position (See: OrderChange.mb / OrderChange.ml). Default=true.
CustomerStrategyRefs []string `json:"customerStrategyRefs,omitempty"` // Restricts to specified customerStrategyRefs; this will filter orders and StrategyMatchChanges accordingly (Note: overall position is not filtered).
PartitionMatchedByStrategyRef bool `json:"partitionMatchedByStrategyRef,omitempty"` // Returns strategy positions - these are sent in delta format as per overall position. Default=false.
}
OrderFilter restricts which orders are included in an order subscription.
type OrderProjection ¶
type OrderProjection string
OrderProjection is the orders you want to receive in the response.
const ( OP_ALL OrderProjection = "ALL" // EXECUTABLE and EXECUTION_COMPLETE orders. OP_EXECUTABLE OrderProjection = "EXECUTABLE" // An order that has a remaining unmatched portion. This is either a fully unmatched or partially matched bet (order). OP_EXECUTION_COMPLETE OrderProjection = "EXECUTION_COMPLETE" // An order that does not have any remaining unmatched portion. This is a fully matched bet (order). )
type OrderStatus ¶
type OrderStatus string
OrderStatus is the status of the order.
const ( OS_PENDING OrderStatus = "PENDING" // An asynchronous order is yet to be processed. Once the bet has been processed by the exchange (including waiting for any in-play delay), the result will be reported and available on the Exchange Stream API and API NG. Not a valid search criteria on MarketFilter. OS_EXECUTION_COMPLETE OrderStatus = "EXECUTION_COMPLETE" // An order that does not have any remaining unmatched portion. OS_EXECUTABLE OrderStatus = "EXECUTABLE" // An order that has a remaining unmatched portion. OS_EXPIRED OrderStatus = "EXPIRED" // The order is no longer available for execution due to its time in force constraint. In the case of FILL_OR_KILL orders, this means the order has been killed because it could not be filled to your specifications. Not a valid search criteria on MarketFilter. )
type OrderSubscriptionMessage ¶
type OrderSubscriptionMessage struct {
ID int `json:"id"` // Client generated unique id to link request with response (like json rpc).
Op string `json:"op"` // The operation type.
SegmentationEnabled bool `json:"segmentationEnabled"` // Segmentation Enabled - allow the server to send large sets of data in segments, instead of a single block.
ConflateMs int `json:"conflateMs"` // Conflate Milliseconds - the conflation rate (looped back on initial image after validation: bounds are 0 to 120000).
HeartbeatMs int `json:"heartbeatMs"` // Heartbeat Milliseconds - the heartbeat rate (looped back on initial image after validation: bounds are 500 to 5000).
InitialClk string `json:"initialClk,omitempty"` // Token value (received in initial OrderChangeMessage) that should be passed to resume a subscription.
Clk string `json:"clk,omitempty"` // Token value delta (received in OrderChangeMessage) that should be passed to resume a subscription.
OrderFilter OrderFilter `json:"orderFilter,omitempty"` // Filter for order subscription.
}
OrderSubscriptionMessage subscribes to order changes on the Exchange Stream API.
type PersistenceType ¶
type PersistenceType string
PersistenceType is what to do with the order at turn-in-play.
const ( PT_LAPSE PersistenceType = "LAPSE" // Lapse (cancel) the order automatically when the market is turned in play if the bet is unmatched. PT_PERSIST PersistenceType = "PERSIST" // Persist the unmatched order to in-play. The bet will be placed automatically into the in-play market at the start of the event. Once in play, the bet won't be cancelled by Betfair if a material event takes place and will be available until matched or cancelled by the user. PT_MARKET_ON_CLOSE PersistenceType = "MARKET_ON_CLOSE" // Put the order into the auction (SP) at turn-in-play. )
type PlaceInstruction ¶
type PlaceInstruction struct {
OrderType OrderType `json:"orderType"` // OrderType is the type of order.
SelectionID int64 `json:"selectionId"` // SelectionID is the selection id.
Handicap float64 `json:"handicap,omitempty"` // Handicap is the handicap associated with the runner in case of Asian handicap market.
Side Side `json:"side"` // Side is the side of the bet.
LimitOrder LimitOrder `json:"limitOrder,omitempty"` // LimitOrder is the details of a limit order.
LimitOnCloseOrder LimitOnCloseOrder `json:"limitOnCloseOrder,omitempty"` // LimitOnCloseOrder is the details of a limit on close order.
MarketOnCloseOrder MarketOnCloseOrder `json:"marketOnCloseOrder,omitempty"` // MarketOnCloseOrder is the details of a market on close order.
CustomerOrderRef string `json:"customerOrderRef,omitempty"` // CustomerOrderRef is an optional reference customers can use to specify which order has sent the order.
}
PlaceInstruction is an instruction to place a bet.
type PlaceOrdersInstructionReport ¶
type PlaceOrdersInstructionReport struct {
Status InstructionReportStatus `json:"status"` // Status is whether the command succeeded or failed
ErrorCode InstructionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is cause of failure, or null if the command succeeds
OrderStatus OrderStatus `json:"orderStatus,omitempty"` // OrderStatus is the status of the order, if the instruction succeeded. If the instruction is unsuccessful, no value is provided. Please note: by default, this field is not returned for MARKET_ON_CLOSE and LIMIT_ON_CLOSE orders.
Instruction PlaceInstruction `json:"instruction"` // Instruction is the instruction that was requested
BetID string `json:"betId,omitempty"` // BetID is the bet ID of the new bet. Will be null on failure or if the order was placed asynchronously.
PlacedDate time.Time `json:"placedDate,omitempty"` // PlacedDate will be null if the order was placed asynchronously
AveragePriceMatched float64 `json:"averagePriceMatched,omitempty"` // AveragePriceMatched will be null if the order was placed asynchronously. This value is not meaningful for activity on LINE markets and is not guaranteed to be returned or maintained for these markets.
SizeMatched float64 `json:"sizeMatched,omitempty"` // SizeMatched will be null if the order was placed asynchronously
}
PlaceOrdersInstructionReport is the response to a PlaceInstruction.
type PlaceOrdersParams ¶
type PlaceOrdersParams struct {
MarketID string `json:"marketId"` // MarketID is the market id these orders are to be placed on.
Instructions []PlaceInstruction `json:"instructions"` // Instructions are the place instructions. The limit of place instructions per request is 200 for the Global Exchange and 50 for the Italian Exchange.
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is an optional parameter allowing the client to pass a unique string (up to 32 chars) that is used to de-dupe mistaken re-submissions.
MarketVersion MarketVersion `json:"marketVersion,omitempty"` // MarketVersion is an optional parameter allowing the client to specify which version of the market the orders should be placed on.
CustomerStrategyRef string `json:"customerStrategyRef,omitempty"` // CustomerStrategyRef is an optional reference customers can use to specify which strategy has sent the order. The string is limited to 15 characters.
Async bool `json:"async,omitempty"` // Async is an optional flag which specifies if the orders should be placed asynchronously.
}
PlaceOrdersParams are the request parameters for placeOrders.
type PlaceOrdersReport ¶
type PlaceOrdersReport struct {
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is the customer reference passed in the request.
Status ExecutionReportStatus `json:"status"` // Status is the status of the execution report.
ErrorCode ExecutionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the operation failed.
MarketID string `json:"marketId,omitempty"` // MarketID is the market id these orders were placed on.
InstructionReports []PlaceOrdersInstructionReport `json:"instructionReports,omitempty"` // InstructionReports is the list of instruction reports.
}
PlaceOrdersReport is the response from placeOrders (PlaceExecutionReport).
type PriceData ¶
type PriceData string
PriceData is the basic price data you want to receive in the response.
const ( PD_SP_AVAILABLE PriceData = "SP_AVAILABLE" // Amount available for the BSP auction. PD_SP_TRADED PriceData = "SP_TRADED" // Amount traded in the BSP auction. PD_EX_BEST_OFFERS PriceData = "EX_BEST_OFFERS" // Only the best prices available for each runner, to requested price depth. PD_EX_ALL_OFFERS PriceData = "EX_ALL_OFFERS" // EX_ALL_OFFERS trumps EX_BEST_OFFERS if both settings are present. PD_EX_TRADED PriceData = "EX_TRADED" // Amount traded on the exchange. )
type PriceLadderDefinition ¶
type PriceLadderDefinition struct {
Type string `json:"type"` // Price ladder type (CLASSIC, FINEST, LINE_RANGE).
}
PriceLadderDefinition defines the price ladder type for a market.
type PriceLadderDescription ¶
type PriceLadderDescription struct {
Type PriceLadderType `json:"type,omitempty"` // Type is the type of price ladder.
}
PriceLadderDescription describes the price ladder for a market.
type PriceLadderType ¶
type PriceLadderType string
PriceLadderType is the type of price ladder.
const ( PLT_CLASSIC PriceLadderType = "CLASSIC" // PLT_CLASSIC is a price ladder increment traditionally used for Odds Markets. PLT_FINEST PriceLadderType = "FINEST" // PLT_FINEST is a price ladder with the finest available increment, traditionally used for Asian Handicap markets. PLT_LINE_RANGE PriceLadderType = "LINE_RANGE" // PLT_LINE_RANGE is a price ladder used for LINE markets. )
type PriceProjection ¶
type PriceProjection struct {
PriceData []PriceData `json:"priceData"` // PriceData is the basic price data you want to receive in the response.
ExBestOffersOverrides OffersOverrides `json:"exBestOffersOverrides,omitempty"` // ExBestOffersOverrides are options to alter the default representation of best offer prices Applicable to EX_BEST_OFFERS priceData selection
Virtualise bool `json:"virtualise,omitempty"` // Virtualise indicates if the returned prices should include virtual prices. Applicable to EX_BEST_OFFERS and EX_ALL_OFFERS priceData selections, default value is false. Please note: This must be set to 'true' replicate the display of prices on the Betfair Exchange website.
RolloverStakes bool `json:"rolloverStakes,omitempty"` // RolloverStakes indicates if the volume returned at each price point should be the absolute value or a cumulative sum of volumes available at the price and all better prices. If unspecified defaults to false. Applicable to EX_BEST_OFFERS and EX_ALL_OFFERS price projections. Not supported as yet.
}
PriceProjection is the selection criteria of the returning price data.
type PriceSize ¶
type PriceSize struct {
Price float64 `json:"price"` // Price is the price available
Size float64 `json:"size"` // Size is the stake available
}
PriceSize is a price and stake available at that price.
type RaceStatus ¶
type RaceStatus string
RaceStatus is the current status of the race.
const ( RS_DORMANT RaceStatus = "DORMANT" // RS_DORMANT indicates there is no data available for this race. RS_DELAYED RaceStatus = "DELAYED" // RS_DELAYED indicates the start of the race has been delayed. RS_PARADING RaceStatus = "PARADING" // RS_PARADING indicates the horses/greyhounds are in the parade ring. RS_GOINGDOWN RaceStatus = "GOINGDOWN" // RS_GOINGDOWN indicates the horses are going down to the starting post. RS_GOINGBEHIND RaceStatus = "GOINGBEHIND" // RS_GOINGBEHIND indicates the horses are going behind the stalls. RS_APPROACHING RaceStatus = "APPROACHING" // RS_APPROACHING indicates the greyhounds are approaching the traps. RS_GOINGINTRAPS RaceStatus = "GOINGINTRAPS" // RS_GOINGINTRAPS indicates the greyhounds are being put in the traps. RS_HARERUNNING RaceStatus = "HARERUNNING" // RS_HARERUNNING indicates the hare has been started. RS_ATTHEPOST RaceStatus = "ATTHEPOST" // RS_ATTHEPOST indicates the horses are at the post. RS_OFF RaceStatus = "OFF" // RS_OFF indicates the greyhound/horse race has started. RS_FINISHED RaceStatus = "FINISHED" // RS_FINISHED indicates the race has finished. RS_FINALRESULT RaceStatus = "FINALRESULT" // RS_FINALRESULT indicates the result has been declared (Greyhounds only). RS_FALSESTART RaceStatus = "FALSESTART" // RS_FALSESTART indicates there has been a false start. RS_PHOTOGRAPH RaceStatus = "PHOTOGRAPH" // RS_PHOTOGRAPH indicates the result of the race is subject to a photo finish. RS_RESULT RaceStatus = "RESULT" // RS_RESULT indicates the result of the race has been announced. RS_WEIGHEDIN RaceStatus = "WEIGHEDIN" // RS_WEIGHEDIN indicates the jockeys have weighed in. RS_RACEVOID RaceStatus = "RACEVOID" // RS_RACEVOID indicates the race has been declared void. RS_NORACE RaceStatus = "NORACE" // RS_NORACE indicates the race has been declared a no race. RS_MEETINGABANDONED RaceStatus = "MEETINGABANDONED" // RS_MEETINGABANDONED indicates the meeting has been abandoned. RS_RERUN RaceStatus = "RERUN" // RS_RERUN indicates the race will be rerun. RS_ABANDONED RaceStatus = "ABANDONED" // RS_ABANDONED indicates the race has been abandoned. )
type RaceType ¶
type RaceType string
RaceType restricts markets by race type in MarketFilter.raceTypes.
const ( RC_Harness RaceType = "Harness" // Harness racing (Aus/NZ harness racing events). RC_Flat RaceType = "Flat" // Flat racing (standard ANZ thoroughbred races). RC_Hurdle RaceType = "Hurdle" // Hurdle racing (Aus/NZ hurdle races). RC_Chase RaceType = "Chase" // Chase racing. RC_Bumper RaceType = "Bumper" // Bumper racing. RC_NHFlat RaceType = "NH Flat" // National Hunt flat racing. RC_Steeple RaceType = "Steeple" // Steeple chase racing (Aus/NZ steeple chase races). RC_NO_VALUE RaceType = "NO_VALUE" // Used when no valid race type has been mapped. )
type ReplaceInstruction ¶
type ReplaceInstruction struct {
BetID string `json:"betId"` // BetID is the bet ID to replace.
NewPrice float64 `json:"newPrice"` // NewPrice is the new price for the bet.
}
ReplaceInstruction is an instruction to replace a bet.
type ReplaceOrdersInstructionReport ¶
type ReplaceOrdersInstructionReport struct {
Status InstructionReportStatus `json:"status"` // Status is the status of the instruction report.
ErrorCode InstructionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the instruction failed.
CancelOrdersInstructionReport CancelOrdersInstructionReport `json:"cancelInstructionReport,omitempty"` // CancelOrdersInstructionReport is the cancel instruction report.
PlaceOrdersInstructionReport PlaceOrdersInstructionReport `json:"placeInstructionReport,omitempty"` // PlaceOrdersInstructionReport is the place instruction report.
}
ReplaceOrdersInstructionReport is the report for a replace instruction.
type ReplaceOrdersParams ¶
type ReplaceOrdersParams struct {
MarketID string `json:"marketId"` // MarketID is the market id these orders are to be placed on.
Instructions []ReplaceInstruction `json:"instructions"` // Instructions are the replace instructions. The limit of replace instructions per request is 60.
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is an optional parameter allowing the client to pass a unique string (up to 32 chars) that is used to de-dupe mistaken re-submissions.
MarketVersion MarketVersion `json:"marketVersion,omitempty"` // MarketVersion is an optional parameter allowing the client to specify which version of the market the orders should be placed on.
Async bool `json:"async,omitempty"` // Async is an optional flag which specifies if the orders should be replaced asynchronously.
}
ReplaceOrdersParams are the request parameters for replaceOrders.
type ReplaceOrdersReport ¶
type ReplaceOrdersReport struct {
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is the customer reference passed in the request.
Status ExecutionReportStatus `json:"status"` // Status is the status of the execution report.
ErrorCode ExecutionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the operation failed.
MarketID string `json:"marketId,omitempty"` // MarketID is the market id these orders were replaced on.
InstructionReports []ReplaceOrdersInstructionReport `json:"instructionReports,omitempty"` // InstructionReports is the list of instruction reports.
}
ReplaceOrdersReport is the response from replaceOrders (ReplaceExecutionReport).
type ResponseCode ¶
type ResponseCode string
ResponseCode is the response code for a race status update.
const ( RC_OK ResponseCode = "OK" // RC_OK indicates data returned successfully. RC_NO_NEW_UPDATES ResponseCode = "NO_NEW_UPDATES" // RC_NO_NEW_UPDATES indicates no updates since the passes UpdateSequence. RC_NO_LIVE_DATA_AVAILABLE ResponseCode = "NO_LIVE_DATA_AVAILABLE" // RC_NO_LIVE_DATA_AVAILABLE indicates event scores are no longer available or are not on the schedule. RC_SERVICE_UNAVAILABLE ResponseCode = "SERVICE_UNAVAILABLE" // RC_SERVICE_UNAVAILABLE indicates the data feed for the event type (tennis/football etc) is currently unavailable. RC_UNEXPECTED_ERROR ResponseCode = "UNEXPECTED_ERROR" // RC_UNEXPECTED_ERROR indicates an unexpected error occurred retrieving score data. RC_LIVE_DATA_TEMPORARILY_UNAVAILABLE ResponseCode = "LIVE_DATA_TEMPORARILY_UNAVAILABLE" // RC_LIVE_DATA_TEMPORARILY_UNAVAILABLE indicates live data is temporarily unavailable (stale). )
type ResumeResponse ¶
type ResumeResponse = SessionStatusResponse
ClientConfig configures the Betfair API client.
type Runner ¶
type Runner struct {
SelectionID int64 `json:"selectionId"` // SelectionID is the unique id of the runner (selection). Please note - the same selectionId and runnerName pairs are used accross all Betfair markets which contain them.
Handicap float64 `json:"handicap"` // Handicap is the handicap. Enter the specific handicap value (returned by RUNNER in listMaketBook) if the market is an Asian handicap market.
Status RunnerStatus `json:"status"` // Status is the status of the selection (i.e., ACTIVE, REMOVED, WINNER, PLACED, LOSER, HIDDEN) Runner status information is available for 90 days following market settlement.
AdjustmentFactor float64 `json:"adjustmentFactor,omitempty"` // AdjustmentFactor is the adjustment factor applied if the selection is removed
LastPriceTraded float64 `json:"lastPriceTraded,omitempty"` // LastPriceTraded is the price of the most recent bet matched on this selection
TotalMatched float64 `json:"totalMatched,omitempty"` // TotalMatched is the total amount matched on this runner
RemovalDate time.Time `json:"removalDate,omitempty"` // RemovalDate is if date and time the runner was removed
StartingPrices StartingPrices `json:"sp,omitempty"` // StartingPrices are the BSP related prices for this runner
ExchangePrices ExchangePrices `json:"ex,omitempty"` // ExchangePrices are the Exchange prices available for this runner
Orders []Order `json:"orders,omitempty"` // Orders is list of orders in the market
Matches []Match `json:"matches,omitempty"` // Matches is list of matches (i.e, orders that have been fully or partially executed)
MatchesByStrategy map[string][]Match `json:"matchesByStrategy,omitempty"` // MatchesByStrategy is list of matches for each strategy, ordered by matched data
}
Runner is the dynamic data about runners in a market.
type RunnerCatalog ¶
type RunnerCatalog struct {
SelectionID int64 `json:"selectionId"` // SelectionID is the unique id for the selection. The same selectionId and runnerName pairs are used accross all Betfair markets which contain them.
RunnerName string `json:"runnerName"` // RunnerName is the name of the runner.
Handicap float64 `json:"handicap"` // Handicap applies to markets with MarketBettingType ASIAN_HANDICAP_SINGLE_LINE & ASIAN_HANDICAP_DOUBLE_LINE only otherwise '0'.
SortPriority int `json:"sortPriority"` // SortPriority indicates the order in which the runners are displayed on the Betfair Exchange website.
Metadata map[string]string `json:"metadata,omitempty"` // Metadata is metadata associated with the runner. For a description of this data for Horse Racing, please see Runner Metadata Description.
}
RunnerCatalog holds information about the Runners (selections) in a market.
type RunnerChange ¶
type RunnerChange struct {
Conflated bool `json:"con"` // Conflated - have more than a single change been combined (or null if not conflated).
TradedVolume float64 `json:"tv,omitempty"` // The total amount matched. This value is truncated at 2dp.
LastTradedPrice float64 `json:"ltp,omitempty"` // Last Traded Price - The last traded price (or null if un-changed).
StartingPriceNear any `json:"spn,omitempty"` // Starting Price Near - The near starting price (or null if un-changed).
StartingPriceFar any `json:"spf,omitempty"` // Starting Price Far - The far starting price (or null if un-changed).
BestAvailableToBack [][]float64 `json:"batb"` // Best Available To Back - LevelPriceVol triple delta of price changes, keyed by level (0 vol is remove).
BestAvailableToLay [][]float64 `json:"batl"` // Best Available To Lay - LevelPriceVol triple delta of price changes, keyed by level (0 vol is remove).
BestDisplayAvailableToBack [][]float64 `json:"bdatb"` // Best Display Available To Back (includes virtual prices) - LevelPriceVol triple delta of price changes, keyed by level (0 vol is remove).
BestDisplayAvailableToLay [][]float64 `json:"bdatl"` // Best Display Available To Lay (includes virtual prices) - LevelPriceVol triple delta of price changes, keyed by level (0 vol is remove).
AvailableToBack [][]float64 `json:"atb"` // Available To Back - PriceVol tuple delta of price changes (0 vol is remove).
AvailableToLay [][]float64 `json:"atl"` // Available To Lay - PriceVol tuple delta of price changes (0 vol is remove).
StartingPriceBack [][]float64 `json:"spb"` // Starting Price Back - PriceVol tuple delta of price changes (0 vol is remove).
StartingPriceLay [][]float64 `json:"spl"` // Starting Price Lay - PriceVol tuple delta of price changes (0 vol is remove).
Traded [][]float64 `json:"trd"` // Traded - PriceVol tuple delta of price changes (0 vol is remove).
}
RunnerChange contains price and volume changes for a runner.
type RunnerProfitAndLoss ¶
type RunnerProfitAndLoss struct {
SelectionID int64 `json:"selectionId,omitempty"` // SelectionID is the selectionId.
IfWin float64 `json:"ifWin,omitempty"` // IfWin is the profit or loss incurred should the selection be a winner.
IfLose float64 `json:"ifLose,omitempty"` // IfLose is the profit or loss incurred should the selection be a loser.
IfPlace float64 `json:"ifPlace,omitempty"` // IfPlace is the profit or loss incurred should the selection be placed (EachWay markets only).
}
RunnerProfitAndLoss holds profit and loss for a runner.
type RunnerStatus ¶
type RunnerStatus string
RunnerStatus is the status of the selection (i.e., ACTIVE, REMOVED, WINNER, PLACED, LOSER, HIDDEN).
const ( RS_ACTIVE RunnerStatus = "ACTIVE" // RS_ACTIVE is ACTIVE. RS_WINNER RunnerStatus = "WINNER" // RS_WINNER is WINNER. RS_LOSER RunnerStatus = "LOSER" // RS_LOSER is LOSER. RS_PLACED RunnerStatus = "PLACED" // RS_PLACED indicates the runner was placed, applies to EACH_WAY marketTypes only. RS_REMOVED_VACANT RunnerStatus = "REMOVED_VACANT" // RS_REMOVED_VACANT applies to Greyhounds. Greyhound markets always return a fixed number of runners (traps). If a dog has been removed, the trap is shown as vacant. RS_REMOVED RunnerStatus = "REMOVED" // RS_REMOVED is REMOVED. RS_HIDDEN RunnerStatus = "HIDDEN" // RS_HIDDEN indicates the selection is hidden from the market. This occurs in Horse Racing markets were runners is hidden when it is doesn't hold an official entry following an entry stage. This could be because the horse was never entered or because they have been scratched from a race at a declaration stage. All matched customer bet prices are set to 1.0 even if there are later supplementary stages. Should it appear likely that a specific runner may actually be supplemented into the race this runner will be reinstated with all matched customer bets set back to the original prices. )
type SegmentType ¶
type SegmentType string
SegmentType identifies multi-part segmented Exchange Stream API messages.
const ( ST_SEG_START SegmentType = "SEG_START" // Start of a segmented message. ST_SEG SegmentType = "SEG" // Middle part of a segmented message. ST_SEG_END SegmentType = "SEG_END" // Last part of a segmented message. )
type SessionStatus ¶
type SessionStatus string
SessionStatus is returned by Keep Alive and Logout operations.
const ( SS_SUCCESS SessionStatus = "SUCCESS" // Keep Alive or Logout succeeded. SS_FAIL SessionStatus = "FAIL" // Keep Alive or Logout failed. )
type SessionStatusError ¶
type SessionStatusError string
SessionStatusError is returned when SessionStatus is FAIL.
const ( SS_ERR_INPUT_VALIDATION_ERROR SessionStatusError = "INPUT_VALIDATION_ERROR" // There is a problem with the data validity contained within the request. SS_ERR_INTERNAL_ERROR SessionStatusError = "INTERNAL_ERROR" // An internal error occurred processing the request. SS_ERR_NO_SESSION SessionStatusError = "NO_SESSION" // The session token header is missing, invalid, or the session has expired. )
type SessionStatusResponse ¶
type SessionStatusResponse struct {
Token string `json:"token"` // Session token.
Product string `json:"product"` // Application key passed as header.
Status SessionStatus `json:"status"` // SUCCESS or FAIL.
Error SessionStatusError `json:"error"` // Error code if status is FAIL.
}
SessionStatusResponse is returned by Keep Alive and Logout operations.
type Side ¶
type Side string
Side indicates if the bet is a Back or a LAY.
const ( SD_BACK Side = "BACK" // To back a team, horse or outcome is to bet on the selection to win. For LINE markets a Back bet refers to a SELL line. A SELL line will win if the outcome is LESS THAN the taken line (price). SD_LAY Side = "LAY" // To lay a team, horse, or outcome is to bet on the selection to lose. For LINE markets a Lay bet refers to a BUY line. A BUY line will win if the outcome is MORE THAN the taken line (price). )
type SortDir ¶
type SortDir string
SortDir specifies the direction the results will be sorted in. If no value is passed in, it defaults to EARLIEST_TO_LATEST.
const ( SD_EARLIEST_TO_LATEST SortDir = "EARLIEST_TO_LATEST" // SD_EARLIEST_TO_LATEST orders from earliest value to latest e.g. lowest betId is first in the results. SD_LATEST_TO_EARLIEST SortDir = "LATEST_TO_EARLIEST" // SD_LATEST_TO_EARLIEST orders from the latest value to the earliest e.g. highest betId is first in the results. )
type StartingPrices ¶
type StartingPrices struct {
NearPrice float64 `json:"nearPrice,omitempty"` // NearPrice is what the starting price would be if the market was reconciled now taking into account the SP bets as well as unmatched exchange bets on the same selection in the exchange. This data is cached and update every 60 seconds. Please note: Type Double may contain numbers, INF, -INF, and NaN.
FarPrice float64 `json:"farPrice,omitempty"` // FarPrice is what the starting price would be if the market was reconciled now taking into account only the currently place SP bets. The Far Price is not as complicated but not as accurate and only accounts for money on the exchange at SP. This data is cached and updated every 60 seconds. Please note: Type Double may contain numbers, INF, -INF, and NaN.
BackStakeTaken []PriceSize `json:"backStakeTaken,omitempty"` // BackStakeTaken is the total amount of back bets matched at the actual Betfair Starting Price. Pre-reconciliation, this field is zero for all prices except 1.01 (for Market on Close bets) and at the limit price for any Limit on Close bets.
LayLiabilityTaken []PriceSize `json:"layLiabilityTaken,omitempty"` // LayLiabilityTaken is the lay amount matched at the actual Betfair Starting Price. Pre-reconciliation, this field is zero for all prices except 1000 (for Market on Close bets) and at the limit price for any Limit on Close bets.
ActualSP float64 `json:"actualSP,omitempty"` // ActualSP is the final BSP price for this runner. Only available for a BSP market that has been reconciled. Please note: for REMOVED runners the actualSP will be returned as 'NaN. Value may be returned as 'Infinity' if no BSP can be calculated.
}
StartingPrices is information about the Betfair Starting Price. Only available in BSP markets.
type StatementLegacyData ¶
type StatementLegacyData struct {
AvgPrice float64 `json:"avgPrice"` // Average price matched.
BetSize float64 `json:"betSize"` // Bet size.
BetType string `json:"betType"` // Bet type.
BetCategoryType string `json:"betCategoryType"` // Bet category type.
CommissionRate string `json:"commissionRate"` // Commission rate.
EventID float64 `json:"eventId"` // Event id.
EventTypeID float64 `json:"eventTypeId"` // Event type id.
FullMarketName string `json:"fullMarketName"` // Full market name.
GrossBetAmount float64 `json:"grossBetAmount"` // Gross bet amount.
MarketName string `json:"marketName"` // Market name.
MarketType MarketType `json:"marketType"` // Market type.
PlacedDate time.Time `json:"placedDate"` // Date the bet was placed.
SelectionID int64 `json:"selectionId"` // Selection id.
SelectionName string `json:"selectionName"` // Selection name.
StartDate time.Time `json:"startDate"` // Event start date.
TransactionType string `json:"transactionType"` // Transaction type.
TransactionID float64 `json:"transactionId"` // Transaction id.
WinLose WinLose `json:"winLose"` // Settlement outcome label.
DeadHeatPriceDivisor float64 `json:"deadHeatPriceDivisor"` // Dead heat price divisor.
AvgPriceRaw float64 `json:"avgPriceRaw"` // Raw average price matched.
}
StatementLegacyData contains legacy exchange bet data for a statement item.
type StatusMessage ¶
type StatusMessage struct {
ID int `json:"id"` // Client generated unique id to link request with response (like json rpc).
StatusCode string `json:"statusCode"` // The status of the last request (SUCCESS or FAILURE).
ConnectionClosed bool `json:"connectionClosed"` // Is the connection now closed.
ErrorCode StatusMessageErrorCode `json:"errorCode"` // The type of error in case of a failure.
ErrorMessage string `json:"errorMessage"` // Additional message in case of a failure.
ConnectionsAvailable int `json:"connectionsAvailable"` // The number of connections available for this account at this moment in time. Present on responses to Authentication messages only.
}
StatusMessage is the response to a stream request.
type StatusMessageErrorCode ¶
type StatusMessageErrorCode string
StatusMessageErrorCode categorizes Exchange Stream API status message failures.
const ( SMEC_ERR_INVALID_INPUT StatusMessageErrorCode = "INVALID_INPUT" // Failure code returned when an invalid input is provided (could not deserialize the message). SMEC_ERR_TIMEOUT StatusMessageErrorCode = "TIMEOUT" // Failure code when a client times out (i.e. too slow sending data). SMEC_ERR_NO_APP_KEY StatusMessageErrorCode = "NO_APP_KEY" // Failure code returned when an application key is not found in the message. SMEC_ERR_INVALID_APP_KEY StatusMessageErrorCode = "INVALID_APP_KEY" // Failure code returned when an invalid application key is received. SMEC_ERR_NO_SESSION StatusMessageErrorCode = "NO_SESSION" // Failure code returned when a session token is not found in the message. SMEC_ERR_INVALID_SESSION_INFORMATION StatusMessageErrorCode = "INVALID_SESSION_INFORMATION" // Failure code returned when an invalid session token is received. SMEC_ERR_MAX_CONNECTION_LIMIT_EXCEEDED StatusMessageErrorCode = "MAX_CONNECTION_LIMIT_EXCEEDED" // Failure code returned when a client tries to create more connections than allowed to. SMEC_ERR_TOO_MANY_REQUESTS StatusMessageErrorCode = "TOO_MANY_REQUESTS" // Failure code is returned when a client makes too many requests within a short time period. SMEC_ERR_SUBSCRIPTION_LIMIT_EXCEEDED StatusMessageErrorCode = "SUBSCRIPTION_LIMIT_EXCEEDED" // Thrown when subscribed to more markets than allowed to - set to 200 markets by default. SMEC_ERR_INVALID_CLOCK StatusMessageErrorCode = "INVALID_CLOCK" // Failure code returned when an invalid clock is provided on re-subscription (check initialClk / clk supplied). SMEC_ERR_UNEXPECTED_ERROR StatusMessageErrorCode = "UNEXPECTED_ERROR" // Failure code returned when an internal error occurred on the server. Slow or unstable internet connectivity on the client side is one of the most common root causes of this issue. SMEC_ERR_CONNECTION_FAILED StatusMessageErrorCode = "CONNECTION_FAILED" // Failure code used when the client/server connection is terminated. )
type StreamMarketFilter ¶
type StreamMarketFilter struct {
MarketIDs []string `json:"marketIds,omitempty"` // Restrict to specified market ids.
BspMarket bool `json:"bspMarket,omitempty"` // Restrict to BSP markets.
BettingTypes []BettingType `json:"bettingTypes,omitempty"` // Restrict to specified betting types.
EventTypeIDs []string `json:"eventTypeIds,omitempty"` // Restrict to specified event type ids.
EventIDs []string `json:"eventIds,omitempty"` // Restrict to specified event ids.
TurnInPlayEnabled bool `json:"turnInPlayEnabled,omitempty"` // Restrict to markets that will turn in-play.
MarketTypes []string `json:"marketTypes,omitempty"` // Restrict to specified market types.
Venues []string `json:"venues,omitempty"` // Restrict to specified venues.
CountryCodes []string `json:"countryCodes,omitempty"` // Restrict to specified country codes.
RaceTypes []RaceType `json:"raceTypes,omitempty"` // Restrict to specified race types.
}
StreamMarketFilter restricts which markets are included in a market subscription.
type StreamingClient ¶
type StreamingClient struct {
Connection *tls.Conn
Config *StreamingClientConfig
}
func NewStreamingClient ¶
func NewStreamingClient(config *StreamingClientConfig) (client *StreamingClient)
func (*StreamingClient) Authenticate ¶
func (client *StreamingClient) Authenticate(config *tls.Config, applicationKey, sessionToken string) (err error)
func (*StreamingClient) Close ¶
func (client *StreamingClient) Close() error
func (*StreamingClient) Read ¶
func (client *StreamingClient) Read(response any) error
func (*StreamingClient) SubscribeToMarkets ¶
func (client *StreamingClient) SubscribeToMarkets(marketFilter StreamMarketFilter, marketDataFilter MarketDataFilter) (chan MarketChangeMessage, error)
SubscribeToMarkets sends a marketSubscription request to receive price changes for one or more markets. Subscription criteria are determined by marketFilter (horizontal filter) and marketDataFilter (vertical field filter).
func (*StreamingClient) SubscribeToOrders ¶
func (client *StreamingClient) SubscribeToOrders(orderFilter OrderFilter) (chan OrderChangeMessage, error)
SubscribeToOrders sends an orderSubscription request to receive order changes.
type StreamingClientConfig ¶
type StreamingClientConfig struct {
SegmentationEnabled bool // Segmentation Enabled - allow the server to send large sets of data in segments, instead of a single block.
ConflateMs int // Conflate Milliseconds - the conflation rate (looped back on initial image after validation: bounds are 0 to 120000).
HeartbeatMs int // Heartbeat Milliseconds - the heartbeat rate (looped back on initial image after validation: bounds are 500 to 5000).
InitialClk string // Token value (received in initial MarketChangeMessage) that should be passed to resume a subscription.
Clk string // Token value delta (received in MarketChangeMessage) that should be passed to resume a subscription.
PreProduction bool // Connect to the integration stream endpoint instead of production.
}
StreamingClientConfig configures Exchange Stream API connection and subscription defaults.
func (*StreamingClientConfig) GetStreamUrl ¶
func (config *StreamingClientConfig) GetStreamUrl() string
type TimeGranularity ¶
type TimeGranularity string
TimeGranularity is the granularity of time periods that correspond to markets selected by the market filter.
const ( TG_DAYS TimeGranularity = "DAYS" // TG_DAYS is DAYS. TG_HOURS TimeGranularity = "HOURS" // TG_HOURS is HOURS. TG_MINUTES TimeGranularity = "MINUTES" // TG_MINUTES is MINUTES. )
type TimeInForce ¶
type TimeInForce string
TimeInForce is the type of TimeInForce value to use. This value takes precedence over any PersistenceType value chosen.
const (
TIF_FILL_OR_KILL TimeInForce = "FILL_OR_KILL" // TIF_FILL_OR_KILL executes the transaction immediately and completely (filled to size or between minFillSize and size) or not at all (cancelled).
)
type TimeRange ¶
type TimeRange struct {
From string `json:"from,omitempty"` // From is from.
To string `json:"to,omitempty"` // To is to.
}
TimeRange restricts to markets with a market start time before or after the specified date.
type UnmatchedOrder ¶
type UnmatchedOrder struct {
BetID string `json:"id"` // Bet Id - the id of the order.
Price float64 `json:"p"` // Price - the original placed price of the order.
Size float64 `json:"s"` // Size - the original placed size of the order.
Bsp float64 `json:"bsp,omitempty"` // BSP Liability - the BSP liability of the order (null if the order is not a BSP order).
Side string `json:"side"` // Side - the side of the order.
Status string `json:"status"` // Status - the status of the order (E = EXECUTABLE, EC = EXECUTION_COMPLETE).
PersistenceType string `json:"pt"` // Persistence Type - whether the order will persist at in play or not.
OrderType string `json:"ot"` // Order Type - the type of the order (L = LIMIT, MOC = MARKET_ON_CLOSE, LOC = LIMIT_ON_CLOSE).
PlacedDate time.Time `json:"pd"` // Placed Date - the date the order was placed.
MatchedDate time.Time `json:"md,omitempty"` // Matched Date - the date the order was matched (null if the order is not matched).
CancelledDate time.Time `json:"cd,omitempty"` // Cancelled Date - the date the order was cancelled (null if the order is not cancelled).
LapsedDate time.Time `json:"ld,omitempty"` // Lapsed Date - the date the order was lapsed (null if the order is not lapsed).
LapseStatusReason string `json:"lsrc,omitempty"` // Lapse Status Reason Code - the reason for lapsed order (null if no portion of the order is lapsed).
AveragePriceMatched float64 `json:"avp,omitempty"` // Average Price Matched - the average price the order was matched at (null if the order is not matched).
SizeMatched float64 `json:"sm"` // Size Matched - the amount of the order that has been matched.
SizeRemaining float64 `json:"sr"` // Size Remaining - the amount of the order that is remaining unmatched.
SizeLapsed float64 `json:"sl"` // Size Lapsed - the amount of the order that has been lapsed.
SizeCancelled float64 `json:"sc"` // Size Cancelled - the amount of the order that has been cancelled.
SizeVoided float64 `json:"sv"` // Size Voided - the amount of the order that has been voided.
RegulatorAuthCode string `json:"rac,omitempty"` // Regulator Auth Code - the auth code returned by the regulator.
RegulatorCode string `json:"rc,omitempty"` // Regulator Code - the regulator of the order.
ReferenceOrder string `json:"rfo,omitempty"` // Reference Order - the customer supplied order reference.
ReferenceStrategy string `json:"rfs"` // Reference Strategy - the customer-supplied strategy reference used to group orders together (default is "").
}
UnmatchedOrder is an unmatched order on a runner from the Exchange Stream API.
type UpdateInstruction ¶
type UpdateInstruction struct {
BetID string `json:"betId"` // BetID is the bet ID to update.
NewPersistenceType PersistenceType `json:"newPersistenceType,omitempty"` // NewPersistenceType is the new persistence type for the bet.
}
UpdateInstruction is an instruction to update a bet.
type UpdateOrdersInstructionReport ¶
type UpdateOrdersInstructionReport struct {
Status InstructionReportStatus `json:"status"` // Status is the status of the instruction report.
ErrorCode InstructionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the instruction failed.
UpdateInstruction UpdateInstruction `json:"instruction"` // UpdateInstruction is the update instruction that was processed.
}
UpdateOrdersInstructionReport is the report for an update instruction.
type UpdateOrdersParams ¶
type UpdateOrdersParams struct {
MarketID string `json:"marketId"` // MarketID is the market id these orders are to be placed on.
Instructions []UpdateInstruction `json:"instructions"` // Instructions are the update instructions. The limit of update instructions per request is 60.
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is an optional parameter allowing the client to pass a unique string (up to 32 chars) that is used to de-dupe mistaken re-submissions.
}
UpdateOrdersParams are the request parameters for updateOrders.
type UpdateOrdersReport ¶
type UpdateOrdersReport struct {
CustomerRef string `json:"customerRef,omitempty"` // CustomerRef is the customer reference passed in the request.
Status ExecutionReportStatus `json:"status"` // Status is the status of the execution report.
ErrorCode ExecutionReportErrorCode `json:"errorCode,omitempty"` // ErrorCode is the error code if the operation failed.
MarketID string `json:"marketId,omitempty"` // MarketID is the market id these orders were updated on.
InstructionReports []UpdateOrdersInstructionReport `json:"instructionReports,omitempty"` // InstructionReports is the list of instruction reports.
}
UpdateOrdersReport is the response from updateOrders (UpdateExecutionReport).
type Wallet ¶
type Wallet string
Wallet is the wallet from which funds are taken or to which statement items belong.
const ( W_UK Wallet = "UK" // The Global Exchange wallet. W_AUSTRALIA Wallet = "AUSTRALIA" // Doc: https://betfair-developer-docs.atlassian.net/wiki/spaces/1smk3cen4v3lu3yomq5qye0ni/pages/2687907/Accounts+Enums#Wallet W_SPAIN Wallet = "SPAIN" // Doc: https://betfair-developer-docs.atlassian.net/wiki/spaces/1smk3cen4v3lu3yomq5qye0ni/pages/2687907/Accounts+Enums#Wallet W_ITALY Wallet = "ITALY" // Doc: https://betfair-developer-docs.atlassian.net/wiki/spaces/1smk3cen4v3lu3yomq5qye0ni/pages/2687907/Accounts+Enums#Wallet )
type WinLose ¶
type WinLose string
WinLose is the settlement outcome label for a statement item.
const ( WL_RESULT_ERR WinLose = "RESULT_ERR" // WL_RESULT_ERR indicates the record has been affected by a unsettlement. There is no impact on the balance for these records, this just a label to say that these are to be corrected. WL_RESULT_FIX WinLose = "RESULT_FIX" // WL_RESULT_FIX is a correction to the balance to reverse the impact of records shown as in error. If commission has been paid on the original settlement then there will be a second FIX record to reverse the commission. WL_RESULT_LOST WinLose = "RESULT_LOST" // WL_RESULT_LOST is a loss. WL_RESULT_NOT_APPLICABLE WinLose = "RESULT_NOT_APPLICABLE" // WL_RESULT_NOT_APPLICABLE indicates amounts relating to commission payments. WL_RESULT_WON WinLose = "RESULT_WON" // WL_RESULT_WON indicates a win. WL_COMMISSION_REVERSAL WinLose = "COMMISSION_REVERSAL" // WL_COMMISSION_REVERSAL indicates Betfair have restored the funds to your account that it previously received from you in commission. )
Source Files
¶
- cancelorders.go
- client.go
- common.go
- getaccountdetails.go
- getaccountfunds.go
- getaccountstatement.go
- getdeveloperappkeys.go
- heartbeat.go
- listclearedorders.go
- listcompetitions.go
- listcountries.go
- listcurrencyrates.go
- listcurrentorders.go
- listevents.go
- listeventtypes.go
- listmarketbook.go
- listmarketcatalogue.go
- listmarketprofitandloss.go
- listmarkettypes.go
- listracedetails.go
- listrunnerbook.go
- listtimeranges.go
- listvenues.go
- market.go
- order.go
- placeorders.go
- replaceorders.go
- streamingclient.go
- updateorders.go
- util.go