Class: CossBot::Basic
- Inherits:
-
Object
- Object
- CossBot::Basic
- Defined in:
- lib/coss_bot/basic.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exchange ⇒ Object
readonly
Returns the value of attribute exchange.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#lot_size ⇒ Object
Returns the value of attribute lot_size.
-
#pair ⇒ Object
Returns the value of attribute pair.
-
#profit ⇒ Object
Returns the value of attribute profit.
-
#trade_limit ⇒ Object
Returns the value of attribute trade_limit.
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(public_key:, private_key:, logger: Logger.new(STDOUT)) ⇒ Basic
constructor
A new instance of Basic.
Constructor Details
#initialize(public_key:, private_key:, logger: Logger.new(STDOUT)) ⇒ Basic
Returns a new instance of Basic.
8 9 10 11 |
# File 'lib/coss_bot/basic.rb', line 8 def initialize(public_key:, private_key:, logger: Logger.new(STDOUT)) @exchange = CossApiRubyWrapper::Exchange.new(public_key: public_key, private_key: private_key) @logger = logger end |
Instance Attribute Details
#exchange ⇒ Object (readonly)
Returns the value of attribute exchange.
5 6 7 |
# File 'lib/coss_bot/basic.rb', line 5 def exchange @exchange end |
#interval ⇒ Object
Returns the value of attribute interval.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def interval @interval end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def logger @logger end |
#lot_size ⇒ Object
Returns the value of attribute lot_size.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def lot_size @lot_size end |
#pair ⇒ Object
Returns the value of attribute pair.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def pair @pair end |
#profit ⇒ Object
Returns the value of attribute profit.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def profit @profit end |
#trade_limit ⇒ Object
Returns the value of attribute trade_limit.
6 7 8 |
# File 'lib/coss_bot/basic.rb', line 6 def trade_limit @trade_limit end |
Instance Method Details
#call(&block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/coss_bot/basic.rb', line 13 def call(&block) validate_params! loop do time = Benchmark.measure { tick(&block) }.real wait_time = time > interval ? 0 : interval - time sleep(wait_time) end end |