Ruby client for the Domeapi API.
Install the gem and add to the application’s Gemfile by executing:
bundle add domeapiIf bundler is not being used to manage dependencies, install the gem by executing:
gem install domeapiConfigure the gem with your API key. You can set it via the DOMEAPI_API_KEY environment variable or configure it explicitly:
Rubyists::Domeapi.configure do |config|
config.api_key = 'your_api_key'
endAccess Polymarket endpoints via the polymarket namespace.
List markets with optional filtering:
# List markets with default filter
markets = client.polymarket.markets.list
# List markets with custom filter
markets = client.polymarket.markets.list(limit: 10, offset: 0, status: 'open')Get market price:
price = client.polymarket.markets.price(token_id: 'token_id')Get candlesticks:
candlesticks = client.polymarket.candlesticks.list(
condition_id: 'condition_id',
start_time: 1625097600,
end_time: 1625184000,
interval: 60
)Get trade history:
trades = client.polymarket.trade_history.list(
market_slug: 'market_slug',
limit: 10
)Get orderbook history:
snapshots = client.polymarket.orderbook.list(
token_id: 'token_id',
start_time: 1625097600000,
end_time: 1625184000000
)Get activity:
activity = client.polymarket.activity.list(
user: '0x...',
limit: 10
)Get market price history:
prices = client.polymarket.market_price.list(
token_id: 'token_id',
at_time: 1625097600
)Get wallet profit and loss:
pnl = client.polymarket.wallet_profit_and_loss.list(
wallet_address: '0x...',
granularity: 'day'
)Access Matching Markets endpoints via the matching_markets namespace.
List matching markets for a specific sport and date:
# Using dynamic methods
markets = client.matching_markets.nfl_on(Date.today)
markets = client.matching_markets.nba_on('2023-12-25')
# Using sports_by_date method
markets = client.matching_markets.sports_by_date(sport: 'nfl', date: Date.today)List matching markets by slug or ticker:
# By Polymarket slug
markets = client.matching_markets.sports(polymarket_market_slug: 'super-bowl-lviii-winner')
# By Kalshi ticker
markets = client.matching_markets.sports(kalshi_event_ticker: 'SB58')After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to [rubygems.org](https://rubygems.org).
Bug reports and pull requests are welcome on GitHub at https://github.com/rubyists/domeapi.