Struct BFClient

Source
pub struct BFClient { /* private fields */ }
Expand description

A thread-safe client with automatic login implementing all methods of the Betfair SportsAPING.

BFClient implements Sync and so can safely be wrapped in an Arc for multithreaded use with the same session token.

Implementations§

Source§

impl BFClient

Source

pub fn new(creds: BFCredentials, proxy_uri: Option<String>) -> Result<Self>

Source§

impl BFClient

Source

pub fn listEventTypes( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<EventTypeResult>>

Returns a list of Event Types (i.e. Sports) associated with the markets selected by the MarketFilter.

Source

pub fn listCompetitions( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<CompetitionResult>>

Returns a list of Competitions (i.e., World Cup 2013) associated with the markets selected by the MarketFilter. Currently only Football markets have an associated competition.

Source

pub fn listTimeRanges( &self, filter: MarketFilter, granularity: TimeGranularity, ) -> Result<Vec<TimeRangeResult>>

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.

Source

pub fn listEvents( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<EventResult>>

Returns a list of Events (i.e, Reading vs. Man United) associated with the markets selected by the MarketFilter.

Source

pub fn listMarketTypes( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<MarketTypeResult>>

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.

Source

pub fn listCountries( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<CountryCodeResult>>

Returns a list of Countries associated with the markets selected by the MarketFilter.

Source

pub fn listVenues( &self, filter: MarketFilter, locale: Option<String>, ) -> Result<Vec<VenueResult>>

Returns a list of Venues (i.e. Cheltenham, Ascot) associated with the markets selected by the MarketFilter. Currently, only Horse Racing markets are associated with a Venue.

Source

pub fn listMarketCatalogue( &self, filter: MarketFilter, marketProjection: Option<Vec<MarketProjection>>, sort: Option<MarketSort>, maxResults: i32, locale: Option<String>, ) -> Result<Vec<MarketCatalogue>>

Returns a list of information about 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.

Source

pub fn listMarketBook( &self, marketIds: Vec<MarketId>, priceProjection: Option<PriceProjection>, orderProjection: Option<OrderProjection>, matchProjection: Option<MatchProjection>, includeOverallPosition: Option<bool>, partitionMatchedByStrategyRef: Option<bool>, customerStrategyRefs: Option<Vec<String>>, currencyCode: Option<String>, locale: Option<String>, matchedSince: Option<DateTime<Utc>>, betIds: Option<Vec<BetId>>, ) -> Result<Vec<MarketBook>>

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.

Source

pub fn listRunnerBook( &self, marketId: MarketId, selectionId: SelectionId, handicap: Option<f64>, priceProjection: Option<PriceProjection>, orderProjection: Option<OrderProjection>, matchProjection: Option<MatchProjection>, includeOverallPosition: Option<bool>, partitionMatchedByStrategyRef: Option<bool>, customerStrategyRefs: Option<Vec<String>>, currencyCode: Option<String>, locale: Option<String>, matchedSince: Option<DateTime<Utc>>, betIds: Option<Vec<BetId>>, ) -> Result<Vec<MarketBook>>

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.

Source

pub fn listCurrentOrders( &self, betIds: Option<Vec<BetId>>, marketIds: Option<Vec<MarketId>>, orderProjection: Option<OrderProjection>, customerOrderRefs: Option<Vec<CustomerOrderRef>>, customerStrategyRefs: Option<Vec<CustomerStrategyRef>>, placedDateRange: Option<TimeRange>, dateRange: Option<TimeRange>, orderBy: Option<OrderBy>, sortDir: Option<SortDir>, fromRecord: Option<i32>, recordCount: Option<i32>, ) -> Result<CurrentOrderSummaryReport>

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.

Source

pub fn listClearedOrders( &self, betStatus: BetStatus, eventTypeIds: Option<Vec<EventTypeId>>, eventIds: Option<Vec<EventId>>, marketIds: Option<Vec<MarketId>>, runnerIds: Option<Vec<RunnerId>>, betIds: Option<Vec<BetId>>, customerOrderRefs: Option<Vec<CustomerOrderRef>>, customerStrategyRefs: Option<Vec<CustomerStrategyRef>>, side: Option<Side>, settledDateRange: Option<TimeRange>, groupBy: Option<GroupBy>, includeItemDescription: Option<bool>, locale: Option<String>, fromRecord: Option<i32>, recordCount: Option<i32>, ) -> Result<ClearedOrderSummaryReport>

Returns a List of bets based on the bet status, ordered by settled date

Source

pub fn placeOrders( &self, marketId: MarketId, instructions: Vec<PlaceInstruction>, customerRef: Option<String>, marketVersion: Option<MarketVersion>, customerStrategyRef: Option<String>, async: Option<bool>, ) -> Result<PlaceExecutionReport>

Place new orders into market. LIMIT orders below the minimum bet size are allowed if there is an unmatched bet at the same price in the market. This operation is atomic in that all orders will be placed or none will be placed.

Source

pub fn cancelOrders( &self, marketId: Option<MarketId>, instructions: Option<Vec<CancelInstruction>>, customerRef: Option<String>, ) -> Result<CancelExecutionReport>

Cancel all bets OR cancel all bets on a market OR fully or partially cancel particular orders on a market. Only LIMIT orders an be cancelled or partially cancelled once placed.

Source

pub fn replaceOrders( &self, marketId: MarketId, instructions: Vec<ReplaceInstruction>, customerRef: Option<String>, marketVersion: Option<MarketVersion>, async: Option<bool>, ) -> Result<ReplaceExecutionReport>

This operation 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. See ReplaceInstruction.

Source

pub fn updateOrders( &self, marketId: MarketId, instructions: Vec<UpdateInstruction>, customerRef: Option<String>, ) -> Result<UpdateExecutionReport>

Update non-exposure changing fields

Source

pub fn listMarketProfitAndLoss( &self, marketIds: Vec<MarketId>, includeSettledBets: Option<bool>, includeBspBets: Option<bool>, netOfCommission: Option<bool>, ) -> Result<Vec<MarketProfitAndLoss>>

Retrieve profit and loss for a given list of markets. The values are calculated using matched bets and optionally settled bets. Only odds markets are implemented, markets of other types are silently ignored.

Source

pub fn setDefaultExposureLimitForMarketGroups( &self, marketGroupType: MarketGroupType, limit: ExposureLimit, ) -> Result<String>

Create/update default exposure limit for market groups of given type. New value and breach action will be immediately applied to existing instances of this type (unless overridden using setExposureLimitForMarketGroup). If default values are overridden for market groups (using setExposureLimitForMarketGroup), overrides will NOT be touched. In order to clear this limit “removeDefaultExposureLimitForMarketGroups” operation should be used. It’s not allowed to set default limit to an empty limit (see type ExposureLimit).

Source

pub fn setExposureLimitForMarketGroup( &self, marketGroup: MarketGroup, limit: ExposureLimit, ) -> Result<String>

Create/update exposure limit for a market group. New limit will be applied immediately (even if a default limit exists for this type). The limit will be deleted upon account action (see deleteMarketGroupExposureLimit) or when no active markets remain under market group. It is possible to “invalidate” default limit for a specific group by using a “empty” limit (see type ExposureLimit). Upon successful execution of the request, the effective limit for this group will be the one set by this request (Properties will NOT be inherited from default limit).

Source

pub fn removeDefaultExposureLimitForMarketGroups( &self, marketGroupType: MarketGroupType, ) -> Result<String>

Remove default exposure limit for a market group type. This operation will NOT remove/update any market group limits.

Source

pub fn removeExposureLimitForMarketGroup( &self, marketGroup: MarketGroup, ) -> Result<String>

Delete exposure limit for a market group. If a default exposure limit exist for market type, it takes effect immediately.

Source

pub fn listExposureLimitsForMarketGroups( &self, marketGroupTypeFilter: Option<MarketGroupType>, marketGroupFilter: Option<Vec<MarketGroup>>, ) -> Result<Vec<ExposureLimitsForMarketGroups>>

Response to this request returns default group limit and group limits grouped by type. If marketGroupTypeFilter is not populated values for all types are returned. The response will always contain the default limit. It is possible to control which groups to return using marketGroupsFilter parameter. If marketGroupsFilter is not set all group limits are returned. If an emtpy list is passed only default limit(s) is returned. When marketGroupTypeFilter and marketGroupsFilter used together, all groups in marketGroupsFilter are required to be of same type (type used in marketGroupTypeFilter).

Source

pub fn unblockMarketGroup(&self, marketGroup: MarketGroup) -> Result<String>

Unblock a market group after it has been blocked due to the breach of a previously set exposure limit.

Source

pub fn getExposureReuseEnabledEvents(&self) -> Result<Vec<i64>>

Retrieves events from exposure reuse enabled events list. To edit this list use addExposureReuseEnabledEvents and removeExposureReuseEnabledEvents operations.

Source

pub fn addExposureReuseEnabledEvents( &self, eventIds: Vec<i64>, ) -> Result<String>

Enables events for exposure reuse by appending them to the current list of events already enabled.

Source

pub fn removeExposureReuseEnabledEvents( &self, eventIds: Vec<i64>, ) -> Result<String>

Removes events from exposure reuse enabled events list.

Trait Implementations§

Source§

impl Drop for BFClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Err = <U as TryFrom<T>>::Err

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,