Class: Honeymaker::Exchanges::Bitrue
- Inherits:
-
Honeymaker::Exchange
- Object
- Honeymaker::Exchange
- Honeymaker::Exchanges::Bitrue
- Defined in:
- lib/honeymaker/exchanges/bitrue.rb
Constant Summary collapse
- BASE_URL =
"https://openapi.bitrue.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
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/honeymaker/exchanges/bitrue.rb', line 32 def get_bid_ask(symbol) with_rescue do response = connection.get("/api/v1/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 |
# File 'lib/honeymaker/exchanges/bitrue.rb', line 8 def get_tickers_info with_rescue do response = connection.get("/api/v1/exchangeInfo") response.body["symbols"].filter_map do |product| f = Utils.parse_filters(product["filters"] || []) { ticker: product["symbol"], base: product["baseAsset"]&.upcase, quote: product["quoteAsset"]&.upcase, minimum_base_size: f[:lot_size]&.dig("minQty"), minimum_quote_size: f[:lot_size]&.dig("minVal"), maximum_base_size: f[:lot_size]&.dig("maxQty"), maximum_quote_size: nil, base_decimals: f[:lot_size] ? Utils.decimals(f[:lot_size]["stepSize"]) : product["baseAssetPrecision"], quote_decimals: product["quotePrecision"], price_decimals: f[:price] ? Utils.decimals(f[:price]["tickSize"]) : product["quotePrecision"], available: product["status"] == "TRADING" } end end end |