Class: Binance::Client::REST
- Inherits:
-
Object
- Object
- Binance::Client::REST
- Defined in:
- lib/binance/client/rest.rb,
lib/binance/client/rest/public_api.rb,
lib/binance/client/rest/account_api.rb,
lib/binance/client/rest/withdraw_api.rb,
lib/binance/client/rest/api_endpoints.rb,
lib/binance/client/rest/user_data_api.rb,
lib/binance/client/rest/sign_request_middleware.rb,
lib/binance/client/rest/timestamp_request_middleware.rb
Overview
Public: Client with methods mirroring the Binance REST APIs
Defined Under Namespace
Modules: Account_API, Public_API, UserData_API, Withdraw_API Classes: SignRequestMiddleware, TimestampRequestMiddleware
Constant Summary collapse
- BASE_URL =
Public: String base url for REST client to use
'https://www.binance.com'.freeze
- API_ENDPOINTS =
{ # Public API Endpoints 'ping' => 'v1/ping', 'time' => 'v1/time', 'exchangeInfo' => 'v1/exchangeInfo', 'products' => '/exchange/public/products', 'depth' => 'v1/depth', 'trades' => 'v1/trades', 'historicalTrades' => 'v1/historicalTrades', 'aggTrades' => 'v1/aggTrades', 'klines' => 'v1/klines', '24hr' => 'v1/ticker/24hr', 'price' => 'v3/ticker/price', 'bookTicker' => 'v3/ticker/bookTicker', # Account API Endpoints 'order' => 'v3/order', 'order/test' => 'v3/order/test', 'openOrders' => 'v3/openOrders', 'allOrders' => 'v3/allOrders', 'account' => 'v3/account', 'myTrades' => 'v3/myTrades', # Withdraw API Endpoints 'withdraw' => 'v3/withdraw.html', 'depositHistory' => 'v3/depositHistory.html', 'withdrawHistory' => 'v3/withdrawHistory.html', 'depositAddress' => 'v3/depositAddress.html', 'accountStatus' => 'v3/accountStatus.html', # User Data Stream API Endpoints 'userDataStream' => 'v1/userDataStream' }.freeze
Class Attribute Summary collapse
-
.api ⇒ Object
Returns the value of attribute api.
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize(api_key: '', secret_key: '', adapter: Faraday.default_adapter) ⇒ REST
constructor
Public: Initialize a REST Client.
Constructor Details
#initialize(api_key: '', secret_key: '', adapter: Faraday.default_adapter) ⇒ REST
Public: Initialize a REST Client
:api_key - The String API key to authenticate (Default = ”).
:secret_key - The String secret key to authenticate (Default = ”).
:adapter - The Faraday::Adapter to be used for the client
(Default = Faraday.default_adapter).
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/binance/client/rest.rb', line 33 def initialize(api_key: '', secret_key: '', adapter: Faraday.default_adapter) @api_key = api_key @secret_key = secret_key @adapter = adapter extend Public_API extend Account_API extend Withdraw_API extend UserData_API end |
Class Attribute Details
.api ⇒ Object
Returns the value of attribute api.
20 21 22 |
# File 'lib/binance/client/rest.rb', line 20 def api @api end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
23 24 25 |
# File 'lib/binance/client/rest.rb', line 23 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
23 24 25 |
# File 'lib/binance/client/rest.rb', line 23 def api_key @api_key end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
23 24 25 |
# File 'lib/binance/client/rest.rb', line 23 def secret_key @secret_key end |