qstrader
qstrader copied to clipboard
Ib portfolio
This was forked from https://github.com/mhallsmoore/qstrader/pull/186 which basically requires fixing Travis before being ready to merge.
The IBPortfolio should act like normal Portfolio, except for initialization:
Upon connection to IB, the positions held in the account should be streamed to QSTrader, and the IBPortfolio creates the necessary positions. A call to the PriceHandler is also made, which will subscribe to the current positions so we can update portfolio value correctly.
Note that handling of position changes (buying & selling) should not be handled directly by the IBPortfolio - that should be the responsibility of the IBExecutionHandler. The ExecutionHandler should subscribe to all OrderStatus() events from IB (i.e. fills, cancels), and convert them to the relevant QSTrader event, which are then given to the Portfolio to adjust positions.
I've also started some code to keep track of accounting information, which is stored as a big ugly multi-level map that comes from IB.
There also isn't much testing done in here yet.