Class: MyTradeWizard::FutureTradingSystem
Constant Summary
Constants included
from DateTime
DateTime::HR
Instance Attribute Summary collapse
Instance Method Summary
collapse
#account=, #fetch_positions, #place_market_order
#SMA
Methods included from DateTime
#friday, #wait_until
Constructor Details
Returns a new instance of FutureTradingSystem.
8
9
10
11
12
|
# File 'lib/mytradewizard/future_trading_system.rb', line 8
def initialize
super
@quantity = 0
@action = nil
end
|
Instance Attribute Details
#quantity=(value) ⇒ Object
Sets the attribute quantity
6
7
8
|
# File 'lib/mytradewizard/future_trading_system.rb', line 6
def quantity=(value)
@quantity = value
end
|
Instance Method Details
#hours(hourly_range) ⇒ Object
19
20
21
|
# File 'lib/mytradewizard/future_trading_system.rb', line 19
def hours(hourly_range)
@ib.hourly_bars(@contract, hourly_range, @live)
end
|
#place_closing_trade_between(good_after, good_till) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/mytradewizard/future_trading_system.rb', line 30
def place_closing_trade_between(good_after, good_till)
unless @action.nil?
print "Closing trade: "
@ib.place_market_order_between(@account, @action.reverse, @quantity, @contract, good_after, good_till)
end
end
|
#place_opening_trade_between(good_after, good_till) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/mytradewizard/future_trading_system.rb', line 23
def place_opening_trade_between(good_after, good_till)
unless @action.nil?
print "Opening trade: "
@ib.place_market_order_between(@account, @action, @quantity, @contract, good_after, good_till)
end
end
|
#symbol=(s) ⇒ Object
14
15
16
17
|
# File 'lib/mytradewizard/future_trading_system.rb', line 14
def symbol=(s)
@contract = @ib.front_month(s)
puts @contract
end
|