Class: Honeymaker::Exchanges::Bitget
- Inherits:
-
Honeymaker::Exchange
- Object
- Honeymaker::Exchange
- Honeymaker::Exchanges::Bitget
- Defined in:
- lib/honeymaker/exchanges/bitget.rb
Constant Summary collapse
- BASE_URL =
"https://api.bitget.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
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/honeymaker/exchanges/bitget.rb', line 30 def get_bid_ask(symbol) with_rescue do response = connection.get("/api/v2/spot/market/tickers") do |req| req.params = { symbol: symbol } end ticker = response.body["data"].first { bid: BigDecimal(ticker["bestBid"]), ask: BigDecimal(ticker["bestAsk"]) } 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 |
# File 'lib/honeymaker/exchanges/bitget.rb', line 8 def get_tickers_info with_rescue do response = connection.get("/api/v2/spot/public/symbols") response.body["data"].filter_map do |product| { ticker: product["symbol"], base: product["baseCoin"], quote: product["quoteCoin"], minimum_base_size: product["minTradeAmount"], minimum_quote_size: product["minTradeUSDT"], maximum_base_size: product["maxTradeAmount"], maximum_quote_size: nil, base_decimals: product["quantityPrecision"].to_i, quote_decimals: product["quotePrecision"].to_i, price_decimals: product["pricePrecision"].to_i, available: product["status"] == "online" } end end end |