Commit Graph

258 Commits

Author SHA1 Message Date
Jared Broad 0f942149a0 Testing shuffling worker thread to algorithmSystemHandlers 2019-07-28 15:54:17 -07:00
Jared Broad 1e8fdba3d9 Revert to master 2019-07-28 14:32:04 -07:00
Jared Broad 66a3f2e1d2 Move worker thread creation to launcher before job creation 2019-07-28 12:54:17 -07:00
Martin Molinero c58b479578 Reduce shutdown time 2019-06-14 16:05:45 -03:00
Martin Molinero d360ec36ac Address reviews 2019-05-31 18:26:18 -03:00
Jared 2f46e708a1 Merge pull request #3184 from Martin-Molinero/refactor-3183-remove-backtestingtransactionhandler-thread
Removing BacktestingTransactionHandler thread
2019-05-17 07:22:24 -07:00
Martin Molinero f976ffa099 Removing BacktestingTransactionHandler thread
- For backtesting the algorithm thread will sequentially process pending
order requests
   - Adding new non blocking `BusyCollection`
- Updating `UpdateOrderRegressionAlgorithm` that suffered of a race
condition: it supposed `OnOrderEvent` would be called after the call to
`Transactions.AddOrder()` was finished
2019-05-10 16:15:24 -03:00
Martin Molinero 4382aa1886 Add algorithm thread
- Adding `WorkerThread` class, wrapper for a worker thread that will
execute given `Actions`.
    - Algorithm related code (`Construction`, `Initialization`,
    `Execution` will be executed by the same `WorkerThread` instance,
    this is required for `Python` debugging.
2019-05-09 11:23:28 -03:00
Stefano Raggi 513ef5d581 Fix DataManager live mode flag and failing unit tests 2019-04-29 15:26:50 +02:00
Stefano Raggi 9d930c170e Add new LiveSynchronizer + update live unit tests 2019-04-29 15:16:22 +02:00
Martin Molinero 6ee34ae13e Preinitialize static timezones 2019-04-15 13:10:14 -03:00
Martin Molinero 9865fe63e0 Improve initialization speed
- `Composer` will load `QuantConnect` assemblies and keep the `Types`
which is much faster than using previous wway of getting types that uses
reflexion.
- Adding static `MapFileProvider` improving calls to
`QuantConnect.commo.Symbol.Create` or `Addxxx` which created a new
instance every time
- `Engine.StackExceptionInterpreter` will be lazy initialized, since it
takes some time because it goes through all assemblies
- Moving `MarketHoursDataBase` initialization earlier and in a `Task`
since it takes some time.
2019-04-12 21:27:56 -03:00
Martin Molinero cfa08a11fb Address reviews
- Removing `using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm`
- Removing `QCAlgorithmFrameworkBridge`
- Removing `IsFrameworkAlgorithm`
- Making `EmitInsightBasedOnFill` private. Adding new
`IOrderEventProvider` exposing an `event` to which `QCAlgorithm` will
subscribe.
- `AccountType.Cash` algorithms will be allowed to manually trade and
emight insights manually or with alpha model.
2019-04-03 21:55:44 -03:00
Martin Molinero a26b3542bb Address reviews
- `ISetupHandler.Setup()` will now receive a parameters object
- Removing `SetupHandlerHelper` and adding new `BaseSetupHandler`
2018-12-19 16:15:28 -03:00
Martin Molinero af8e6bf85c Fix starting capital for non usd cash
- Moving `UniverseSelection.EnsureCurrencyDataFeeds` call into the
`IResultHandler` implementation through usage of the new `SetupHandlerHelper`
class, that will also set an initial conversion rate if none present.
- Adding regression test, that reproduces original issue
2018-12-19 16:15:28 -03:00
Stefano Raggi 704ca10734 Add IApi to HistoryProviderInitializeParameters 2018-11-26 17:56:17 +01:00
Martin Molinero 251071ee73 Remove Security from Subscription
- Removing unneeded `CashBook` instance to create a new `TimeSlice`
- Adding new `TimeSliceFactory`, an instance base class that will
provide methods to create a new `TimeSlice`. Will own the `DateTimeZone`
property.
- Adding new `ISecurityPrice` and `IOptionPrice` that will provide a
reduced interface for accessing price properties and methods used when
creating a new `TimeSlice`
2018-11-14 18:28:18 -03:00
Martin Molinero f1ecfd5784 Move DataManager in front of DataFeed
- Completly move `DataManager` in front of `DataFeed`. Specifically
`AddSubscription()` and `RemoveSubscription()` implementations. Also
removing IDataFeed.Subscriptions
2018-10-29 16:13:27 -03:00
Martin Molinero 9bdf702c41 Creating new Synchronizer - TimeSlice streamer
- Creating new `Synchronizer` which will consolidate and combine `TimeSlice`
streaming for both live and backtests modes. Will live in front of the
`DataManager`
- `SubscriptionSynchronizer` will be the `FrontierTimeProvider` exposed,
and owned, by the new `Synchronizer`
- Updating existing tests
2018-10-19 15:36:08 -03:00
Martin Molinero a288648929 Creating new ISecurityService
- Adding new ISecurityService and its implementation SecurityService.
Expose by SecurityManager.
This class will expose a method for creating new securities. The
SecurityManager is exposing this new interface, calling _securityService
internally, so Future/OptionUniverseSelectionModel.cs can use it
- Replacing all usages of SecurityManager.CreateSecurity for new
ISecurityService
- Modifying `Cash.cs` and `CashBook.cs` `EnsureCurrencyDataFeeds()` to
return newly added `SubscriptionDataConfig` instead of `Security`. This
will avoid using `Security.Subscriptions` at call site.
- Moving old SecurityManager.CreateSecurity into new
SecurityServiceTests.cs
2018-10-18 16:25:32 -03:00
Stefano Raggi dbaf109c78 Post-review updates
- Renamed events in SubscriptionDataReader and IHistoryProvider
- Added HistoryProvider base class with events and event invocators
2018-10-14 22:29:06 +02:00
Stefano Raggi 9fad26bc8f Add events to IHistoryProvider and SubscriptionDataReader
The SubscriptionDataReaderHistoryProvider was using StubResultHandler, so no error messages were being shown or logged. By adding events to IHistoryProvider and SubscriptionDataReader, the dependency on IResultHandler could be removed completely and error messages are now pushed up the stack.
2018-10-14 22:29:04 +02:00
Stefano Raggi 77b37f4dfd Update IHistoryProvider.Initialize to use HistoryProviderInitializeParameters
This is only a mechanical refactor for the updated IHistoryProvider.Initialize method in all IHistoryProvider implementations, call sites and unit tests.
2018-10-14 22:29:02 +02:00
Martin Molinero 2fcd366b1a Removing DF thread - LTDF bridge
- Removing LiveTradingDataFeed bridge. LTDF will yield return Slices
directly from the enumerator, as done in the FSDF. The objective is for
both to share the same logic here and for it to be extracted in a next
PR
- Removing now unnecessary DataFeed running thread
- Adding if (_isStopping) { break; } statement for BaseDataExchange.
This is to avoid the thread to continue looping over the enumerators when stopping. Impacts when there are many securities.
2018-10-09 14:04:41 -03:00
Martin Molinero d6f958b94a Rename to I...Service - Merge Create and Add 2018-09-28 14:48:21 -03:00
Martin Molinero 1c7e519776 Rebase from master - Refactor to reduce coupling
Refactoring previous commit so DataManager only keeps and receives a
reference to IAlgorithmSettigs, with the objective of reducing tight
coupling

Note: Investigate if IAlgorithmSettings.DataSubscriptionLimit should limit subscriptions or unique securities.
Today its using SubscriptionManagerSubscriptions.Where(x => !x.Symbol.IsCanonical()).DistinctBy(x => x.Symbol.Value).Count() @DataManager
2018-09-26 16:19:59 -03:00
Martin Molinero 94449149b9 DataManager receives UniverseSelection instance
DataManager will now receive UniverseSelection instance as a constructor
parameter. With the objective of avoiding tight coupling.
2018-09-26 10:00:10 -03:00
Martin Molinero 0a82d16829 DataManager wraps IDataFeed. DataManager owns UniverseSelection instance 2018-09-17 20:45:16 -03:00
Martin Molinero 953cc48997 Addressing reviews. Some renames and setting new interface IDataFeedSubscriptionManager for future work 2018-08-31 16:06:41 -03:00
Martin Molinero 41873b2315 Fixing unit tests 2018-08-31 16:06:41 -03:00
Martin Molinero a500fe010a Create DataManager class 2018-08-31 16:06:41 -03:00
Stefano Raggi a9fd981065 Fix missing stack trace for inner exceptions in Engine catch block 2018-08-24 21:08:52 +02:00
Stefano Raggi 189a2ded70 Add missing null check in Engine.Run 2018-08-22 14:21:34 +02:00
Stefano Raggi 36122f0829 Add OnAlgorithmStart/End methods to ILeanManager 2018-06-27 00:17:32 +02:00
Michael Handschuh f61c52c487 Only emit kps log in backtest mode 2018-04-30 16:22:56 -04:00
AlexCatarino 1cf26efa73 Applies exception interpreters to errors thrown in ISetupHandler.Setup
Change the logic in Engine.Run to interpret each exception thrown during initialization that is saved in ISetupHandler.Errors.
2018-03-15 22:12:48 +00:00
Michael Handschuh 6b239674e2 Renames Alpha -> Insight
The term 'alpha' is used to describe the entire algorithm. Therefore, 'alpha'
produces insights. From this we have things like IAlphaModel, which is the model
defining how insights are produced. We have IAlphaHandler, which defines how the
insights from a single 'alpha' (the algorithm) are managed, analyzed, and stored.
Types closer to the individual prediction level, such as InsightDirection, or
InsightScore relate directly to exactly 1 insight. The distinction between the
two became more clear as we developed the insights API, and from that effort it
was decided to harmonize alpha/insight terminology across the various QC systems.
2018-03-09 16:12:56 -05:00
Michael Handschuh 6c151993ea Format errors w/ header line and detail on following lines
We format the message before being set to the result handler's log message
method so it ends up being outputted as we wish. The desired output is a
header line with the collated message from the exception (including inners)
followed by the full exception detail (inner stack traces and all).
2018-03-02 16:16:46 -05:00
Michael Handschuh fa1ea521b1 Catch stragglers from recent rename, projection -> interpreter 2018-03-01 12:36:00 -05:00
Michael Handschuh 148ae5986a Rename projections -> interpreters 2018-03-01 12:36:00 -05:00
Michael Handschuh 985d53a662 Implement recursive exception projections
Often times exceptions are wrapped in other exceptions that are potentially
wrapped in other exceptions (ad. infinum) -- this lends itself to a recursive
strategy for projecting exception instances. This change aims to make exception
projections composable for easy consumption by a recursive algorithm by adding
an innerProjection parameter to IExceptionProject.Project. The individual impl
can decide whether or not it wants to project the inner exception. Additionally,
it can project it using custom logic or using the specified innerProjection, or
it could ignore it completely. The implementations have all the decision making
power.
2018-03-01 12:36:00 -05:00
Michael Handschuh c8f20b7756 Add IExceptionProjection infrastructure
Provides a sample implementation of IExceptionProjection that
prepends the scheduld event name to the error message

 #1630
2018-03-01 12:36:00 -05:00
Michael Handschuh 60fd7eb304 Refactor ISetupHandler.Errors to List<Exception>
This will prevent loss of information by translating the exception to a
string message too early
2018-02-27 22:17:46 -05:00
Michael Handschuh 84b1f9df80 Fix alpha handler config and log loaded handler at start 2017-12-28 11:27:40 -05:00
Michael Handschuh b4b3aae112 Rename Signal -> Alpha
Whoa... I think I got everything :)
2017-12-15 18:24:58 -05:00
Michael Handschuh 2bc7905ea2 Add signal count and signal asset breakdown charts
Modifies the way we sample charts to be more like the equity sampling that we do.
In this case, we compute a sampling period based off of 1000 samples for the entire
backtest. In live mode, we'll just sample each minute.
2017-12-15 16:01:09 -05:00
Michael Handschuh 5910bc620f Add ISignalHandler
Handles signals generated by the algorithm. The default implementation
sends a SignalPacket to the messaging handler.
2017-12-12 08:56:19 -05:00
Jared Broad aefdfcc411 Add the cashbook to the result packet 2017-10-23 17:00:28 -04:00
Andrew c582f7bc9a Add Dispose() method to IBrokerage
Currently only InteractiveBrokersBrokerage has a dispose method with custom logic for cleaning up resources.
2017-08-24 11:14:21 -04:00
Andrew d893bd7398 Renamed ILeanManagement to ILeanManager
Renamed this interface and all associated classes and content to be more
in line with Lean naming conventions.
2017-08-09 16:15:52 -04:00