Class: Binance::Client::REST
- Inherits:
-
Object
- Object
- Binance::Client::REST
- Includes:
- AccountAPI, PublicAPI, WithdrawAPI
- 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/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: AccountAPI, PublicAPI, WithdrawAPI 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', twenty_four_hour: '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', userDataStream: 'v1/userDataStream', # Withdraw API Endpoints withdraw: 'v3/withdraw.html', depositHistory: 'v3/depositHistory.html', withdrawHistory: 'v3/withdrawHistory.html', depositAddress: 'v3/depositAddress.html', accountStatus: 'v3/accountStatus.html' }.freeze
Instance Method Summary collapse
-
#initialize(api_key: '', secret_key: '', adapter: Faraday.default_adapter) ⇒ REST
constructor
Public: Initialize a REST Client.
Methods included from WithdrawAPI
#account_status, #deposit_address, #deposit_history, #withdraw, #withdraw_history
Methods included from AccountAPI
#account_info, #account_trade_list, #all_orders, #cancel_order, #close_stream, #create_order, #create_test_order, #keep_stream_alive, #listen_key, #open_orders, #query_order
Methods included from PublicAPI
#agg_trades, #all_book_tickers, #all_prices, #book_ticker, #depth, #exchange_info, #historical_trades, #klines, #ping, #price, #products, #time, #trades, #twenty_four_hour
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 44 45 |
# File 'lib/binance/client/rest.rb', line 33 def initialize(api_key: '', secret_key: '', adapter: Faraday.default_adapter) @library = {} # Endpoint doesn't require an api_key or secret_key @library[:public] = public_client adapter # Endpoint requires an api_key @library[:verified] = verified_client api_key, adapter # Endpoint requires an api_key and secret_key @library[:signed] = signed_client api_key, secret_key, adapter # Endpoint requires an api_key and secret_key - for the Withdraw API @library[:withdraw] = withdraw_client api_key, secret_key, adapter end |