Class: Rubyists::Domeapi::Polymarket::Markets

Inherits:
Endpoint
  • Object
show all
Includes:
Listable
Defined in:
lib/domeapi/polymarket/markets.rb

Overview

Markets API endpoints

Defined Under Namespace

Classes: Filter

Instance Attribute Summary

Attributes inherited from Endpoint

#client

Instance Method Summary collapse

Methods included from Listable

included, #list

Methods inherited from Endpoint

#initialize

Constructor Details

This class inherits a constructor from Rubyists::Domeapi::Polymarket::Endpoint

Instance Method Details

#price(token_id:, at_time: nil) ⇒ Hash

Fetch current or historical price for a market

Parameters:

  • token_id (String)
  • at_time (Integer) (defaults to: nil) —

    optional timestamp

Returns:

  • (Hash) —

    market price data



33
34
35
36
37
# File 'lib/domeapi/polymarket/markets.rb', line 33

def price(token_id:, at_time: nil)
  params = { token_id: token_id }
  params[:at_time] = at_time if at_time
  client.get('markets/get_market_price', params: params)
end