Class: Moneymarket::Market

Inherits:
Object
  • Object
show all
Defined in:
lib/moneymarket/core/market.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_base_currency, _quote_currency, account_provider = nil) ⇒ Market

Returns a new instance of Market.



5
6
7
8
9
# File 'lib/moneymarket/core/market.rb', line 5

def initialize(_base_currency, _quote_currency,  = nil)
  @base_currency = _base_currency
  @quote_currency = _quote_currency
  @account_provider = 
end

Instance Attribute Details

#account_providerObject (readonly)

Returns the value of attribute account_provider.



3
4
5
# File 'lib/moneymarket/core/market.rb', line 3

def 
  @account_provider
end

Instance Method Details

#base_account_for(_order) ⇒ Object



23
24
25
# File 'lib/moneymarket/core/market.rb', line 23

def (_order)
  .(_order.user_id, base_currency)
end

#destination_account_for(_order) ⇒ Object



35
36
37
# File 'lib/moneymarket/core/market.rb', line 35

def (_order)
  public_send(_order., _order)
end

#exchange_base_accountObject



15
16
17
# File 'lib/moneymarket/core/market.rb', line 15

def 
  . base_currency
end

#exchange_quote_accountObject



19
20
21
# File 'lib/moneymarket/core/market.rb', line 19

def 
  . quote_currency
end

#preload_user_balances(_users) ⇒ Object



11
12
13
# File 'lib/moneymarket/core/market.rb', line 11

def preload_user_balances(_users)
  .preload_balances(_users, [_base_currency, _quote_currency])
end

#quote_account_for(_order) ⇒ Object



27
28
29
# File 'lib/moneymarket/core/market.rb', line 27

def (_order)
  .(_order.user_id, quote_currency)
end

#source_account_for(_order) ⇒ Object



31
32
33
# File 'lib/moneymarket/core/market.rb', line 31

def (_order)
  public_send(_order., _order)
end