Class: BitexBot::SellClosingFlow
- Inherits:
-
ClosingFlow
- Object
- ActiveRecord::Base
- ClosingFlow
- BitexBot::SellClosingFlow
- Defined in:
- lib/bitex_bot/models/sell_closing_flow.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#get_btc_profit ⇒ Object
The coins we actually bought minus the coins we were supposed to re-buy.
- #get_next_price_and_quantity ⇒ Object
-
#get_usd_profit ⇒ Object
The amount received when selling initially, minus the amount spent re-buying the sold coins.
- #order_method ⇒ Object
Methods inherited from ClosingFlow
close_open_positions, close_time_to_live, #create_initial_order_and_close_position, #create_order_and_close_position, minimum_amount_for_closing, #sync_closed_positions
Class Method Details
.open_position_class ⇒ Object
7 8 9 |
# File 'lib/bitex_bot/models/sell_closing_flow.rb', line 7 def self.open_position_class OpenSell end |
Instance Method Details
#get_btc_profit ⇒ Object
The coins we actually bought minus the coins we were supposed to re-buy
23 24 25 |
# File 'lib/bitex_bot/models/sell_closing_flow.rb', line 23 def get_btc_profit close_positions.sum(:quantity) - quantity end |
#get_next_price_and_quantity ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/bitex_bot/models/sell_closing_flow.rb', line 27 def get_next_price_and_quantity closes = close_positions next_price = desired_price + ((closes.count * (closes.count * 3)) / 100.0) next_quantity = ((quantity * desired_price) - closes.sum(:amount)) / next_price [next_price, next_quantity] end |
#get_usd_profit ⇒ Object
The amount received when selling initially, minus the amount spent re-buying the sold coins.
17 18 19 |
# File 'lib/bitex_bot/models/sell_closing_flow.rb', line 17 def get_usd_profit open_positions.sum(:amount) - close_positions.sum(:amount) end |
#order_method ⇒ Object
11 12 13 |
# File 'lib/bitex_bot/models/sell_closing_flow.rb', line 11 def order_method :buy end |