Skip to content

Latest commit

 

History

History
178 lines (123 loc) · 3.51 KB

File metadata and controls

178 lines (123 loc) · 3.51 KB

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

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.