async def list_current_orders( self, bet_ids: list = None, market_ids: list = None, order_projection: str = None, customer_order_refs: list = None, customer_strategy_refs: list = None, date_from: datetime.datetime = None, date_to: datetime.datetime = None, order_by: str = "BY_PLACE_TIME", sort_dir: str = None, from_record: int = None, record_count: int = None, include_item_description: bool = None, ) -> List[Dict]: params = parse_params(**locals()) current_orders = [] more_available = True index = from_record or 0 while more_available: params["fromRecord"] = index resp = await self.rpc_post( url=self.BETTING_URL, method="SportsAPING/v1.0/listCurrentOrders", params=params) order_chunk = resp["currentOrders"] current_orders.extend(order_chunk) more_available = resp["moreAvailable"] index += len(order_chunk) return current_orders
async def list_market_catalogue( self, filter_: dict, market_projection: List[MarketProjection] = None, sort: str = None, max_results: int = 1000, locale: str = None, ): """ Return specific data about markets. """ assert 0 < max_results <= 1000 params = parse_params(**locals()) if "marketProjection" in params: assert all([ isinstance(m, MarketProjection) for m in params["marketProjection"] ]) params["marketProjection"] = [ m.value for m in params["marketProjection"] ] if "sort" in params: assert isinstance(sort, MarketSort) resp = await self.rpc_post( url=self.BETTING_URL, method="SportsAPING/v1.0/listMarketCatalogue", params=params) return resp
async def cancel_orders( self, market_id: str = None, instructions: list = None, customer_ref: str = None, ): params = parse_params(**locals()) resp = await self.rpc_post(url=self.BETTING_URL, method="SportsAPING/v1.0/cancelOrders", params=params) return resp
async def replace_orders( self, market_id: str = None, instructions: list = None, customer_ref: str = None, market_version: Optional[dict] = None, ): params = parse_params(**locals()) resp = await self.rpc_post(url=self.BETTING_URL, method="SportsAPING/v1.0/replaceOrders", params=params) return resp
async def list_cleared_orders( self, bet_status: str = "SETTLED", event_type_ids: list = None, event_ids: list = None, market_ids: list = None, runner_ids: list = None, bet_ids: list = None, customer_order_refs: list = None, customer_strategy_refs: list = None, side: str = None, settled_date_from: datetime.datetime = None, settled_date_to: datetime.datetime = None, group_by: str = None, include_item_description: bool = None, locale: str = None, from_record: int = None, record_count: int = None, ) -> List[Dict]: params = parse_params(**locals()) cleared_orders = [] more_available = True index = from_record or 0 while more_available: params["fromRecord"] = index if settled_date_from or settled_date_to: params["settledDateRange"] = { "from": settled_date_from, "to": settled_date_to } resp = await self.rpc_post( url=self.BETTING_URL, method="SportsAPING/v1.0/listClearedOrders", params=params) order_chunk = resp["clearedOrders"] cleared_orders.extend(order_chunk) more_available = resp["moreAvailable"] index += len(order_chunk) return cleared_orders
async def get_account_funds(self, wallet: Optional[str] = None): params = parse_params(**locals()) resp = await self.rpc_post(url=self.ACCOUNT_URL, method="AccountAPING/v1.0/getAccountFunds", params=params) return resp