Commit Graph

1000 Commits

Author SHA1 Message Date
AlexCatarino 34a271adac Updates pythonnet
In this update, we had compiled pythonnet with python 3.6 instead of 2.7 flags
2018-02-13 13:00:50 +00:00
AlexCatarino 654d6ad9ce Adds overloads with PyObject to Logging and Debug methods
We enable Logging and Debug methods to accept python objects to avoid the need of calling the str method.
Those objects are safely converted into string objects.
2018-02-09 00:48:44 +00:00
AlexCatarino 6827624f83 Adds RegisterIndicator overloads that takes python-defined indicators
Adds example for this feature
2018-02-07 12:31:18 +00:00
Jared 67d8ce2be4 Merge pull request #1535 from Jay-Jay-D/MacdMAType
MACD default MovingAverageType
2018-02-06 23:31:07 +00:00
Michael Handschuh 667fde4786 Fixes bug w/ data feed initial frontier when changing default tz
Changing the default time zone after SetStartDate is set ends up with the algorithm's
UtcTime being incorrect. This can lead to incorrect start times in the data feed as
well
2018-02-06 09:29:13 -05:00
Juan José D'Ambrosio e38b520383 MACD default MovingAverageType
this RP only adds the Obsolete property to the constructor and `MACD` method in the `QCAlgorithm.Indicators.cs` file
2018-02-05 18:11:10 -03:00
Jared d5e6245c5f Merge pull request #1513 from Jay-Jay-D/CoppockCurve
Coppock Curve indicator implementation
2018-02-05 17:40:56 +00: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 acb5db6cf5 Rename Security.MarginModel to BuyingPowerModel 2018-01-31 11:47:34 +01:00
Stefano Raggi 05e3420d05 Move logic in CalculateOrderQuantity to SecurityMarginModel 2018-01-31 11:47:33 +01:00
Juan José D'Ambrosio e7223da4a7 Coppock Curve indicator implementation 2018-01-30 12:05:13 -03:00
Michael Handschuh 2e421c78cc Add MarketOnCloseOrder.DefaultSubmissionTimeBuffer
This is the default time span before market close that we'll allow an MOC
order to be placed. Nominally set to 15 minutes + 30 second buffer for
processing/transport.
2018-01-23 13:34:53 -05:00
AlexCatarino 599c00be5b Historical Data Requests fetchs data from non-subscribed securities
It was not possible to add a security based on its historical data, since we needed to add the security before requesting its security data. Universe Selection algorithms are an example of such usage.
2018-01-16 18:08:28 +00:00
Jared 755a0f8ba7 Merge pull request #1475 from StefanoRaggi/symbol-null-comparison-fix
Fix bug in Symbol inequality operator
2018-01-15 17:15:26 -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
Stefano Raggi 1075571752 Replace Symbol.Empty checks with null checks 2018-01-12 21:56:10 +01:00
Jared 164bb80ba1 Merge pull request #1468 from AlexCatarino/lt-lotsize-msg
Adds OrderResponse error message for quantity less than lot size
2018-01-05 11:09:54 -05:00
Stefano Raggi 1db28b8358 Fix reserved chart names error in AddPlot
Fixes #1435
2018-01-04 23:59:43 +01:00
AlexCatarino 53ba7ee140 Adds OrderResponse error message for quantity less than lot size 2018-01-04 22:38:26 +00:00
Michael Handschuh 0cc6a53e9c Set correct time zone for custom data in MarketHoursDatabase
Add MarketHoursDatabase.SetEntry and SetEntryAlwaysOpen. This allows runtime modification of the
market hours database which is necessary for correct custom data time zone handling.

Extracts complicate ternary logic into its own method and make it human readable.
Set the market hours entry for custom data universe subscriptions defaulting to the security's time zone.
2018-01-04 12:36:57 -05:00
AlexCatarino 9459f47cba Updates pythonnet
In this update, methods overloads with decimal parameters accept python float.

- Fixes FractionalQuantityRegressionAlgorithm:
With the pythonnet update we can pass a python float where a decimal is required.
2017-12-29 17:25:48 +00:00
Michael Handschuh b07928bd58 Properly account for market hours in alpha prediction periods
If we make a prediction for 1 day in the future, we actually mean 1 trading day.
This change updates the alpha analysis logic to take into account the security's
market hours.
2017-12-28 11:27:41 -05:00
Stefano Raggi c6693cb237 Disable automatic security seeding
In this PR we are disabling the default security seeding (automatically getting the last price for a security when added to the algorithm) for a couple reasons, both when using large universes:
- In live trading, these history requests are sent to a history server, potentially causing timeouts
- In backtesting, depending on the algorithm this could also cause slowdowns up to 30%
2017-12-22 21:49:14 +01:00
Jared 5f64665598 Merge pull request #1425 from QuantConnect/concurrency-fix
Reduce full locking on ConcurrentDictionary objects
2017-12-20 18:56:30 -05:00
AlexCatarino 89575cb020 Sets Equity data to raw in option algorithms II
In #1390, we have implemented a feature that assured that prices from an option underlying are set to raw. If the algorithm adds options contracts with AddOptionContract method, that rule was not applied.
2017-12-20 22:32:13 +00:00
andrewhart098 c606a67b33 Merge pull request #1355 from AlexCatarino/pythonnet-update
Updates pythonnet
2017-12-20 16:30:54 -05:00
Stefano Raggi f37d0cc962 Optimize loops for performance on cashbook and securities 2017-12-20 21:58:59 +01:00
Stefano Raggi c6aba7bfec Reduce full locking on ConcurrentDictionary objects
This PR is an attempt to reduce contention in concurrent dictionaries, replacing method calls using full locks with lock-free equivalents:

- dictionary.Count -> dictionary.Skip(0).Count()
- dictionary.Keys -> dictionary.Select(x => x.Key)
- dictionary.Values -> dictionary.Select(x => x.Value)

The most frequent usages of these methods are: CashBook, SecurityManager, UniverseManager and indirectly, SecurityPortfolioManager.

The reasons for this update are explained very clearly in this article:
https://arbel.net/2013/02/03/best-practices-for-using-concurrentdictionary/
2017-12-20 17:18:54 +01:00
AlexCatarino bffa952c0a Fix missing tag from Liquidate call
Orders that are placed with Liquidate method did not come with the tag.
2017-12-19 14:40:05 +00:00
AlexCatarino c912c0d190 Updates pythonnet
In this update, we fixed type correspondence from C# Decimal to python decimal that caused wrong method overload binding.
2017-12-18 10:57:26 +00:00
Michael 9997abec89 Merge pull request #1372 from QuantConnect/feature-algorithm-framework
Initial release of the QuantConnect ALPHA streams feature.
2017-12-15 20:18: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 bd9c14ce3b Remove virtual from OnSignalsGenerated
The implementation of this method is critical to the workings of framework
algorithms and as such, we're not allowing it to be overriden.

Algorithms can receive signal events via the SignalsGenerated event.
2017-12-14 19:43:27 -05:00
Michael Handschuh d8ef289c9b Add IAlgorithm.IsFrameworkAlgorithm and BacktestingResut.IsFrameworkAlgorithm
Flag indicates whether or not the algorithm is a framework algorithm.
2017-12-14 19:43:26 -05:00
AlexCatarino 7d3327aea2 Adds warning to notify DataNormalizationMode change 2017-12-12 20:31:29 +00:00
Michael Handschuh 063a11adac Merge remote-tracking branch 'origin/master' into feature-algorithm-framework 2017-12-12 14:06:46 -05:00
Michael Handschuh 36311be93f Remove ISignal, add Signal.GeneratedTimeUtc
This abstraction point is completely unwarranted. The signal object is really
just a DTO and it's extensible as it is currently defined. This also allows us
to enforce certain behaviors, such as internal set of GeneratedTimeUtc.

Removes GeneratedTimeUtc from the result object as it's now directly on the signal.
2017-12-12 11:57:03 -05:00
AlexCatarino 6d27c10e63 Sets Equity data to raw in option algorithms
In the options trading, the strike price, the options settlement and exercise are all based on the raw price of the underlying asset instead of the adjusted price.  In order to select the accurate contracts, we need to set the data normalization mode of the underlying asset to be raw.
2017-12-12 16:28:40 +00:00
Michael Handschuh cc3902de09 Set default benchmark to 2% per annum 2017-12-11 20:34:59 +01:00
Michael Handschuh 39f5080a40 Rename framework events to OnFramework<Event>
This more closely follows existing conventions.
2017-12-08 12:04:53 -05:00
Michael Handschuh c093b45319 Add IAlgorithm.SignalsGenerated event
This event will fire each time step that generates signals and will
include all signals generated by the algorithm at that time step.
2017-12-08 10:07:54 -05:00
Michael Handschuh 14a2a09581 Add explicit methods for updating framework models
IAlgorithm.FrameworkOnData is used to pulse models with new data each time step
IAlgorithm.FrameworkOnSecuritiesChanged is used to pulse models with security changes

These two functions need to be separate to ensure that if we add an indicator during
the securities changed event that it will get the data from the current time step.
This forces us to call the securities changed event before we invoke the consolidators
for the current time step.
2017-12-08 10:07:54 -05:00
Michael Handschuh 0591d45db2 Add QCAlgorithmFramwork w/ IPortfolioSelectionModel
Adds a default implementation of IPortfolioSelectionModel that creates a
universe using the securities explicitly defined by the user.
2017-12-08 10:07:53 -05:00
AlexCatarino 0efd3a0c48 Renames Fetch to Download 2017-12-04 22:20:19 +00:00
AlexCatarino fb12e79a1c Changes PandasConverter accessibility levels
Private field PandasConverter _converter is now public property PandasConverter.
With this change, we will be able to use it in QuantBook.
2017-12-04 21:38:39 +00:00
AlexCatarino 96562b335f Implements authentication headers 2017-12-04 21:25:41 +00:00
AlexCatarino a40ded1c14 Implements QCAlgorithm.Fetch method
Fetch wraps the WebClient.DownloadString method. It allows python users to fetch data from a uri without a third party python library.
2017-12-04 21:25:41 +00:00
Jared b34cedd646 Merge pull request #1311 from AlexCatarino/futures-quantbook
Implements historical futures data requests
2017-12-04 12:05:39 -05:00