Class: BitmexClient::HTTP::Connection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bitmex_client/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, secret) ⇒ Connection

Returns a new instance of Connection.



15
16
17
18
19
20
21
22
23
24
# File 'lib/bitmex_client/http.rb', line 15

def initialize(key, secret)
  @connection = Faraday::Connection.new(:url => Bitmex.url) do |f|
    f.request :json
    f.response :json, :parser_options => { :symbolize_names => true }
    f.use FaradayMiddleware::Authentication, key, secret
    f.use FaradayMiddleware::RaiseHttpException
    f.use FaradayMiddleware::LoudLogger if Bitmex.loud_logger
    f.adapter Bitmex.adapter
  end
end