Class: Trader::ItbitBackend
- Inherits:
-
Object
- Object
- Trader::ItbitBackend
- Defined in:
- lib/trade-o-matic/adapters/itbit_backend.rb
Instance Method Summary collapse
- #cancel_order(_session, _order) ⇒ Object
- #create_order(_session, _pair, _volume, _price, _type) ⇒ Object
- #fetch_order(_session, _order) ⇒ Object
- #fill_book(_book) ⇒ Object
- #get_available_markets ⇒ Object
- #get_balance(_session, _currency) ⇒ Object
- #get_orders(_session, _pair) ⇒ Object
- #get_session(_credentials) ⇒ Object
Instance Method Details
#cancel_order(_session, _order) ⇒ Object
44 45 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 44 def cancel_order(_session, _order) end |
#create_order(_session, _pair, _volume, _price, _type) ⇒ Object
38 39 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 38 def create_order(_session, _pair, _volume, _price, _type) end |
#fetch_order(_session, _order) ⇒ Object
41 42 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 41 def fetch_order(_session, _order) end |
#fill_book(_book) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 7 def fill_book(_book) # TODO: consider book pair _book.prepare Time.now ob = fetch_raw_order_book _book.pair ob['bids'].each { |o| _book.add_bid(o[0].to_f, o[1].to_f) } ob['asks'].each { |o| _book.add_ask(o[0].to_f, o[1].to_f) } tx = fetch_raw_transactions _book.pair tx['recentTrades'].each do |t| _book.add_transaction t['price'].to_f, t['amount'].to_f, Time.parse(t['timestamp']) end end |
#get_available_markets ⇒ Object
22 23 24 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 22 def get_available_markets # TODO. end |
#get_balance(_session, _currency) ⇒ Object
30 31 32 33 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 30 def get_balance(_session, _currency) return Price.new(_currency, 0.0) if _currency.code == :BTC return Price.new(_currency, 20000.0) if _currency.code == :Bitstamp_USD end |
#get_orders(_session, _pair) ⇒ Object
35 36 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 35 def get_orders(_session, _pair) end |
#get_session(_credentials) ⇒ Object
26 27 28 |
# File 'lib/trade-o-matic/adapters/itbit_backend.rb', line 26 def get_session(_credentials) _credentials end |