Module: BridgetownIbRuby

Defined in:
lib/bridgetown-ib-ruby/version.rb,
lib/bridgetown-ib-ruby/initializer.rb

Constant Summary collapse

VERSION =
"0.2"

Class Method Summary collapse

Class Method Details

.gateway_configuration(config) ⇒ Object



11
12
13
14
# File 'lib/bridgetown-ib-ruby/initializer.rb', line 11

def self.gateway_configuration(config)
  # Reads a YAML configuration file, evaluating any ERB, then parsing the resulting YAML.
  ActiveSupport::ConfigurationFile.parse(File.join(config.root_dir, "config", "tws.yml")).merge( logger: log_writer )
end

.log_writerObject



22
23
24
# File 'lib/bridgetown-ib-ruby/initializer.rb', line 22

def self.log_writer
  Bridgetown::LogWriter.new.tap(&:enable_prefix)
end

.the_gateway(config) ⇒ Object



16
17
18
19
20
# File 'lib/bridgetown-ib-ruby/initializer.rb', line 16

def self.the_gateway config
  IB::Gateway.new **BridgetownIbRuby.gateway_configuration(config) do |gw|
    gw.logger.level =  Logger::INFO
  end
end