Class: Honeymaker::Exchanges::Binance
- Inherits:
-
Honeymaker::Exchange
- Object
- Honeymaker::Exchange
- Honeymaker::Exchanges::Binance
- Defined in:
- lib/honeymaker/exchanges/binance.rb
Direct Known Subclasses
Constant Summary collapse
- BASE_URL =
"https://api.binance.com"
Constants inherited from Honeymaker::Exchange
Honeymaker::Exchange::ERROR_PATTERNS, Honeymaker::Exchange::OPTIONS
Instance Method Summary collapse
Methods inherited from Honeymaker::Exchange
#cache_ttl, #classify_error, #find_ticker, #get_price, #symbols, #tickers_info
Instance Method Details
#get_bid_ask(symbol) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/honeymaker/exchanges/binance.rb', line 34 def get_bid_ask(symbol) with_rescue do response = connection.get("/api/v3/ticker/bookTicker") do |req| req.params = { symbol: symbol } end { bid: BigDecimal(response.body["bidPrice"]), ask: BigDecimal(response.body["askPrice"]) } end end |
#get_tickers_info ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/honeymaker/exchanges/binance.rb', line 8 def get_tickers_info with_rescue do response = connection.get("/api/v3/exchangeInfo") do |req| req.params = { permissions: "SPOT" } end response.body["symbols"].filter_map do |product| f = Utils.parse_filters(product["filters"]) { ticker: product["symbol"], base: product["baseAsset"], quote: product["quoteAsset"], minimum_base_size: f[:lot_size]["minQty"], minimum_quote_size: f[:notional]["minNotional"], maximum_base_size: f[:lot_size]["maxQty"], maximum_quote_size: f[:notional]["maxNotional"], base_decimals: Utils.decimals(f[:lot_size]["stepSize"]), quote_decimals: product["quoteAssetPrecision"], price_decimals: Utils.decimals(f[:price]["tickSize"]), available: product["status"] == "TRADING" } end end end |