rpc

package
v0.0.0-...-b5b28c7 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any, TParams any](client *JsonRpcClient, api string, id int, method string, params TParams, response *T) error

func GetAccounts

func GetAccounts[T any, TParams any](client *JsonRpcClient, id int, method string, params TParams, response *T) error

func GetSports

func GetSports[T any, TParams any](client *JsonRpcClient, id int, method string, params TParams, response *T) error

Types

type AccountDetailsParams

type AccountDetailsParams struct {
	Wallet string `json:"wallet"`
}

RPC

type CompetitionResult

type CompetitionResult struct {
	Competition struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"competition"`
	MarketCount       int    `json:"marketCount"`
	CompetitionRegion string `json:"competitionRegion"`
}

Betting -> Results

type CurrentOrderResult

type CurrentOrderResult struct {
	Orders        []Order `json:"currentOrders"`
	MoreAvailable bool    `json:"moreAvailable"`
}

Betting -> Results

type CurrentOrdersParams

type CurrentOrdersParams struct {
}

RPC

type EventResult

type EventResult struct {
	Event struct {
		ID          string    `json:"id"`
		Name        string    `json:"name"`
		CountryCode string    `json:"countryCode"`
		Timezone    string    `json:"timezone"`
		OpenDate    time.Time `json:"openDate"`
	} `json:"event"`
	MarketCount int `json:"marketCount"`
}

Betting -> Results

type EventTypeResult

type EventTypeResult struct {
	EventType struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"eventType"`
	MarketCount int `json:"marketCount"`
}

Betting -> Results

type Ex

type Ex struct {
	AvailableToBack []PriceSize   `json:"availableToBack"`
	AvailableToLay  []PriceSize   `json:"availableToLay"`
	TradedVolume    []interface{} `json:"tradedVolume"`
}

Betting -> Results

type JsonError

type JsonError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		APINGException struct {
			RequestUUID  string `json:"requestUUID"`
			ErrorCode    string `json:"errorCode"`
			ErrorDetails string `json:"errorDetails"`
		} `json:"APINGException"`
		Exceptionname string `json:"exceptionname"`
	} `json:"data"`
}

RPC

type JsonRPC

type JsonRPC[T any] struct {
	JsonRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  T      `json:"params"`
	ID      int    `json:"id"`
}

RPC

type JsonRpcClient

type JsonRpcClient struct {
	Client         *http.Client
	ApplicationKey string
	SessionToken   string
}

func CreateClient

func CreateClient(sessionToken string, app_key string) *JsonRpcClient

func Login

func Login(tls *tls.Config, apiKey string, applicationName string, username string, password string) (jsonClient *JsonRpcClient, response *http.Response, err error)

func (*JsonRpcClient) Do

func (client *JsonRpcClient) Do(req *http.Request) (*http.Response, error)

func (*JsonRpcClient) GetAccountFunds

func (client *JsonRpcClient) GetAccountFunds(params AccountDetailsParams) (WalletResult, error)

func (*JsonRpcClient) ListCompetitions

func (client *JsonRpcClient) ListCompetitions(params MarketParams) ([]CompetitionResult, error)

func (*JsonRpcClient) ListCurrentOrders

func (client *JsonRpcClient) ListCurrentOrders(params CurrentOrdersParams) (CurrentOrderResult, error)

func (*JsonRpcClient) ListEventTypes

func (client *JsonRpcClient) ListEventTypes(params MarketParams) ([]EventTypeResult, error)

func (*JsonRpcClient) ListEvents

func (client *JsonRpcClient) ListEvents(params MarketParams) ([]EventResult, error)

func (*JsonRpcClient) ListMarketBook

func (client *JsonRpcClient) ListMarketBook(params MarketBookParams) ([]MarketBookResult, error)

func (*JsonRpcClient) ListMarketCatalogue

func (client *JsonRpcClient) ListMarketCatalogue(params MarketParams) ([]MarketCatalogueResult, error)

func (*JsonRpcClient) ListMarketTypes

func (client *JsonRpcClient) ListMarketTypes(params MarketParams) ([]MarketTypeResult, error)

func (*JsonRpcClient) Logout

func (client *JsonRpcClient) Logout() (response *http.Response, err error)

type JsonRpcResponse

type JsonRpcResponse struct {
	JsonRPC string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
	Error   JsonError   `json:"error,omitempty"`
	ID      int         `json:"id"`
}

RPC

type MarketBookParams

type MarketBookParams struct {
	MarketIds       []string        `json:"marketIds,omitempty"`
	PriceProjection PriceProjection `json:"priceProjection,omitempty"`
}

RPC

type MarketBookResult

type MarketBookResult struct {
	MarketID              string    `json:"marketId"`
	IsMarketDataDelayed   bool      `json:"isMarketDataDelayed"`
	Status                string    `json:"status"`
	BetDelay              int       `json:"betDelay"`
	BspReconciled         bool      `json:"bspReconciled"`
	Complete              bool      `json:"complete"`
	Inplay                bool      `json:"inplay"`
	NumberOfWinners       int       `json:"numberOfWinners"`
	NumberOfRunners       int       `json:"numberOfRunners"`
	NumberOfActiveRunners int       `json:"numberOfActiveRunners"`
	LastMatchTime         time.Time `json:"lastMatchTime"`
	TotalMatched          float64   `json:"totalMatched"`
	TotalAvailable        float64   `json:"totalAvailable"`
	CrossMatching         bool      `json:"crossMatching"`
	RunnersVoidable       bool      `json:"runnersVoidable"`
	Version               int64     `json:"version"`
	Runners               []Runner  `json:"runners"`
}

Betting -> Results

type MarketCatalogueResult

type MarketCatalogueResult struct {
	MarketID     string  `json:"marketId"`
	MarketName   string  `json:"marketName"`
	TotalMatched float64 `json:"totalMatched"`
}

Betting -> Results

type MarketFilter

type MarketFilter struct {
	TextQuery          string    `json:"textQuery,omitempty"`
	EventTypeIds       []string  `json:"eventTypeIds,omitempty"`
	EventIds           []string  `json:"eventIds,omitempty"`
	CompetitionIds     []string  `json:"competitionIds,omitempty"`
	MarketIds          []string  `json:"marketIds,omitempty"`
	Venues             []string  `json:"venues,omitempty"`
	BspOnly            bool      `json:"bspOnly,omitempty"`
	TurnInPlayEnabled  bool      `json:"turnInPlayEnabled,omitempty"`
	InPlayOnly         bool      `json:"inPlayOnly,omitempty"`
	MarketBettingTypes []string  `json:"marketBettingTypes,omitempty"`
	MarketTypeCodes    []string  `json:"marketTypeCodes,omitempty"`
	MarketCountries    []string  `json:"marketCountries"`
	MarketStartTime    TimeRange `json:"marketStartTime,omitempty"`
	WithOrders         []string  `json:"withOrders,omitempty"`
	RaceTypes          []string  `json:"raceTypes,omitempty"`
}

Filters

type MarketParams

type MarketParams struct {
	Filter     MarketFilter `json:"filter"`
	MaxResults string       `json:"maxResults"`
}

RPC

type MarketTypeResult

type MarketTypeResult struct {
	MarketType  string `json:"marketType"`
	MarketCount int    `json:"marketCount"`
}

Betting -> Results

type Order

type Order struct {
	BetID               string    `json:"betId"`
	MarketID            string    `json:"marketId"`
	SelectionID         int       `json:"selectionId"`
	Handicap            float64   `json:"handicap"`
	PriceSize           PriceSize `json:"priceSize"`
	BspLiability        float64   `json:"bspLiability"`
	Side                string    `json:"side"`
	Status              string    `json:"status"`
	PersistenceType     string    `json:"persistenceType"`
	OrderType           string    `json:"orderType"`
	PlacedDate          time.Time `json:"placedDate"`
	MatchedDate         time.Time `json:"matchedDate"`
	AveragePriceMatched float64   `json:"averagePriceMatched"`
	SizeMatched         float64   `json:"sizeMatched"`
	SizeRemaining       float64   `json:"sizeRemaining"`
	SizeLapsed          float64   `json:"sizeLapsed"`
	SizeCancelled       float64   `json:"sizeCancelled"`
	SizeVoided          float64   `json:"sizeVoided"`
	RegulatorCode       string    `json:"regulatorCode"`
}

Betting -> Results

type PriceProjection

type PriceProjection struct {
	PriceData []string `json:"priceData"`
}

Filters

type PriceSize

type PriceSize struct {
	Price float64 `json:"price"`
	Size  float64 `json:"size"`
}

Betting -> Results

type RpcAccountClient

type RpcAccountClient interface {
	GetAccountFunds() (WalletResult, error)
}

type RpcBettingClient

type RpcBettingClient interface {
	ListCompetitions(params MarketParams) ([]CompetitionResult, error)
	ListEventTypes(params MarketParams) ([]EventTypeResult, error)
	ListEvents(params MarketParams) ([]EventResult, error)
	ListMarketTypes(params MarketParams) ([]MarketTypeResult, error)
	ListMarketCatalogue(params MarketParams) ([]MarketCatalogueResult, error)
	ListMarketBook(params MarketBookParams) ([]MarketBookResult, error)
	ListCurrentOrders(params CurrentOrdersParams) (CurrentOrderResult, error)
}

type Runner

type Runner struct {
	SelectionID     int     `json:"selectionId"`
	Handicap        float64 `json:"handicap"`
	Status          string  `json:"status"`
	LastPriceTraded float64 `json:"lastPriceTraded"`
	TotalMatched    float64 `json:"totalMatched"`
	Ex              Ex      `json:"ex"`
}

Betting -> Results

type SessionLogoutResponse

type SessionLogoutResponse struct {
	Token   string `json:"token"`
	Product string `json:"product"`
	Status  string `json:"status"`
	Error   string `json:"error"`
}

type SessionResponse

type SessionResponse struct {
	SessionToken string `json:"sessionToken"`
	LoginStatus  string `json:"loginStatus"`
}

type TimeRange

type TimeRange struct {
	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

Filters

type WalletResult

type WalletResult struct {
	AvailableToBetBalance float64 `json:"availableToBetBalance"`
	Exposure              float64 `json:"exposure"`
	RetainedCommission    float64 `json:"retainedCommission"`
	ExposureLimit         float64 `json:"exposureLimit"`
	DiscountRate          float64 `json:"discountRate"`
	PointsBalance         int     `json:"pointsBalance"`
	Wallet                string  `json:"wallet"`
}

Accounts -> Results

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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