Class: Honeymaker::Exchanges::BingX
- Inherits:
-
Honeymaker::Exchange
- Object
- Honeymaker::Exchange
- Honeymaker::Exchanges::BingX
- Defined in:
- lib/honeymaker/exchanges/bingx.rb
Constant Summary collapse
- BASE_URL =
"https://open-api.bingx.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 46 |
# File 'lib/honeymaker/exchanges/bingx.rb', line 34 def get_bid_ask(symbol) with_rescue do response = connection.get("/openApi/spot/v2/market/ticker") do |req| req.params = { symbol: symbol } end data = response.body["data"].first { bid: BigDecimal(data["bestBidPrice"]), ask: BigDecimal(data["bestAskPrice"]) } 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/bingx.rb', line 8 def get_tickers_info with_rescue do response = connection.get("/openApi/spot/v1/common/symbols") response.body["data"]["symbols"].filter_map do |product| ticker = product["symbol"] parts = ticker.split("-") next unless parts.size == 2 { ticker: ticker, base: parts[0], quote: parts[1], minimum_base_size: product["minQty"]&.to_s, minimum_quote_size: product["minNotional"]&.to_s, maximum_base_size: product["maxQty"]&.to_s, maximum_quote_size: product["maxNotional"]&.to_s, base_decimals: Utils.decimals(product["stepSize"]), quote_decimals: Utils.decimals(product["tickSize"]), price_decimals: Utils.decimals(product["tickSize"]), available: product["status"].to_i == 1 } end end end |