Class: Devilicious::Market::BitcoinDe

Inherits:
Base
  • Object
show all
Defined in:
lib/devilicious/markets/bitcoin_de.rb

Constant Summary collapse

ScrappingError =
Class.new(Exception)

Instance Attribute Summary

Attributes inherited from Base

#order_book

Instance Method Summary collapse

Methods inherited from Base

#to_s

Instance Method Details

#fiat_currencyObject



8
9
10
# File 'lib/devilicious/markets/bitcoin_de.rb', line 8

def fiat_currency
  "EUR"
end

#refresh_order_book!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/devilicious/markets/bitcoin_de.rb', line 16

def refresh_order_book!
  retryable(tries: 2, sleep: 0, on: ScrappingError) do
    html = get_html("https://www.bitcoin.de/en/market")

    asks = format_asks_bids(html, "offer")
    bids = format_asks_bids(html, "order")

    raise ScrappingError if asks.empty? || asks.size != bids.size

    mark_as_refreshed
    @order_book = OrderBook.new(asks: asks, bids: bids)
  end
end

#trade_feeObject



12
13
14
# File 'lib/devilicious/markets/bitcoin_de.rb', line 12

def trade_fee
  BigDecimal.new("0.005").freeze # 0.5% - see https://www.bitcoin.de/en/infos#gebuehren
end