
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
orionx-sdk-ruby
Advanced tools
The unofficial OrionX SDK for Ruby - A comprehensive Ruby library for interacting with the OrionX cryptocurrency exchange API.
Add this line to your application's Gemfile:
gem 'orionx-sdk'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install orionx-sdk
First, you'll need to get your API credentials from OrionX:
Configure the SDK with your credentials:
require 'orionx'
# Global configuration (recommended)
OrionX.configure do |config|
config.api_key = 'your-api-key'
config.api_secret = 'your-api-secret'
config.debug = true # Enable debug logging (optional)
end
# Create client instance
client = OrionX::Client.new
Or configure per client instance:
client = OrionX::Client.new(
api_key: 'your-api-key',
api_secret: 'your-api-secret',
debug: true
)
# Test connection
ping = client.ping
puts ping # => { status: "ok", message: "Connection successful" }
# Get user information
user = client.me
puts user['name'] # => "Your Name"
# Get account balances
balances = client.accounts.get_balances
balances.each do |balance|
puts "#{balance[:currency]}: #{balance[:balance]}"
end
# Get market data
market = client.markets.get_market('BTCCLP')
puts "BTC/CLP Last Price: #{market.dig('lastTrade', 'price')}"
# Get current user information
user = client.user.me
# Returns: { "_id" => "...", "email" => "...", "name" => "...", ... }
# Get user ID only
user_id = client.user.user_id
# Returns: "user_id_string"
# Get all account balances
balances = client.accounts.get_balances
# Returns array of balance objects
# Get specific currency account
btc_account = client.accounts.get_account('BTC')
# Returns: { "_id" => "...", "currency" => {...}, "balance" => 0, ... }
# Get balance for specific currency
btc_balance = client.accounts.get_balance('BTC')
# Returns: { currency: "BTC", balance: 0, available_balance: 0, ... }
# Get all available markets
markets = client.markets.get_markets
# Returns array of market objects
# Get specific market information
btc_market = client.markets.get_market('BTCCLP')
# Returns: { "code" => "BTCCLP", "name" => "BTC/CLP", ... }
# Get market orderbook
orderbook = client.markets.get_orderbook('BTCCLP', limit: 10)
# Returns: { "buy" => [...], "sell" => [...], "spread" => 0, "mid" => 0 }
# Get market statistics (convenience method)
stats = client.markets.get_market_stats('BTCCLP')
# Returns: { code: "BTCCLP", last_price: 0, spread: 0, ... }
# Get user's orders
orders = client.orders.get_orders(onlyOpen: true, limit: 10)
# Get specific order
order = client.orders.get_order('order_id')
# Place limit order
limit_order = client.orders.place_limit_order(
market_code: 'BTCCLP',
amount: 10000, # Amount in base currency units
limit_price: 50000000, # Price in quote currency units
sell: false # true for sell, false for buy
)
# Place market order
market_order = client.orders.place_market_order(
market_code: 'BTCCLP',
amount: 10000,
sell: false
)
# Place stop-limit order
stop_order = client.orders.place_stop_limit_order(
market_code: 'BTCCLP',
stop_price_up: 52000000, # Upper trigger price
stop_price_down: 48000000, # Lower trigger price
amount: 10000,
limit_price: 50000000,
sell: true
)
# Cancel order
cancelled = client.orders.cancel_order('order_id')
# Get transaction history
transactions = client.transactions.get_transactions(
limit: 20,
page: 1,
types: ['trade-in', 'trade-out']
)
# Get specific transaction
transaction = client.transactions.get_transaction('transaction_id')
# Get transaction history for specific currency
btc_history = client.transactions.get_history('BTC', limit: 10)
# Send cryptocurrency (requires additional setup)
send_result = client.transactions.send_crypto(
wallet_id: 'wallet_id',
network: 'BTC',
amount: 100000,
contact_id: 'contact_id' # Optional
)
The SDK provides comprehensive error handling with specific exception types:
begin
result = client.me
rescue OrionX::AuthenticationError => e
puts "Invalid API credentials: #{e.message}"
rescue OrionX::ValidationError => e
puts "Invalid parameters: #{e.message}"
rescue OrionX::RateLimitError => e
puts "Rate limit exceeded: #{e.message}"
rescue OrionX::NetworkError => e
puts "Network error: #{e.message}"
rescue OrionX::APIError => e
puts "API error: #{e.message}"
rescue OrionX::Error => e
puts "SDK error: #{e.message}"
end
OrionX::AuthenticationError - Invalid API credentialsOrionX::ValidationError - Invalid parameters or input validation failedOrionX::RateLimitError - API rate limit exceededOrionX::NetworkError - Network connectivity issuesOrionX::APIError - General API errorsOrionX::Error - Base SDK error classEnable debug mode to see detailed HTTP requests and responses:
# Global configuration
OrionX.configure do |config|
config.debug = true
end
# Or per client
client.debug = true
# The debug output includes:
# - HTTP request headers and body
# - GraphQL queries and variables
# - HTTP response status and body
# - Request/response timing
# - Signature generation details
OrionX.configure do |config|
config.api_key = 'your-api-key' # Required
config.api_secret = 'your-api-secret' # Required
config.api_endpoint = 'custom-endpoint' # Optional, defaults to OrionX API
config.debug = false # Optional, enables debug logging
config.timeout = 30 # Optional, request timeout in seconds
config.retries = 3 # Optional, number of retries for failed requests
config.logger = custom_logger # Optional, custom logger instance
end
The SDK includes several comprehensive examples:
ruby examples/basic_usage.rb
Demonstrates connection testing, user information, balances, and market data.
ruby examples/trading_operations.rb
Shows how to place different order types, manage orders, and handle trading operations.
ruby examples/market_monitor.rb
Real-time market monitoring with price updates and orderbook data.
ruby examples/debug_and_errors.rb
Comprehensive demonstration of debug features and error handling patterns.
git clone https://github.com/PabloB07/orionx-sdk-ruby.git
cd orionx-sdk-ruby
bundle install
# Run all tests
bundle exec rspec
# Run with coverage
COVERAGE=true bundle exec rspec
# Run specific test file
bundle exec rspec spec/client_spec.rb
# Run RuboCop linter
bundle exec rubocop
# Auto-fix RuboCop issues
bundle exec rubocop -A
For detailed API documentation, visit:
OrionX uses specific units for different currencies:
The OrionX API has rate limits. The SDK automatically handles retries with exponential backoff for rate-limited requests.
git checkout -b feature/amazing-feature)bundle exec rspec)bundle exec rubocop)git commit -am 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by PabloB07
FAQs
Unknown package
We found that orionx-sdk-ruby demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.