Announcement

Collapse
No announcement yet.

Pulling BSP Projection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pulling BSP Projection

    I'm trying to pull the BSP projected price for each runner in a race. I've tried a bunch of different calls through the API but it always returns 'None'. I'm checked that the markets i'm pulling the data for have BSP markets. Here is the current python script I'm testing with. Any advice would be appreciated.

    Def process_runner_books(runner_books): bsp = [runner_book.sp.near_price if runner_book.sp.near_price else np.NaN for runner_book in runner_books] selection_ids = [runner_book.selection_id for runner_book in runner_books] df = pd.DataFrame({ 'Selection ID': selection_ids, 'BSP': bsp, }) return df # Create a price filter. Get all traded and offer data price_filter = betfairlightweight.filters.price_projection( price_data=['EX_BEST_OFFERS','SP_AVAILABLE'] ) # Request market books market_books = trading.betting.list_market_book( market_ids=['1.169036108'], price_projection=price_filter ) # Grab the first market book from the returned list as we only requested one market market_book = market_books[0] runners_df = process_runner_books(market_book.runners) print(runners_df)

  • #2
    Highly recommend this article, I rate it 5 stars for your post. It actually territorial io​ what I'm thinking too. I hope that you will right more things like this topic because I love it. Thank you!​

    Comment

    Working...
    X