ib-api 972.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +50 -0
 - data/.rspec +3 -0
 - data/.travis.yml +7 -0
 - data/CODE_OF_CONDUCT.md +74 -0
 - data/Gemfile +16 -0
 - data/Gemfile.lock +105 -0
 - data/Guardfile +24 -0
 - data/LICENSE +674 -0
 - data/README.md +65 -0
 - data/Rakefile +11 -0
 - data/VERSION +1 -0
 - data/api.gemspec +43 -0
 - data/bin/console +95 -0
 - data/bin/console.yml +3 -0
 - data/bin/setup +8 -0
 - data/changelog.md +7 -0
 - data/example/README.md +76 -0
 - data/example/account_info +54 -0
 - data/example/account_positions +30 -0
 - data/example/account_summary +88 -0
 - data/example/cancel_orders +74 -0
 - data/example/fa_accounts +25 -0
 - data/example/fundamental_data +40 -0
 - data/example/historic_data_cli +186 -0
 - data/example/list_orders +45 -0
 - data/example/portfolio_csv +81 -0
 - data/example/scanner_data +62 -0
 - data/example/template +19 -0
 - data/example/tick_data +28 -0
 - data/lib/extensions/class-extensions.rb +87 -0
 - data/lib/ib-api.rb +7 -0
 - data/lib/ib/base.rb +103 -0
 - data/lib/ib/base_properties.rb +160 -0
 - data/lib/ib/connection.rb +450 -0
 - data/lib/ib/constants.rb +393 -0
 - data/lib/ib/errors.rb +44 -0
 - data/lib/ib/logger.rb +26 -0
 - data/lib/ib/messages.rb +99 -0
 - data/lib/ib/messages/abstract_message.rb +101 -0
 - data/lib/ib/messages/incoming.rb +251 -0
 - data/lib/ib/messages/incoming/abstract_message.rb +116 -0
 - data/lib/ib/messages/incoming/account_value.rb +78 -0
 - data/lib/ib/messages/incoming/alert.rb +34 -0
 - data/lib/ib/messages/incoming/contract_data.rb +102 -0
 - data/lib/ib/messages/incoming/delta_neutral_validation.rb +23 -0
 - data/lib/ib/messages/incoming/execution_data.rb +50 -0
 - data/lib/ib/messages/incoming/historical_data.rb +84 -0
 - data/lib/ib/messages/incoming/market_depths.rb +44 -0
 - data/lib/ib/messages/incoming/next_valid_id.rb +18 -0
 - data/lib/ib/messages/incoming/open_order.rb +277 -0
 - data/lib/ib/messages/incoming/order_status.rb +85 -0
 - data/lib/ib/messages/incoming/portfolio_value.rb +78 -0
 - data/lib/ib/messages/incoming/real_time_bar.rb +32 -0
 - data/lib/ib/messages/incoming/scanner_data.rb +54 -0
 - data/lib/ib/messages/incoming/ticks.rb +268 -0
 - data/lib/ib/messages/outgoing.rb +437 -0
 - data/lib/ib/messages/outgoing/abstract_message.rb +88 -0
 - data/lib/ib/messages/outgoing/account_requests.rb +112 -0
 - data/lib/ib/messages/outgoing/bar_requests.rb +250 -0
 - data/lib/ib/messages/outgoing/place_order.rb +209 -0
 - data/lib/ib/messages/outgoing/request_marketdata.rb +99 -0
 - data/lib/ib/messages/outgoing/request_tick_data.rb +21 -0
 - data/lib/ib/model.rb +4 -0
 - data/lib/ib/models.rb +14 -0
 - data/lib/ib/server_versions.rb +114 -0
 - data/lib/ib/socket.rb +185 -0
 - data/lib/ib/support.rb +160 -0
 - data/lib/ib/version.rb +6 -0
 - data/lib/models/ib/account.rb +85 -0
 - data/lib/models/ib/account_value.rb +33 -0
 - data/lib/models/ib/bag.rb +55 -0
 - data/lib/models/ib/bar.rb +31 -0
 - data/lib/models/ib/combo_leg.rb +105 -0
 - data/lib/models/ib/condition.rb +245 -0
 - data/lib/models/ib/contract.rb +415 -0
 - data/lib/models/ib/contract_detail.rb +108 -0
 - data/lib/models/ib/execution.rb +67 -0
 - data/lib/models/ib/forex.rb +13 -0
 - data/lib/models/ib/future.rb +15 -0
 - data/lib/models/ib/index.rb +15 -0
 - data/lib/models/ib/option.rb +78 -0
 - data/lib/models/ib/option_detail.rb +55 -0
 - data/lib/models/ib/order.rb +519 -0
 - data/lib/models/ib/order_state.rb +152 -0
 - data/lib/models/ib/portfolio_value.rb +64 -0
 - data/lib/models/ib/stock.rb +16 -0
 - data/lib/models/ib/underlying.rb +34 -0
 - data/lib/models/ib/vertical.rb +96 -0
 - data/lib/requires.rb +12 -0
 - metadata +203 -0
 
| 
         @@ -0,0 +1,152 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module IB
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              # OrderState represents dynamic (changeable) info about a single Order,
         
     | 
| 
      
 4 
     | 
    
         
            +
              # isolating these changes and making Order essentially immutable
         
     | 
| 
      
 5 
     | 
    
         
            +
              class OrderState < IB::Model
         
     | 
| 
      
 6 
     | 
    
         
            +
                include BaseProperties
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                #p column_names
         
     | 
| 
      
 9 
     | 
    
         
            +
                belongs_to :order
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                # Properties arriving via OpenOrder message
         
     | 
| 
      
 12 
     | 
    
         
            +
                prop :init_margin, # Float: The impact the order would have on your initial margin.
         
     | 
| 
      
 13 
     | 
    
         
            +
                  :maint_margin, # Float: The impact the order would have on your maintenance margin.
         
     | 
| 
      
 14 
     | 
    
         
            +
                  :equity_with_loan, # Float: The impact the order would have on your equity
         
     | 
| 
      
 15 
     | 
    
         
            +
                  :commission, # double: Shows the commission amount on the order.
         
     | 
| 
      
 16 
     | 
    
         
            +
                  :min_commission, # The possible min range of the actual order commission.
         
     | 
| 
      
 17 
     | 
    
         
            +
                  :max_commission, # The possible max range of the actual order commission.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  :commission_currency, # String: Shows the currency of the commission.
         
     | 
| 
      
 19 
     | 
    
         
            +
                  :warning_text, # String: Displays a warning message if warranted.
         
     | 
| 
      
 20 
     | 
    
         
            +
                  
         
     | 
| 
      
 21 
     | 
    
         
            +
                  :market_cap_price  # messages#incomming#orderstae#vers. 11
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  # Properties arriving via OrderStatus message:
         
     | 
| 
      
 24 
     | 
    
         
            +
                  prop :filled, #    int
         
     | 
| 
      
 25 
     | 
    
         
            +
                  :remaining, # int
         
     | 
| 
      
 26 
     | 
    
         
            +
                  [:price, :last_fill_price,], #    double
         
     | 
| 
      
 27 
     | 
    
         
            +
                  [:average_price, :average_fill_price], # double
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :why_held # String: comma-separated list of reasons for order to be held.
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  # Properties arriving in both messages:
         
     | 
| 
      
 31 
     | 
    
         
            +
                  prop :local_id, #  int: Order id associated with client (volatile).
         
     | 
| 
      
 32 
     | 
    
         
            +
                  :perm_id, #   int: TWS permanent id, remains the same over TWS sessions.
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :client_id, # int: The id of the client that placed this order.
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :parent_id, # int: The order ID of the parent (original) order, used
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :status => :s # String: one of
         
     | 
| 
      
 36 
     | 
    
         
            +
                  #   ApiCancelled, PreSubmitted, PendingCancel, Cancelled, Submitted, Filled,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  #	  Inactive, PendingSubmit, Unknown, ApiPending,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  #
         
     | 
| 
      
 39 
     | 
    
         
            +
                  #  Displays the order status. Possible values include:
         
     | 
| 
      
 40 
     | 
    
         
            +
                  # - PendingSubmit - indicates that you have transmitted the order, but
         
     | 
| 
      
 41 
     | 
    
         
            +
                  #   have not yet received confirmation that it has been accepted by the
         
     | 
| 
      
 42 
     | 
    
         
            +
                  #   order destination. NOTE: This order status is NOT sent back by TWS
         
     | 
| 
      
 43 
     | 
    
         
            +
                  #   and should be explicitly set by YOU when an order is submitted.
         
     | 
| 
      
 44 
     | 
    
         
            +
                  # - PendingCancel - indicates that you have sent a request to cancel
         
     | 
| 
      
 45 
     | 
    
         
            +
                  #   the order but have not yet received cancel confirmation from the
         
     | 
| 
      
 46 
     | 
    
         
            +
                  #   order destination. At this point, your order cancel is not confirmed.
         
     | 
| 
      
 47 
     | 
    
         
            +
                  #   You may still receive an execution while your cancellation request
         
     | 
| 
      
 48 
     | 
    
         
            +
                  #   is pending. NOTE: This order status is not sent back by TWS and
         
     | 
| 
      
 49 
     | 
    
         
            +
                  #   should be explicitly set by YOU when an order is canceled.
         
     | 
| 
      
 50 
     | 
    
         
            +
                  # - PreSubmitted - indicates that a simulated order type has been
         
     | 
| 
      
 51 
     | 
    
         
            +
                  #   accepted by the IB system and that this order has yet to be elected.
         
     | 
| 
      
 52 
     | 
    
         
            +
                  #   The order is held in the IB system until the election criteria are
         
     | 
| 
      
 53 
     | 
    
         
            +
                  #   met. At that time the order is transmitted to the order destination
         
     | 
| 
      
 54 
     | 
    
         
            +
                  #   as specified.
         
     | 
| 
      
 55 
     | 
    
         
            +
                  # - Submitted - indicates that your order has been accepted at the order
         
     | 
| 
      
 56 
     | 
    
         
            +
                  #   destination and is working.
         
     | 
| 
      
 57 
     | 
    
         
            +
                  # - Cancelled - indicates that the balance of your order has been
         
     | 
| 
      
 58 
     | 
    
         
            +
                  #   confirmed canceled by the IB system. This could occur unexpectedly
         
     | 
| 
      
 59 
     | 
    
         
            +
                  #   when IB or the destination has rejected your order.
         
     | 
| 
      
 60 
     | 
    
         
            +
                  # - ApiCancelled - canceled via API
         
     | 
| 
      
 61 
     | 
    
         
            +
                  # - Filled - indicates that the order has been completely filled.
         
     | 
| 
      
 62 
     | 
    
         
            +
                  # - Inactive - indicates that the order has been accepted by the system
         
     | 
| 
      
 63 
     | 
    
         
            +
                  #   (simulated orders) or an exchange (native orders) but that currently
         
     | 
| 
      
 64 
     | 
    
         
            +
                  #   the order is inactive due to system, exchange or other issues.
         
     | 
| 
      
 65 
     | 
    
         
            +
                  #   
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  validates_format_of :status, :without => /\A\z/, :message => 'must not be empty'
         
     | 
| 
      
 68 
     | 
    
         
            +
                validates_numericality_of :price, :average_price, :allow_nil => true
         
     | 
| 
      
 69 
     | 
    
         
            +
                validates_numericality_of :local_id, :perm_id, :client_id, :parent_id, :filled,
         
     | 
| 
      
 70 
     | 
    
         
            +
                  :remaining, :only_integer => true, :allow_nil => true
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                def self.valid_status? the_message
         
     | 
| 
      
 73 
     | 
    
         
            +
                  valid_stati =  %w( ApiCancelled PreSubmitted PendingCancel Cancelled Submitted Filled
         
     | 
| 
      
 74 
     | 
    
         
            +
            			 Inactive PendingSubmit Unknown ApiPending)
         
     | 
| 
      
 75 
     | 
    
         
            +
            	   valid_stati.include?( the_message )
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
              
         
     | 
| 
      
 78 
     | 
    
         
            +
                ## Testing Order state:
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                def new?
         
     | 
| 
      
 81 
     | 
    
         
            +
                  status.empty? || status == 'New'
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                # Order is in a valid, working state on TWS side
         
     | 
| 
      
 85 
     | 
    
         
            +
                def submitted?
         
     | 
| 
      
 86 
     | 
    
         
            +
                  status =~ /Submit/
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                # Order is in a valid, working state on TWS side
         
     | 
| 
      
 90 
     | 
    
         
            +
                def pending?
         
     | 
| 
      
 91 
     | 
    
         
            +
                  submitted? || status =~ /Pending/
         
     | 
| 
      
 92 
     | 
    
         
            +
                end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                # Order is in invalid state
         
     | 
| 
      
 95 
     | 
    
         
            +
                def inactive?
         
     | 
| 
      
 96 
     | 
    
         
            +
                  new? || pending? || status =~ /Cancel/
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                def active?
         
     | 
| 
      
 100 
     | 
    
         
            +
                  !inactive? # status == 'Inactive'
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                def complete_fill?
         
     | 
| 
      
 104 
     | 
    
         
            +
                  status == 'Filled' && remaining == 0 # filled >= total_quantity # Manually corrected
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                # Comparison
         
     | 
| 
      
 108 
     | 
    
         
            +
                def == other
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                  super(other) ||
         
     | 
| 
      
 111 
     | 
    
         
            +
                    other.is_a?(self.class) &&
         
     | 
| 
      
 112 
     | 
    
         
            +
                    status == other.status &&
         
     | 
| 
      
 113 
     | 
    
         
            +
                    local_id == other.local_id &&
         
     | 
| 
      
 114 
     | 
    
         
            +
                    perm_id == other.perm_id &&
         
     | 
| 
      
 115 
     | 
    
         
            +
                    client_id == other.client_id &&
         
     | 
| 
      
 116 
     | 
    
         
            +
                    filled == other.filled &&
         
     | 
| 
      
 117 
     | 
    
         
            +
                    remaining == other.remaining &&
         
     | 
| 
      
 118 
     | 
    
         
            +
                    last_fill_price == other.last_fill_price &&
         
     | 
| 
      
 119 
     | 
    
         
            +
                    init_margin == other.init_margin &&
         
     | 
| 
      
 120 
     | 
    
         
            +
                    maint_margin == other.maint_margin &&
         
     | 
| 
      
 121 
     | 
    
         
            +
                    equity_with_loan == other.equity_with_loan &&
         
     | 
| 
      
 122 
     | 
    
         
            +
                    why_held == other.why_held &&
         
     | 
| 
      
 123 
     | 
    
         
            +
                    warning_text == other.warning_text &&
         
     | 
| 
      
 124 
     | 
    
         
            +
                    commission == other.commission
         
     | 
| 
      
 125 
     | 
    
         
            +
                end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                def to_human
         
     | 
| 
      
 128 
     | 
    
         
            +
                  "<OrderState: #{status} ##{local_id}/#{perm_id} from #{client_id}" +
         
     | 
| 
      
 129 
     | 
    
         
            +
                    (filled ? " filled #{filled}/#{remaining}" : '') +
         
     | 
| 
      
 130 
     | 
    
         
            +
                    (last_fill_price ? " at #{last_fill_price}/#{average_fill_price}" : '') +
         
     | 
| 
      
 131 
     | 
    
         
            +
                    (init_margin ? " margin #{init_margin}/#{maint_margin}" : '') +
         
     | 
| 
      
 132 
     | 
    
         
            +
                    (equity_with_loan ? " equity #{equity_with_loan}" : '') +
         
     | 
| 
      
 133 
     | 
    
         
            +
                    (commission && commission > 0 ? " fee #{commission}" : "") +
         
     | 
| 
      
 134 
     | 
    
         
            +
                    (why_held ? " why_held #{why_held}" : '') +
         
     | 
| 
      
 135 
     | 
    
         
            +
                    ((warning_text && warning_text != '') ? " warning #{warning_text}" : '') + ">"
         
     | 
| 
      
 136 
     | 
    
         
            +
                end
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
                alias to_s to_human
         
     | 
| 
      
 139 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 140 
     | 
    
         
            +
            If an Order is submitted with the :what_if-Flag set, commission and margin are returned 
         
     | 
| 
      
 141 
     | 
    
         
            +
            via the order_state-Object.
         
     | 
| 
      
 142 
     | 
    
         
            +
            =end
         
     | 
| 
      
 143 
     | 
    
         
            +
            		def forcast
         
     | 
| 
      
 144 
     | 
    
         
            +
            			{ :init_margin => init_margin, 
         
     | 
| 
      
 145 
     | 
    
         
            +
            				:maint_margin => maint_margin,
         
     | 
| 
      
 146 
     | 
    
         
            +
            				:equity_with_loan => equity_with_loan ,
         
     | 
| 
      
 147 
     | 
    
         
            +
            			  :commission => commission, 
         
     | 
| 
      
 148 
     | 
    
         
            +
            				:commission_currency=> commission_currency,
         
     | 
| 
      
 149 
     | 
    
         
            +
            				:warning => warning_text }
         
     | 
| 
      
 150 
     | 
    
         
            +
            		end
         
     | 
| 
      
 151 
     | 
    
         
            +
              end # class Order
         
     | 
| 
      
 152 
     | 
    
         
            +
            end # module IB
         
     | 
| 
         @@ -0,0 +1,64 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module IB
         
     | 
| 
      
 2 
     | 
    
         
            +
            class PortfolioValue < IB::Model
         
     | 
| 
      
 3 
     | 
    
         
            +
                include BaseProperties
         
     | 
| 
      
 4 
     | 
    
         
            +
            #	belongs_to :currency
         
     | 
| 
      
 5 
     | 
    
         
            +
            	belongs_to :account
         
     | 
| 
      
 6 
     | 
    
         
            +
            	belongs_to :contract
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            #	scope :single, ->(key) { where :schluessel => key } rescue nil
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                prop :position, 
         
     | 
| 
      
 11 
     | 
    
         
            +
            	:market_price, 
         
     | 
| 
      
 12 
     | 
    
         
            +
            	:market_value, 
         
     | 
| 
      
 13 
     | 
    
         
            +
            	:average_cost, 
         
     | 
| 
      
 14 
     | 
    
         
            +
            	:unrealized_pnl, 
         
     | 
| 
      
 15 
     | 
    
         
            +
            	:realized_pnl
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                # Order comparison
         
     | 
| 
      
 19 
     | 
    
         
            +
                def == other
         
     | 
| 
      
 20 
     | 
    
         
            +
                  super(other) ||
         
     | 
| 
      
 21 
     | 
    
         
            +
                    other.is_a?(self.class) &&
         
     | 
| 
      
 22 
     | 
    
         
            +
                    market_price == other.market_price &&
         
     | 
| 
      
 23 
     | 
    
         
            +
                    average_cost == other.average_cost &&
         
     | 
| 
      
 24 
     | 
    
         
            +
                    position == other.position &&
         
     | 
| 
      
 25 
     | 
    
         
            +
            	unrealized_pnl == other.unrealized_pnl  &&
         
     | 
| 
      
 26 
     | 
    
         
            +
            	realized_pnl == other.realized_pnl &&
         
     | 
| 
      
 27 
     | 
    
         
            +
                    contract == other.contract
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
                def to_human
         
     | 
| 
      
 30 
     | 
    
         
            +
            			the_account = if account.present? 
         
     | 
| 
      
 31 
     | 
    
         
            +
            											if account.is_a?(String)
         
     | 
| 
      
 32 
     | 
    
         
            +
            												account + " "
         
     | 
| 
      
 33 
     | 
    
         
            +
            											else
         
     | 
| 
      
 34 
     | 
    
         
            +
            												account.account+" "
         
     | 
| 
      
 35 
     | 
    
         
            +
            											end
         
     | 
| 
      
 36 
     | 
    
         
            +
            										else 
         
     | 
| 
      
 37 
     | 
    
         
            +
            											""
         
     | 
| 
      
 38 
     | 
    
         
            +
            										end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            			"<PortfolioValue: "+
         
     | 
| 
      
 41 
     | 
    
         
            +
            		  the_account  +
         
     | 
| 
      
 42 
     | 
    
         
            +
                  "Pos=#{ position.to_i } @ #{market_price.to_f.round(3)};" +
         
     | 
| 
      
 43 
     | 
    
         
            +
                  "Value=#{market_value.to_f.round(2)};PNL=" + 
         
     | 
| 
      
 44 
     | 
    
         
            +
            			( unrealized_pnl.to_i.zero? ? "": "#{unrealized_pnl} unrealized;") +
         
     | 
| 
      
 45 
     | 
    
         
            +
                  ( realized_pnl.to_i.zero? ? "" : "#{realized_pnl} realized;>" ) + 
         
     | 
| 
      
 46 
     | 
    
         
            +
            			contract.to_human
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
                alias to_s to_human
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            #	def to_invest
         
     | 
| 
      
 52 
     | 
    
         
            +
            #		a=attributes
         
     | 
| 
      
 53 
     | 
    
         
            +
            #		a.delete "created_at"
         
     | 
| 
      
 54 
     | 
    
         
            +
            #		a.delete "updated_at"
         
     | 
| 
      
 55 
     | 
    
         
            +
            #		a.delete "id"
         
     | 
| 
      
 56 
     | 
    
         
            +
            #		a.delete "account_id"
         
     | 
| 
      
 57 
     | 
    
         
            +
            #		a.delete "currency_id"
         
     | 
| 
      
 58 
     | 
    
         
            +
            #		a[:currency] = currency.symbol.presence || currency.name.presence  || nil   unless currency.nil?
         
     | 
| 
      
 59 
     | 
    
         
            +
            #		a  #return_value
         
     | 
| 
      
 60 
     | 
    
         
            +
            #
         
     | 
| 
      
 61 
     | 
    
         
            +
            #
         
     | 
| 
      
 62 
     | 
    
         
            +
            #	end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end # class
         
     | 
| 
      
 64 
     | 
    
         
            +
            end # module
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'contract'
         
     | 
| 
      
 2 
     | 
    
         
            +
            module IB
         
     | 
| 
      
 3 
     | 
    
         
            +
            	class Stock < IB::Contract
         
     | 
| 
      
 4 
     | 
    
         
            +
            		validates_format_of :sec_type, :with => /\Astock\z/,
         
     | 
| 
      
 5 
     | 
    
         
            +
            			:message => "should be a Stock"
         
     | 
| 
      
 6 
     | 
    
         
            +
            		def default_attributes
         
     | 
| 
      
 7 
     | 
    
         
            +
            			super.merge :sec_type => :stock, currency:'USD', exchange:'SMART'
         
     | 
| 
      
 8 
     | 
    
         
            +
            		end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            		def to_human
         
     | 
| 
      
 11 
     | 
    
         
            +
            			att =  [ symbol, currency, ( exchange == 'SMART' ? nil: exchange ), (primary_exchange.present? && !primary_exchange.empty? ? primary_exchange : nil)].compact
         
     | 
| 
      
 12 
     | 
    
         
            +
            						"<Stock: " + att.join(" ") + ">"
         
     | 
| 
      
 13 
     | 
    
         
            +
            		end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            	end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module IB
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              # Calculated characteristics of underlying Contract (volatile)
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Underlying < IB::Model
         
     | 
| 
      
 5 
     | 
    
         
            +
                include BaseProperties
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                has_one :contract
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                prop :con_id, # Id of the Underlying Contract
         
     | 
| 
      
 10 
     | 
    
         
            +
                  :delta, # double: The underlying stock or future delta.
         
     | 
| 
      
 11 
     | 
    
         
            +
                  :price #  double: The price of the underlying.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  validates_numericality_of :con_id, :delta, :price #, :allow_nil => true
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def default_attributes
         
     | 
| 
      
 16 
     | 
    
         
            +
                  super.merge :con_id => 0
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                # Serialize under_comp parameters
         
     | 
| 
      
 20 
     | 
    
         
            +
                def serialize
         
     | 
| 
      
 21 
     | 
    
         
            +
                  [true, con_id, delta, price]
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                # Comparison
         
     | 
| 
      
 25 
     | 
    
         
            +
                def == other
         
     | 
| 
      
 26 
     | 
    
         
            +
                  super(other) ||
         
     | 
| 
      
 27 
     | 
    
         
            +
                    other.is_a?(self.class) &&
         
     | 
| 
      
 28 
     | 
    
         
            +
                    con_id == other.con_id && delta == other.delta && price == other.price
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              end # class Underlying
         
     | 
| 
      
 32 
     | 
    
         
            +
              UnderComp = Underlying
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            end # module IB
         
     | 
| 
         @@ -0,0 +1,96 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'contract'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module IB
         
     | 
| 
      
 5 
     | 
    
         
            +
            	class Vertical <   Spread
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 8 
     | 
    
         
            +
            Macro-Class to simplify the definition of Vertical-Spreads
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Initialize with
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            	calendar =  IB::Vertical.new underlying: Symbols::Index.stoxx,
         
     | 
| 
      
 13 
     | 
    
         
            +
            															 buy: 3000, sell: 2900,  right: :put
         
     | 
| 
      
 14 
     | 
    
         
            +
            															 expiry: 201901, back: 291903
         
     | 
| 
      
 15 
     | 
    
         
            +
            	or
         
     | 
| 
      
 16 
     | 
    
         
            +
             
         
     | 
| 
      
 17 
     | 
    
         
            +
            	master = IB::Option.new symbol: :Estx50, right: :put, multiplier: 10, exchange: 'DTB', currency: 'EUR'
         
     | 
| 
      
 18 
     | 
    
         
            +
            													strike: 3000, expiry: 201812
         
     | 
| 
      
 19 
     | 
    
         
            +
            	calendar =  IB::Vertical.new sell: master, buy: 3100
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            =end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            		
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            		def initialize  master=nil,   # provides strike, front-month, right, trading-class
         
     | 
| 
      
 26 
     | 
    
         
            +
            										underlying: nil, 
         
     | 
| 
      
 27 
     | 
    
         
            +
            										right: :put,
         
     | 
| 
      
 28 
     | 
    
         
            +
            										expiry: IB::Symbols::Futures.next_expiry, 
         
     | 
| 
      
 29 
     | 
    
         
            +
            										buy: 0 ,   # has to be specified
         
     | 
| 
      
 30 
     | 
    
         
            +
            										sell: 0,
         
     | 
| 
      
 31 
     | 
    
         
            +
            							#			trading_class: nil,
         
     | 
| 
      
 32 
     | 
    
         
            +
            										**args  # trading-class and others
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            			master_option, side, msg = if master.present? 
         
     | 
| 
      
 35 
     | 
    
         
            +
            															if master.is_a?(IB::Option) 
         
     | 
| 
      
 36 
     | 
    
         
            +
            																[ master.essential,-1, nil ]
         
     | 
| 
      
 37 
     | 
    
         
            +
            															else
         
     | 
| 
      
 38 
     | 
    
         
            +
            																[ nil, 0,"First Argument is no IB::Option" ]
         
     | 
| 
      
 39 
     | 
    
         
            +
            															end
         
     | 
| 
      
 40 
     | 
    
         
            +
            														elsif  buy.is_a?(IB::Option) && !sell.zero?  
         
     | 
| 
      
 41 
     | 
    
         
            +
            															 [ buy.essentail,1, nil ]
         
     | 
| 
      
 42 
     | 
    
         
            +
            														elsif  sell.is_a?(IB::Option) && !buy.zero? 
         
     | 
| 
      
 43 
     | 
    
         
            +
            															 [ sell.essential, -1, nil  ]
         
     | 
| 
      
 44 
     | 
    
         
            +
            														elsif	underlying.present?
         
     | 
| 
      
 45 
     | 
    
         
            +
            															if underlying.is_a?(IB::Contract)
         
     | 
| 
      
 46 
     | 
    
         
            +
            																master = IB::Option.new underlying.attributes.slice( :currency, :symbol, :exchange ).merge(args) 
         
     | 
| 
      
 47 
     | 
    
         
            +
            																master.sec_type = 'FOP' if underlying.is_a?(IB::Future)
         
     | 
| 
      
 48 
     | 
    
         
            +
            																master.strike, master.expiry, master.right = buy, expiry, right
         
     | 
| 
      
 49 
     | 
    
         
            +
            																[master, 1, buy.to_i >0 && sell.to_i >0 ? nil : "buy and sell strikes have to be specified"]
         
     | 
| 
      
 50 
     | 
    
         
            +
            															else
         
     | 
| 
      
 51 
     | 
    
         
            +
            																[nil, 0, "Underlying has to be an IB::Contract"]
         
     | 
| 
      
 52 
     | 
    
         
            +
            															end
         
     | 
| 
      
 53 
     | 
    
         
            +
            														else
         
     | 
| 
      
 54 
     | 
    
         
            +
            															[ nil, 0,  "Required parameters: Master-Option or Underlying, buy and sell-strikes" ]  
         
     | 
| 
      
 55 
     | 
    
         
            +
            														end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            			error msg, :args, nil  if msg.present?
         
     | 
| 
      
 58 
     | 
    
         
            +
            			master_option.trading_class = args[:trading_class] if args[:trading_class].present?
         
     | 
| 
      
 59 
     | 
    
         
            +
            			l=[] ; master_option.verify{|x| x.contract_detail = nil; l << x }
         
     | 
| 
      
 60 
     | 
    
         
            +
            			if l.empty?
         
     | 
| 
      
 61 
     | 
    
         
            +
            				error "Invalid Parameters. No Contract found #{master_option.to_human}"
         
     | 
| 
      
 62 
     | 
    
         
            +
            			elsif l.size > 2
         
     | 
| 
      
 63 
     | 
    
         
            +
            				Connection.logger.error "ambigous contract-specification: #{l.map(&:to_human).join(';')}"
         
     | 
| 
      
 64 
     | 
    
         
            +
            				available_trading_classes = l.map( &:trading_class ).uniq
         
     | 
| 
      
 65 
     | 
    
         
            +
            				if available_trading_classes.size >1
         
     | 
| 
      
 66 
     | 
    
         
            +
            					error "Refine Specification with trading_class: #{available_trading_classes.join('; ')}  (details in log)"
         
     | 
| 
      
 67 
     | 
    
         
            +
            				else
         
     | 
| 
      
 68 
     | 
    
         
            +
            					error "Respecify expiry, verification reveals #{l.size} contracts  (only 2 are allowed) #{master_option.to_human}"
         
     | 
| 
      
 69 
     | 
    
         
            +
            				end
         
     | 
| 
      
 70 
     | 
    
         
            +
            			end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            			master_option.strike =  side ==1 ?  sell : buy
         
     | 
| 
      
 73 
     | 
    
         
            +
            			master_option.verify{|x| x.contract_detail =  nil; l << x }
         
     | 
| 
      
 74 
     | 
    
         
            +
            			error "Two legs are required, \n Verifiying the master-option exposed #{l.size} legs" unless l.size ==2
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            			master_option.exchange ||= l.first.exchange
         
     | 
| 
      
 77 
     | 
    
         
            +
            			master_option.currency ||= l.first.currency
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            			# i=0 + side = -1 --> -1   sell
         
     | 
| 
      
 80 
     | 
    
         
            +
            			# i=0 + side =  1 -->  1   buy
         
     | 
| 
      
 81 
     | 
    
         
            +
            			# i=1 + side = -1 -->  0   buy
         
     | 
| 
      
 82 
     | 
    
         
            +
            			# i.1 + side =  1 -->  2   sell
         
     | 
| 
      
 83 
     | 
    
         
            +
            			c_l = l.map.with_index{ |l,i| ComboLeg.new con_id: l.con_id, action: i+side ==2 || i+side <0  ? :sell : :buy , exchange: l.exchange, ratio:  1 }
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            			super  exchange: master_option.exchange, 
         
     | 
| 
      
 86 
     | 
    
         
            +
            							 symbol: master_option.symbol.to_s,
         
     | 
| 
      
 87 
     | 
    
         
            +
            						 currency: master_option.currency,
         
     | 
| 
      
 88 
     | 
    
         
            +
            						 legs: l,
         
     | 
| 
      
 89 
     | 
    
         
            +
            						 combo_legs: c_l
         
     | 
| 
      
 90 
     | 
    
         
            +
            		end
         
     | 
| 
      
 91 
     | 
    
         
            +
            		def to_human
         
     | 
| 
      
 92 
     | 
    
         
            +
            			x= [ combo_legs.map(&:weight) , legs.map( &:strike )].transpose
         
     | 
| 
      
 93 
     | 
    
         
            +
            			 "<Vertical #{symbol} #{legs.first.right}(#{x.map{|w,strike| "#{w} :#{strike} "}.join( '|+|' )} )[#{Date.parse(legs.first.last_trading_day).strftime("%b %Y")}]>"
         
     | 
| 
      
 94 
     | 
    
         
            +
            		end
         
     | 
| 
      
 95 
     | 
    
         
            +
            	end
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/requires.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,203 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: ib-api
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: '972.0'
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Hartmut Bischoff
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-10-22 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.17'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.17'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: activemodel
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: Ruby Implementation of the Interactive Brokers TWS API
         
     | 
| 
      
 84 
     | 
    
         
            +
            email:
         
     | 
| 
      
 85 
     | 
    
         
            +
            - topofocus@gmail.com
         
     | 
| 
      
 86 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 87 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 88 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            files:
         
     | 
| 
      
 90 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 91 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 92 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 93 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 94 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 95 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
      
 96 
     | 
    
         
            +
            - Guardfile
         
     | 
| 
      
 97 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 98 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 99 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 100 
     | 
    
         
            +
            - VERSION
         
     | 
| 
      
 101 
     | 
    
         
            +
            - api.gemspec
         
     | 
| 
      
 102 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 103 
     | 
    
         
            +
            - bin/console.yml
         
     | 
| 
      
 104 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 105 
     | 
    
         
            +
            - changelog.md
         
     | 
| 
      
 106 
     | 
    
         
            +
            - example/README.md
         
     | 
| 
      
 107 
     | 
    
         
            +
            - example/account_info
         
     | 
| 
      
 108 
     | 
    
         
            +
            - example/account_positions
         
     | 
| 
      
 109 
     | 
    
         
            +
            - example/account_summary
         
     | 
| 
      
 110 
     | 
    
         
            +
            - example/cancel_orders
         
     | 
| 
      
 111 
     | 
    
         
            +
            - example/fa_accounts
         
     | 
| 
      
 112 
     | 
    
         
            +
            - example/fundamental_data
         
     | 
| 
      
 113 
     | 
    
         
            +
            - example/historic_data_cli
         
     | 
| 
      
 114 
     | 
    
         
            +
            - example/list_orders
         
     | 
| 
      
 115 
     | 
    
         
            +
            - example/portfolio_csv
         
     | 
| 
      
 116 
     | 
    
         
            +
            - example/scanner_data
         
     | 
| 
      
 117 
     | 
    
         
            +
            - example/template
         
     | 
| 
      
 118 
     | 
    
         
            +
            - example/tick_data
         
     | 
| 
      
 119 
     | 
    
         
            +
            - lib/extensions/class-extensions.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib/ib-api.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib/ib/base.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/ib/base_properties.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/ib/connection.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/ib/constants.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/ib/errors.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/ib/logger.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/ib/messages.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/ib/messages/abstract_message.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/ib/messages/incoming.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/ib/messages/incoming/abstract_message.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/ib/messages/incoming/account_value.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/ib/messages/incoming/alert.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/ib/messages/incoming/contract_data.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/ib/messages/incoming/delta_neutral_validation.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/ib/messages/incoming/execution_data.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - lib/ib/messages/incoming/historical_data.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            - lib/ib/messages/incoming/market_depths.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - lib/ib/messages/incoming/next_valid_id.rb
         
     | 
| 
      
 139 
     | 
    
         
            +
            - lib/ib/messages/incoming/open_order.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - lib/ib/messages/incoming/order_status.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - lib/ib/messages/incoming/portfolio_value.rb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - lib/ib/messages/incoming/real_time_bar.rb
         
     | 
| 
      
 143 
     | 
    
         
            +
            - lib/ib/messages/incoming/scanner_data.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - lib/ib/messages/incoming/ticks.rb
         
     | 
| 
      
 145 
     | 
    
         
            +
            - lib/ib/messages/outgoing.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - lib/ib/messages/outgoing/abstract_message.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - lib/ib/messages/outgoing/account_requests.rb
         
     | 
| 
      
 148 
     | 
    
         
            +
            - lib/ib/messages/outgoing/bar_requests.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - lib/ib/messages/outgoing/place_order.rb
         
     | 
| 
      
 150 
     | 
    
         
            +
            - lib/ib/messages/outgoing/request_marketdata.rb
         
     | 
| 
      
 151 
     | 
    
         
            +
            - lib/ib/messages/outgoing/request_tick_data.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - lib/ib/model.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib/ib/models.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/ib/server_versions.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - lib/ib/socket.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/ib/support.rb
         
     | 
| 
      
 157 
     | 
    
         
            +
            - lib/ib/version.rb
         
     | 
| 
      
 158 
     | 
    
         
            +
            - lib/models/ib/account.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            - lib/models/ib/account_value.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            - lib/models/ib/bag.rb
         
     | 
| 
      
 161 
     | 
    
         
            +
            - lib/models/ib/bar.rb
         
     | 
| 
      
 162 
     | 
    
         
            +
            - lib/models/ib/combo_leg.rb
         
     | 
| 
      
 163 
     | 
    
         
            +
            - lib/models/ib/condition.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - lib/models/ib/contract.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - lib/models/ib/contract_detail.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - lib/models/ib/execution.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - lib/models/ib/forex.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - lib/models/ib/future.rb
         
     | 
| 
      
 169 
     | 
    
         
            +
            - lib/models/ib/index.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - lib/models/ib/option.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - lib/models/ib/option_detail.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib/models/ib/order.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            - lib/models/ib/order_state.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - lib/models/ib/portfolio_value.rb
         
     | 
| 
      
 175 
     | 
    
         
            +
            - lib/models/ib/stock.rb
         
     | 
| 
      
 176 
     | 
    
         
            +
            - lib/models/ib/underlying.rb
         
     | 
| 
      
 177 
     | 
    
         
            +
            - lib/models/ib/vertical.rb
         
     | 
| 
      
 178 
     | 
    
         
            +
            - lib/requires.rb
         
     | 
| 
      
 179 
     | 
    
         
            +
            homepage: https://github.com/ib-ruby
         
     | 
| 
      
 180 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 181 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 182 
     | 
    
         
            +
              homepage_uri: https://github.com/ib-ruby
         
     | 
| 
      
 183 
     | 
    
         
            +
              source_code_uri: https://github.com/ib-ruby/ib-api
         
     | 
| 
      
 184 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 185 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 186 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 187 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 188 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 189 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 190 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 191 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 192 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 193 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 194 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 195 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 196 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 197 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 198 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 199 
     | 
    
         
            +
            rubygems_version: 3.0.4
         
     | 
| 
      
 200 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 201 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 202 
     | 
    
         
            +
            summary: Ruby Implementation of the Interactive Brokers TWS API
         
     | 
| 
      
 203 
     | 
    
         
            +
            test_files: []
         
     |