Class: StockFighter::Level

Inherits:
Object
  • Object
show all
Defined in:
lib/stock_fighter/level.rb

Instance Method Summary collapse

Constructor Details

#initialize(level_name, api = nil, api_key: nil, account: nil, venue: nil, stock: nil) ⇒ Level

Returns a new instance of Level.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/stock_fighter/level.rb', line 5

def initialize level_name, api = nil, api_key: nil, account: nil, venue: nil, stock: nil
  raise "Must provide an API key, or an Api instance." if api.nil? and api_key.nil?

  @name = level_name
  @delegator = api or StockFighter.create_api api_key

  @defaults = {}
  @defaults[:account] =  unless .nil?
  @defaults[:venue] = venue unless venue.nil?
  @defaults[:stock] = stock unless stock.nil?
end