Commit Graph

50 Commits

Author SHA1 Message Date
Stefano Raggi 9d3c1df5f3 Fix execution models to handle partially filled orders 2019-05-24 11:50:31 +02:00
Jared a0abd00fb2 Update SecurityTransactionManager.cs 2019-03-27 17:06:08 -07:00
AlexCatarino d7073f2f88 Adds Parameterless Overload to SecurityTransactionManager.CancelOpenOrders() 2019-03-22 22:35:42 +00:00
Martin Molinero 866dd4c7db Making TransactionRecord thread safe
- `SecurityTransactionManager.TransactionRecord` will now be thread safe.
`SecurityTransactionManager` will internally wrap usage of `TransactionRecord` with
a lock.
2018-12-10 16:28:46 -03:00
Martin Molinero 82c2532a31 Improve performance for backtests with a large amount of trades 2018-06-21 16:59:29 -03:00
Stefano Raggi b275b6d934 Add CashBuyingPowerModel with tests 2018-02-12 17:38:10 +01:00
Michael 99327d106c Merge pull request #1506 from QuantConnect/refactor-margin-models
Refactor margin model interface
2018-02-02 11:31:00 -05:00
Stefano Raggi 66b265d890 Move GetSufficientCapitalForOrder to SecurityMarginModel.CanExecuteOrder 2018-01-31 11:47:33 +01:00
Michael Handschuh 0af36e1797 Add tag to SecurityTransactionManager.CancelOpenOrders
When bulk canceling orders for a particular symbol it's nice to tag the order so we
know why they were all canceled.
2018-01-23 13:49:12 -05:00
Stefano Raggi 013edbcbcb Reuse existing OrderResponseErrorCode.AlgorithmWarmingUp 2018-01-15 23:01:17 +01:00
Stefano Raggi 89a59351cd Add OnWarmupFinished method to QCAlgorithm
This method is being added to allow algorithms to complete initialization tasks that cannot be executed during Initialize, such as cancelling existing open orders in live trading.
This method will be called only once, when the warmup task is complete.

Closes #1043
2018-01-15 13:46:30 +01:00
oswaldozapata 551fab193d Issue #824, adding space after comma 2017-04-25 21:41:24 -04:00
oswaldozapata e3ae31258b Now when Liquidating, the tag field on the trade list will show as "Liquidated" to indicate that this was due to a Liquidate() call. 2017-04-24 00:41:39 -04:00
quant1729 c416df6241 Refactored option assignment/exercise:
1. Made sure we treat properly option expiration dates before Feb 2015 and after. Added tests.
2. Refactored expiration delisting, assignments/option exercise to happen in the end of the date, not MOC orders in the beginning of the day. Regression test.
3. Refactored option exercise model to generate proper fills on assignments/option. Those fills are reflected correctly in margins, in stats and correspond to IB model. Still need to run IB real-life live tests.
4. Refactored option symbol related functions into separate module (OptionSymbol.cs)
5. Made sure OnAssignmentEvent arrived to the user algo in regression test. Do we need OnExercise event? Not sure.
6. Tested end-to-end Ray's current code (covered call strat) to see short option legs expire worthless, and stats updated.
2017-02-02 19:35:37 +08:00
AlexCatarino fcd603a0e2 Remove buying power check when reducing position size
Checks whether a new order reduces a position size, if so do not consider the mechanics to verify sufficient capital for order.
2016-07-12 19:06:00 -03:00
Michael Handschuh a3930c996d Fixes blocking bug in WaitForOrder 2016-01-20 19:28:39 -05:00
Stefano Raggi 7171deb99e Increased market order fill timeout to 5 seconds
It is now configurable via SecurityTransactionManager.MarketOrderFillTimeout property
2016-01-06 14:48:09 +01:00
Stefano Raggi 2a752f84df SecurityTransactionManager.GetOrderTicket - Faster implementation 2016-01-04 21:55:55 -05:00
Stefano Raggi 2a2b710b52 Fixed SecurityTransactionManager.GetOpenOrders
Also added GetOpenOrders(Symbol) overload
2015-12-30 18:21:06 +01:00
snugs 5c16f7f48f Prevent div zero exception GetSufficientCapitalForOrder 2015-12-30 00:02:39 -05:00
snugs 452e83116d Fixes bug computing margin required with partial fills
Sadly this added OrderTicket dependencies to GetSufficientCapitalForOrder
2015-12-21 22:41:21 -05:00
snugs d5987c05cd Changes Order.BrokerId to List<string> 2015-12-18 15:51:29 -05:00
snugs e27e6911d1 Use BusyBlockingCollection in BrokerageTransactionHandler
This is to remove some possibilities for dead locks
2015-12-09 23:04:14 -05:00
Stefano Raggi 4558d085c6 Changed BrokerageId from int to long
IOrderProvider.GetOrderByBrokerageId now accepts a long value (as required by Oanda and Tradier brokerages)
2015-12-07 14:48:47 -05:00
snugs 4e5b65ed08 Adds EquitiesLabAlgorithm 2015-12-07 12:02:12 -05:00
QuantConnect 1cc7941721 Accepted partial fills for market orders to prevent backtest partial fills blocking transaction manager 2015-11-24 13:04:55 -05:00
snugs e1938baafe Clean up using directives 2015-09-01 22:17:35 -04:00
snugs ca69869088 Adds GetOrderTickets search function 2015-07-29 13:21:23 -04:00
snugs ce1ad81be7 FillForward bug fix and don't wait for non-market orders 2015-07-15 00:16:02 -04:00
snugs 28d8300e46 Fixes failing tests
Beefs up the UpdateOrderRegressionAlgorithm/updates statistics
Now using TimeKeeper/LocalTimeKeeper for dissemination of time to algo classes
2015-07-09 17:19:40 -04:00
snugs 704bfc2298 Adds new order ticket system
QCAlgorithm order functions now return an OrderTicket

OrderTicket can be used to directly update or cancel an order

Placing an order now submits an OrderRequest which is processed by the ITransactionHandler
2015-07-08 23:40:28 -04:00
snugs 9c1b0f4616 Move order/order queue storage to transaction handler
Expose order and order processing ability via IOrderProvider/IOrderProcessor
2015-07-02 15:07:35 -04:00
QuantConnect fde0cbed3a Strip out block quote section header comments 2015-06-13 16:04:27 -04:00
snugs 887faa24e7 Adds support for hourly/daily data to LEAN engine 2015-06-02 21:44:44 -04:00
snugs 6165c354e7 Initial implementation of TradierBrokerage
Adds new base test class for brokerages: BrokerageTests
2015-05-20 16:37:33 -04:00
snugs 89b6e98af8 Fixes warnings mostly relating to xml comments
Also cleans up some block comments

Via PR#72 - thanks @ammachado!
2015-05-13 10:56:47 -04:00
snugs 449150f71e Fixes SetHoldings when crossing zero line
Improves margin remaining computation as well
2015-05-05 21:07:03 -04:00
snugs 1f15eb2c04 Initial implementation of Margin and Portfolio models
Changed system to use Margin Models, removing leverage wherever possible allowing for dynamic margin models.
Created first portfolio fill model for FOREX which treats it as a currency swap through the cashbook instead of a tradable asset.
Updated the Securities/SecurityPortfolioManager to use cashbook value + holdings removing FOREX virtual positions.
Created a new benchmark system for comparing quantconnect builds.
2015-04-13 20:51:43 -04:00
snugs 52cf767882 Adds the IOrderIDMapping interface 2015-03-31 21:49:26 -04:00
snugs 1d4e81471a Fix log message 2015-03-31 21:40:51 -04:00
QuantConnect 669bda8e80 LastOrderId property, GetOpenOrders() method and bug fix #42 to handle decrease in position size case 2015-03-10 17:01:32 -05:00
QuantConnect ae60582d29 Updated comments 2015-03-08 22:23:06 -03:00
Baran Dilber 21f45ed578 Fixes bug in SecurityPortfolioManager GetBuyingPower() 2015-03-06 14:01:48 +02:00
QuantConnect 8546368b12 GetOrderBuyingPower leverage bug fix, thanks @bdilber 2015-02-28 21:46:05 -03:00
QuantConnect ae63a8bb78 Bug fix #36 order.Value and order fees factored for buying power 2015-02-27 14:18:48 -03:00
Baran Dilber 8e67ae9677 Modified GetOrderRequiredBuyingPower to use market price for market orders 2015-02-27 17:06:42 +02:00
QuantConnect 8b94703977 Added GetOrderById method to Transaction manager 2015-02-27 02:24:52 -03:00
QuantConnect bb15de6bf6 Rework Cancel Order method to use new order types 2015-02-25 15:45:31 -03:00
snugs 44706e8d57 Adds SecurityType to Order 2015-01-23 11:46:46 -03:00
Jared Broad b3de520915 Initial commit 2015-01-12 12:03:33 -03:00