Module: BudaApi

Includes:
Errors
Defined in:
lib/buda_api.rb,
lib/buda_api/client.rb,
lib/buda_api/errors.rb,
lib/buda_api/logger.rb,
lib/buda_api/models.rb,
lib/buda_api/version.rb,
lib/buda_api/constants.rb,
lib/buda_api/public_client.rb,
lib/buda_api/ai/risk_manager.rb,
lib/buda_api/ai/anomaly_detector.rb,
lib/buda_api/ai/trading_assistant.rb,
lib/buda_api/authenticated_client.rb,
lib/buda_api/ai/natural_language_trader.rb

Overview

BudaApi is the main module for the Buda.com API Ruby SDK

This SDK provides comprehensive access to the Buda.com cryptocurrency exchange API with built-in error handling, debugging capabilities, and extensive examples.

Examples:

Basic usage with public API

client = BudaApi::PublicClient.new
markets = client.markets
ticker = client.ticker("BTC-CLP")

Authenticated API usage

client = BudaApi::AuthenticatedClient.new(api_key: "your_key", api_secret: "your_secret")
balance = client.balance("BTC")
order = client.place_order("BTC-CLP", "ask", "limit", 1000000, 0.001)

Defined Under Namespace

Modules: AI, Constants, Errors, Models Classes: AuthenticatedClient, Client, Configuration, Error, Logger, PublicClient

Constant Summary collapse

VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configuration ⇒ Configuration

Get current configuration

Returns:



74
75
76
# File 'lib/buda_api.rb', line 74

def configuration
  @configuration
end

Class Method Details

.ai_available? ⇒ Boolean

Check if AI features are available

Returns:

  • (Boolean) —

    true if RubyLLM is available



96
97
98
# File 'lib/buda_api.rb', line 96

def self.ai_available?
  defined?(RubyLLM) && defined?(BudaApi::AI)
end

.authenticated_client(api_key:, api_secret:, **options) ⇒ AuthenticatedClient

Convenience method to create an authenticated client

Parameters:

  • api_key (String) —

    API key

  • api_secret (String) —

    API secret

  • options (Hash) —

    additional client options

Returns:



90
91
92
# File 'lib/buda_api.rb', line 90

def self.authenticated_client(api_key:, api_secret:, **options)
  AuthenticatedClient.new(api_key: api_key, api_secret: api_secret, **options)
end

.configure {|Configuration| ... } ⇒ Object

Configure the SDK

Examples:

BudaApi.configure do |config|
  config.debug_mode = true
  config.timeout = 60
end

Yields:



67
68
69
70
# File 'lib/buda_api.rb', line 67

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.natural_language_trader(client) ⇒ AI::NaturalLanguageTrader

Convenience method to create a natural language trader

Parameters:

Returns:

Raises:



113
114
115
116
117
# File 'lib/buda_api.rb', line 113

def self.natural_language_trader(client)
  raise Error, "AI features not available. Install ruby_llm gem." unless ai_available?
  
  AI::NaturalLanguageTrader.new(client)
end

.public_client(options = {}) ⇒ PublicClient

Convenience method to create a public client

Parameters:

  • options (Hash) (defaults to: {}) —

    client options

Returns:



81
82
83
# File 'lib/buda_api.rb', line 81

def self.public_client(options = {})
  PublicClient.new(options)
end

.trading_assistant(client, llm_provider: :openai) ⇒ AI::TradingAssistant

Convenience method to create an AI-enhanced trading assistant

Parameters:

  • client (AuthenticatedClient) —

    authenticated client

  • llm_provider (Symbol) (defaults to: :openai) —

    LLM provider (:openai, :anthropic, etc.)

Returns:

Raises:



104
105
106
107
108
# File 'lib/buda_api.rb', line 104

def self.trading_assistant(client, llm_provider: :openai)
  raise Error, "AI features not available. Install ruby_llm gem." unless ai_available?
  
  AI::TradingAssistant.new(client, llm_provider: llm_provider)
end