Description Usage Arguments Details Value Note Author(s) References See Also
Function to manage all incoming messages from the TWS in a consistent manner.
This is used within the context of an event loop (often twsCALLBACK) and allows for custom processing by message type via the eWrapper argument.
1 | processMsg(curMsg, con, eWrapper, timestamp, file, twsconn, ...)
|
curMsg |
The current incoming message |
con |
a socket connection from a |
eWrapper |
a functional closure with methods for each message |
timestamp |
the timestamp format needed |
file |
the file or connection to write to |
twsconn |
the twsConnection object |
... |
additional arguments to internal calls |
This is used internally within the context of a larger infinite listener/loop.
The basic process involves one or more requests
to the TWS for data/action, followed by a call
to twsCALLBACK
. Inside of the CALLBACK
is a loop that fetches the incoming message type,
and calls processMsg
at each new message.
processMsg
internally is a series of
if-else statements that branch according to a known
incoming message type. The eWrapper
object
is a closure containing a data environment that
is static and a collection of callback
functions for each type of incoming data.
This eWrapper function can be defined at multiple points prior to the use within processMsg, to allow for access to data outside of the processMsg call, as well as facilitate custom handling in an efficient manner.
Called for its side-effects.
The entire mechanism (twsCALLBACK -> processMsg -> eWrapper) is modeled after the official API.
Jeffrey A. Ryan
Interactive Brokers: http://www.interactivebrokers.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.