Project

domeapi

0.0
No release in over 3 years
Ruby SDK for domeapi.io (unofficial).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Project Readme

Domeapi

Ruby client for the Domeapi API.

Installation

Install the gem and add to the application’s Gemfile by executing:

bundle add domeapi

If bundler is not being used to manage dependencies, install the gem by executing:

gem install domeapi

Usage

Configuration

Configure 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'
end

Client

Initialize the client:

client = Rubyists::Domeapi.client

Polymarket

Access Polymarket endpoints via the polymarket namespace.

Markets

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')

Candlesticks

Get candlesticks:

candlesticks = client.polymarket.candlesticks.list(
  condition_id: 'condition_id',
  start_time: 1625097600,
  end_time: 1625184000,
  interval: 60
)

Trade History

Get trade history:

trades = client.polymarket.trade_history.list(
  market_slug: 'market_slug',
  limit: 10
)

Orderbook

Get orderbook history:

snapshots = client.polymarket.orderbook.list(
  token_id: 'token_id',
  start_time: 1625097600000,
  end_time: 1625184000000
)

Activity

Get activity:

activity = client.polymarket.activity.list(
  user: '0x...',
  limit: 10
)

Market Price

Get market price history:

prices = client.polymarket.market_price.list(
  token_id: 'token_id',
  at_time: 1625097600
)

Wallet

Get wallet information:

wallet = client.polymarket.wallet.list(
  eoa: '0x...'
)

Wallet Profit and Loss

Get wallet profit and loss:

pnl = client.polymarket.wallet_profit_and_loss.list(
  wallet_address: '0x...',
  granularity: 'day'
)

Matching Markets

Access Matching Markets endpoints via the matching_markets namespace.

Sports

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)

Markets

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')

Development

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).

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rubyists/domeapi.