lib/ib-ruby/models/order.rb in ib-ruby-0.5.13 vs lib/ib-ruby/models/order.rb in ib-ruby-0.5.14
- old
+ new
@@ -48,26 +48,71 @@
# Main order fields
attr_accessor :id, # int: m_orderId? The id for this order.
:client_id, # int: The id of the client that placed this order.
:perm_id, # int: TWS id used to identify orders, remains
# the same over TWS sessions.
- :action, # String: Identifies the side. Valid values: BUY/SELL/SSHORT
+ :action, # String: Identifies the side: BUY/SELL/SSHORT
:total_quantity, # int: The order quantity.
+
:order_type, # String: Identifies the order type. Valid values are:
- # MKT / MKTCLS / LMT / LMTCLS / PEGMKT / SCALE
- # STP / STPLMT / TRAIL / REL / VWAP / TRAILLIMIT
+ # Limit Risk:
+ # MTL Market-to-Limit
+ # MKT PRT Market with Protection
+ # QUOTE Request for Quote
+ # STP Stop
+ # STP LMT Stop Limit
+ # TRAIL Trailing Stop
+ # TRAIL LIMIT Trailing Stop Limit
+ # TRAIL LIT Trailing Limit if Touched
+ # TRAIL MIT Trailing Market If Touched
+ # Speed of Execution:
+ # MKT Market
+ # MIT Market-if-Touched
+ # MOC Market-on-Close MKTCLSL ?
+ # MOO Market-on-Open
+ # PEG MKT Pegged-to-Market
+ # REL Relative
+ # Price Improvement:
+ # BOX TOP Box Top
+ # LOC Limit-on-Close LMTCLS ?
+ # LOO Limit-on-Open
+ # LIT Limit if Touched
+ # PEG MID Pegged-to-Midpoint
+ # VWAP VWAP-Guaranteed
+ # Advanced Trading:
+ # OCA One-Cancels-All
+ # VOL Volatility
+ # SCALE Scale
+ # Other (no abbreviation):
+ # Bracket
+ # At Auction
+ # Discretionary
+ # Sweep-to-Fill
+ # Price Improvement Auction
+ # Block
+ # Hidden
+ # Iceberg/Reserve
+ # All-or-None
+ # Fill-or-Kill
+
:limit_price, # double: This is the LIMIT price, used for limit,
# stop-limit and relative orders. In all other cases
# specify zero. For relative orders with no limit price,
# also specify zero.
+
:aux_price, # double: This is the STOP price for stop-limit orders,
# and the offset amount for relative orders. In all other
# cases, specify zero.
#:shares_allocation, # deprecated sharesAllocation field
# Extended order fields
- :tif, # String: Time in Force - DAY / GTC / IOC / GTD
+ :tif, # String: Time to Market:
+ # DAY
+ # GAT Good-after-Time/Date
+ # GTD Good-till-Date/Time
+ # GTC Good-till-Canceled
+ # IOC Immediate-or-Cancel
:oca_group, # String: one cancels all group name
:oca_type, # int: Tells how to handle remaining orders in an OCA group
# when one order or part of an order executes. Valid values:
# - 1 = Cancel all remaining orders with block
# - 2 = Remaining orders are reduced in size with block
@@ -247,10 +292,25 @@
:min_commission,
:max_commission,
:warning_text # String: Displays a warning message if warranted.
+ # IB uses weird String with Java Double.MAX_VALUE to indicate no value here
+ def init_margin= val
+ @init_margin = val == "1.7976931348623157E308" ? nil : val
+ end
+
+ # IB uses weird String with Java Double.MAX_VALUE to indicate no value here
+ def maint_margin= val
+ @maint_margin = val == "1.7976931348623157E308" ? nil : val
+ end
+
+ # IB uses weird String with Java Double.MAX_VALUE to indicate no value here
+ def equity_with_loan= val
+ @equity_with_loan = val == "1.7976931348623157E308" ? nil : val
+ end
+
def initialize opts = {}
# Assign defaults first!
@outside_rth = false
@open_close = "O"
@origin = Origin_Customer
@@ -375,11 +435,11 @@
" #{key}=#{value}" unless value.nil? || value == '' || value == 0
end.compact.join(',') + " >"
end
def to_human
- "<Order: #{@status} #{@order_type} #{@action} #{@total_quantity} @ #{@limit_price}" +
- " #{@tif} id/perm: #{@id}/#{@perm_id}>"
+ "<Order: #{order_type} #{tif} #{action} #{total_quantity} #{status} #{limit_price}" +
+ " id: #{id}/#{perm_id} from: #{client_id}/#{account}>"
end
end # class Order
end # module Models
end # module IB