module IB
TODO: Don't instantiate messages, use their classes as just namespace for .encode/decode TODO: realize Message#fire method that raises EWrapper events
All message classes related to ticks located here
TODO: Don't instantiate messages, use their classes as just namespace for .encode/decode
These modules are used to facilitate referencing of most popular IB
Contracts. For example, suppose you're explicitly creating such Contract
in all your scripts:
wfc = IB::Contract.new(:symbol => "WFC", :exchange => "NYSE", :currency => "USD", :sec_type => :stock, :description => "Wells Fargo Stock"),
Instead, you can put this contract definition into 'ib/symbols/stocks' and just reference it as IB::Symbols::Stock anywhere you need it.
Note that the :description field is local to ib-ruby, and is NOT part of the standard TWS API. It is never transmitted to IB
. It's purely used clientside, and you can store any arbitrary string that you may find useful there.
Sample bond contract definitions
The Futures module tries to guess the front month future using a crude algorithm that does not take into account expiry/rollover day. This will be valid most of the time, but near/after expiry day the next quarter's contract takes over as the volume leader.
Option
contracts definitions. TODO: add next_expiry and other convenience from Futures module.
Frequently used stock contracts definitions TODO: auto-request :ContractDetails from IB
if unknown symbol is requested?
Constants
- BAR_SIZES
Enumeration of bar size types for convenience.
Bar
sizes less than 30 seconds do not work for some securities.- CODES
Obtain property code from given symbolic value: CODES[:buy] -> 'B'
- DATA_TYPES
Enumeration of data types. Determines the nature of data being extracted. Valid values:
- EOL
Widely used TWS constants:
- FA_TYPES
Financial Advisor types (FaMsgTypeName)
- MARKET_DATA_TYPES
Received in new MarketDataType (58 incoming) message
- MARKET_DEPTH_OPERATIONS
Market depth messages contain these “operation” codes to tell you what to do with the data. See also www.interactivebrokers.com/php/apiUsersGuide/apiguide/java/updatemktdepth.htm
- MARKET_DEPTH_SIDES
- Model
Base
class for tablelessIB
data Models, extends ActiveModel API- ORDER_TYPES
- PROPS
Most common property processors
- SECURITY_TYPES
Valid security types (sec_type attribute of
IB::Contract
)- TICK_TYPES
Tick types as received in TickPrice and TickSize messages (enumeration)
- UnderComp
Calculated characteristics of underlying
Contract
(volatile)- VALUES
Obtain symbolic value from given property code: VALUES['B'] -> :buy
- VERSION