Class: Honeymaker::Exchanges::Bitvavo
- Inherits:
-
Honeymaker::Exchange
- Object
- Honeymaker::Exchange
- Honeymaker::Exchanges::Bitvavo
- Defined in:
- lib/honeymaker/exchanges/bitvavo.rb
Constant Summary collapse
- BASE_URL =
"https://api.bitvavo.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
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/honeymaker/exchanges/bitvavo.rb', line 33 def get_bid_ask(symbol) with_rescue do response = connection.get("/v2/ticker/book") do |req| req.params = { market: symbol } end { bid: BigDecimal(response.body["bid"]), ask: BigDecimal(response.body["ask"]) } 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 |
# File 'lib/honeymaker/exchanges/bitvavo.rb', line 8 def get_tickers_info with_rescue do response = connection.get("/v2/markets") response.body.filter_map do |product| market = product["market"] base, quote = market.split("-") { ticker: market, base: base, quote: quote, minimum_base_size: product["minOrderInBaseAsset"], minimum_quote_size: product["minOrderInQuoteAsset"], maximum_base_size: nil, maximum_quote_size: nil, base_decimals: product["pricePrecision"] || 8, quote_decimals: product["pricePrecision"] || 8, price_decimals: product["pricePrecision"] || 8, available: product["status"] == "trading" } end end end |