Class: SportsOddsAPI::Resources::Markets

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_odds_api/resources/markets.rb,
sig/sports_odds_api/resources/markets.rbs

Overview

Get metadata on supported Markets

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Markets

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Markets.

Parameters:



82
83
84
# File 'lib/sports_odds_api/resources/markets.rb', line 82

def initialize(client:)
  @client = client
end

Instance Method Details

#get(bet_type_id: nil, bookmaker_id: nil, cursor: nil, is_main_market: nil, is_prop: nil, is_sub_period: nil, is_supported: nil, league_id: nil, limit: nil, odd_id: nil, period_id: nil, prop_type: nil, side_id: nil, sport_id: nil, stat_entity_id: nil, stat_id: nil, request_options: {}) ⇒ SportsOddsAPI::Internal::NextCursorPage<SportsOddsAPI::Models::Market>

Some parameter documentations has been truncated, see Models::MarketGetParams for more details.

Get a list of Markets

Parameters:

  • bet_type_id (String)

    A single betTypeID or comma-separated list of betTypeIDs to filter Markets by

  • bookmaker_id (String)

    A single bookmakerID or comma-separated list of bookmakerIDs to filter Markets b

  • cursor (String)

    The cursor for pagination. Use nextCursor from prior response.

  • is_main_market (Boolean)

    Filter to only include main markets (main period moneyline, spread, and over/und

  • is_prop (Boolean)

    Filter by whether it is any type of prop bet market

  • is_sub_period (Boolean)

    Filter by whether it tracks a sub/non-main period

  • is_supported (Boolean)

    Filter whether this market is fully supported by at least 1 bookmaker in at leas

  • league_id (String)

    A single leagueID or comma-separated list of leagueIDs to filter Markets by

  • limit (Float)

    The maximum number of Markets to return (default: 100, max: 10000)

  • odd_id (String)

    A single oddID or comma-separated list of oddIDs. Used to specify specific Marke

  • period_id (String)

    A single periodID or comma-separated list of periodIDs to filter Markets by

  • prop_type (String)

    Filter by prop type (game_prop, team_prop, player_prop, other_prop)

  • side_id (String)

    A single sideID or comma-separated list of sideIDs to filter Markets by

  • sport_id (String)

    A single sportID or comma-separated list of sportIDs to filter Markets by

  • stat_entity_id (String)

    A single statEntityID or comma-separated list of statEntityIDs to filter Markets

  • stat_id (String)

    A single statID or comma-separated list of statIDs to filter Markets by

  • request_options (SportsOddsAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/sports_odds_api/resources/markets.rb', line 51

def get(params = {})
  parsed, options = SportsOddsAPI::MarketGetParams.dump_request(params)
  query = SportsOddsAPI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "markets/",
    query: query.transform_keys(
      bet_type_id: "betTypeID",
      bookmaker_id: "bookmakerID",
      is_main_market: "isMainMarket",
      is_prop: "isProp",
      is_sub_period: "isSubPeriod",
      is_supported: "isSupported",
      league_id: "leagueID",
      odd_id: "oddID",
      period_id: "periodID",
      prop_type: "propType",
      side_id: "sideID",
      sport_id: "sportID",
      stat_entity_id: "statEntityID",
      stat_id: "statID"
    ),
    page: SportsOddsAPI::Internal::NextCursorPage,
    model: SportsOddsAPI::Market,
    options: options
  )
end