class Ubea::Exchange::BitNzNzd
Public Instance Methods
fiat_currency()
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 12 def fiat_currency "NZD" end
name()
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 8 def name "bitNZ" end
refresh_order_book!()
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 20 def refresh_order_book! json = get_json("https://bitnz.com/api/0/orderbook") or return asks = format_asks_bids(json["asks"]) bids = format_asks_bids(json["bids"]) mark_as_refreshed @order_book = OrderBook.new(asks: asks, bids: bids) end
trade_fee()
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 16 def trade_fee BigDecimal.new("0.005").freeze # 0.5% - see https://bitnz.com/fees end
website()
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 4 def website "https://bitnz.com/".freeze end
Private Instance Methods
format_asks_bids(json)
click to toggle source
# File lib/ubea/exchanges/bit_nz_nzd.rb, line 32 def format_asks_bids(json) json.map do |price, volume| price_nzd = Money.new(price.to_s, fiat_currency) price_normalized = price_nzd.exchange_to(Ubea.config.default_fiat_currency) Offer.new( price: price_normalized, volume: volume.to_s ).freeze end end