Module: Coinbot::Portfolio::Invested
- Defined in:
- lib/coinbot/portfolio/invested.rb
Class Method Summary collapse
-
.help ⇒ Object
Display Usage for this Module.
-
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::Portfolio.invested( ).
Class Method Details
.help ⇒ Object
Display Usage for this Module
39 40 41 42 43 |
# File 'lib/coinbot/portfolio/invested.rb', line 39 public_class_method def self.help puts "USAGE: event_history.order_book = #{self}.crypto() " end |
.refresh(opts = {}) ⇒ Object
- Supported Method Parameters
-
Coinbot::Portfolio.invested( )
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/coinbot/portfolio/invested.rb', line 13 public_class_method def self.refresh(opts = {}) option_choice = opts[:option_choice] event_history = opts[:event_history] crypto_currency = option_choice.symbol.to_s.upcase.split('_').first portfolio = event_history.order_book[:portfolio] symbol_portfolio_arr = portfolio.select do |this_portfolio| this_portfolio if this_portfolio[:currency] == crypto_currency end symbol_portfolio = symbol_portfolio_arr.first symbol_balance = symbol_portfolio[:balance].to_f symbol_balance_available = symbol_portfolio[:available].to_f # Get Trading Rules for Respective Crypto. this_product = event_history.order_book[:this_product] # base_min_size = this_product[:base_min_size] min_market_funds = this_product[:min_market_funds] invested = false invested = true if symbol_balance.positive? || symbol_balance_available.positive? rescue StandardError => e raise e end |