omnitrade_client is an open-source Ruby gem that integrates the OmniTrade API.
You can read the API documentation by visiting https://omnitrade.io/documents/api_v2
Add omnitrade_client to your Gemfile.
gem 'omnitrade_client', github: 'OmniTrade/client-ruby'Install by running:
bundle install
Require the client in your code by adding:
require 'omnitrade_client'You can use both the public or private API.
Instance your public client by using:
public_client = OmniTradeAPI::Client.newUse .get_public to make a GET request to an URL, as the following example:
client_public.get_public '/api/v2/markets'When using the private client, you also have to specify your access and private keys in the instantiation:
private_client = OmniTradeAPI::Client.new access_key: 'your_access_key', secret_key: 'your_secret_key'You can also set a timeout and/or endpoit by adding the arguments:
private_client = OmniTradeAPI::Client.new access_key: 'your_access_key', secret_key: 'your_secret_key', timeout: 60, endpoint: 'https://omnitrade.io/'Use .get to make a GET request to an URL, you can also set the required arguments, as the following example:
private_client.get '/api/v2/orders', market: 'btcbrl'Use .post to make a POST request to an URL, you can also set the required arguments, as the following example:
private_client.post '/api/v2/orders', market: 'btcbrl', side: 'buy', volume: '0.42', price: '4200.0'OmniTrade (C) All Rights Reserved.
omnitrade_client is released under Apache License 2.0.