class Ubea::Exchange::AnxBtcBase
Public Instance Methods
name()
click to toggle source
# File lib/ubea/exchanges/anx_btc_base.rb, line 6 def name "ANXBTC (#{fiat_currency})" end
refresh_order_book!()
click to toggle source
# File lib/ubea/exchanges/anx_btc_base.rb, line 14 def refresh_order_book! json = get_json("https://anxpro.com/api/2/BTC#{fiat_currency}/money/depth/full") or return asks = format_asks_bids(json["data"]["asks"]) bids = format_asks_bids(json["data"]["bids"]) mark_as_refreshed @order_book = OrderBook.new(asks: asks, bids: bids) end
trade_fee()
click to toggle source
# File lib/ubea/exchanges/anx_btc_base.rb, line 10 def trade_fee BigDecimal.new("0.005").freeze # 0.5%??? - see https://anxbtc.com/faq#tab1 end
Private Instance Methods
format_asks_bids(json)
click to toggle source
# File lib/ubea/exchanges/anx_btc_base.rb, line 26 def format_asks_bids(json) json.map do |tuple| price = tuple["price"] volume = tuple["amount"] price_chf = Money.new(price, fiat_currency) price_normalized = price_chf.exchange_to(Ubea.config.default_fiat_currency) Offer.new( price: price_normalized, volume: volume ).freeze end end