Class: Honeymaker::Client
- Inherits:
-
Object
- Object
- Honeymaker::Client
- Defined in:
- lib/honeymaker/client.rb
Direct Known Subclasses
Honeymaker::Clients::Binance, Honeymaker::Clients::BingX, Honeymaker::Clients::BitMart, Honeymaker::Clients::Bitget, Honeymaker::Clients::Bitrue, Honeymaker::Clients::Bitvavo, Honeymaker::Clients::Bybit, Honeymaker::Clients::Coinbase, Honeymaker::Clients::Gemini, Honeymaker::Clients::Hyperliquid, Honeymaker::Clients::Kraken, Honeymaker::Clients::KrakenFutures, Honeymaker::Clients::Kucoin, Honeymaker::Clients::Mexc
Constant Summary collapse
- OPTIONS =
{ request: { open_timeout: 5, read_timeout: 30, write_timeout: 10 } }.freeze
- RATE_LIMITS =
{ default: 100, orders: 100 }.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
Class Method Summary collapse
Instance Method Summary collapse
- #get_balances ⇒ Object
-
#initialize(api_key: nil, api_secret: nil, proxy: nil, logger: nil) ⇒ Client
constructor
A new instance of Client.
- #validate(type = :trading) ⇒ Object
Constructor Details
#initialize(api_key: nil, api_secret: nil, proxy: nil, logger: nil) ⇒ Client
Returns a new instance of Client.
25 26 27 28 29 30 |
# File 'lib/honeymaker/client.rb', line 25 def initialize(api_key: nil, api_secret: nil, proxy: nil, logger: nil) @api_key = api_key @api_secret = api_secret @proxy = proxy @logger = logger end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
23 24 25 |
# File 'lib/honeymaker/client.rb', line 23 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
23 24 25 |
# File 'lib/honeymaker/client.rb', line 23 def api_secret @api_secret end |
Class Method Details
.rate_limits ⇒ Object
32 33 34 |
# File 'lib/honeymaker/client.rb', line 32 def self.rate_limits self::RATE_LIMITS end |
Instance Method Details
#get_balances ⇒ Object
36 37 38 |
# File 'lib/honeymaker/client.rb', line 36 def get_balances raise NotImplementedError, "#{self.class} must implement #get_balances" end |
#validate(type = :trading) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/honeymaker/client.rb', line 40 def validate(type = :trading) return Result::Failure.new("No credentials provided") unless authenticated? case type when :trading then validate_trading_credentials when :read then validate_read_credentials else raise Error, "Unknown validation type: #{type}. Use :trading or :read" end rescue Error raise rescue StandardError => e Result::Failure.new(e.) end |