Class: MyTradeWizard::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/mytradewizard/cli.rb

Instance Method Summary collapse

Instance Method Details

#accountsObject



32
33
34
35
36
# File 'lib/mytradewizard/cli.rb', line 32

def accounts
  ib = MyTradeWizard::InteractiveBrokers.new
  ib.connect
  puts "Accounts: " + ib.accounts.join(", ")
end

#CLObject



39
40
41
42
43
# File 'lib/mytradewizard/cli.rb', line 39

def CL
  ib = MyTradeWizard::InteractiveBrokers.new
  ib.connect
  puts "Front month: " + ib.front_month(:CL).expiry
end

#configObject



15
16
17
18
19
20
21
22
23
# File 'lib/mytradewizard/cli.rb', line 15

def config
  puts "Environment: " + MyTradeWizard::Configuration::ENVIRONMENT
  puts "Host: " + MyTradeWizard::Configuration::InteractiveBrokers::HOST
  puts "Port: " + MyTradeWizard::Configuration::InteractiveBrokers::PORT.to_s
  puts "Account: " + MyTradeWizard::Configuration::InteractiveBrokers::ACCOUNT
  puts "Email To: " + MyTradeWizard::Configuration::Email::TO
  puts "Gmail Username: " + MyTradeWizard::Configuration::Email::GMAIL_USERNAME
  puts "Gmail Password: " + MyTradeWizard::Configuration::Email::GMAIL_PASSWORD
end

#configureObject



10
11
12
# File 'lib/mytradewizard/cli.rb', line 10

def configure
  MyTradeWizard::Generators::MyTradeWizard.start([options[:environment] || "local", options[:host] || "localhost", options[:port] || 7496, options[:account] || "", options[:email_to] || "", options[:gmail_username] || "", options[:gmail_password] || ""])
end

#connectObject



26
27
28
29
# File 'lib/mytradewizard/cli.rb', line 26

def connect
  ib = MyTradeWizard::InteractiveBrokers.new
  ib.connect
end

#QMObject



46
47
48
49
50
# File 'lib/mytradewizard/cli.rb', line 46

def QM
  ib = MyTradeWizard::InteractiveBrokers.new
  ib.connect
  puts "Front month: " + ib.front_month(:QM).expiry
end