- Adds `MarginCallModelPythonWrapper` to wrap a python class that represents a margin call model.
- Adds `SetMarginCallModel` to enable the setting of custom margin call model.
- Adds `BuyingPowerModelPythonWrapper` to wrap a python class that represents a custom buying power model.
- Adds `SetBuyingPowerModel` and `SetMarginModel` to enable the seeting of custom buying power model.
Since Lean/QuantConnect data from a symbol can be found in Slice.Ticks, Slice.Bars and Slice.QuoteBars, information for all of this members must be used in order present all information in the pandas.DataFrame.
In order to access the custom data classes, the module containing them was added to the ObjectActivator. This was unnecessary if it wasn't a custom data algorithm.
Also, this operation would not be taken into account if the custom data class were defined after the algorithm was created: this is the case for QuantBook.
We refactor how custom data is handled: a new class was added to provide a instance creation factory that creates an instance of each python custom type.
With this constructor, SetConverter method, that was not respecting Lean pattern, is removed. The initialization of _converter field is done once the type is loaded.
Python algorithms with custom data requires an operation that converts a dictionary key into a attribute. In the current implementation the Slice object was converted into a python dictionary. This was not optimal, since we just need to make this conversion when the value of a key in the Slice is accessed.
This implementation proposes a wrapper for the Slice object, PythonSlice, that would just perform the operation described above when needed.
Creates a python wrapper for volatility models created in python algorithms and adds a method to the Security object to set such models.
Adds an algorithm to show how volatility models can be implemented.
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%
- We were excluding Exchange and Suspicious of quote ticks when they can be set with security types other than equity
- Custom data was not expecting non-numerical properties
- Moves PandasData class to its own file
- Refactors PandasData class to deal with list of tick
- Other minor changes requested by peer-review
- Adds unit test for PandasConverter's tick handling
Summary of members in python wrapper classes where pointing to other methods for reference when they should have a meaningful description to be used in documentation
In the previous implementation, each one of bars.Select statement causes an extra enumeration of the bars enumerable. To make matters worse, this is all invoked 4*N times, where N is the number of data points.
Another bottleneck was related to the way we concatenate pandas.DataFrames: we would add a new data frame to an existing data frame individually. Now, we collect all data frames and concatenate them in one operation.
With this new implementation, we have accomplshed a reduction of 90% of memory usage in a history request of 1000 symbols.
Creates a class that wraps a PyObject that represents a ISecurityInitializer object for the case where we use a class to initialize securities
Adds SetSecurityInitializer method that accepts a PyObject that may represent a method, a function or class that is used to initialize securities
Adds support for fee, fill and slippage custom modelling.
Adds CustomModelsAlgorithm to showcase the new feature
Modifies C# version of CustomModelsAlgorithm to match existing data in github
With simple commands, we can use Lean indicators in QuantBook. It fetchs the historical data from the symbol, calculates the indicator and saves the output in a pandas.DataFrame.
History requests should not return a dictionary with a dataframe, but a multi-index dataframe.
It is more common to work with multi-index dataframes rather than multi-column.
Implements Quandl support for Python.
It was not possible to derive from Quandl in order to select the column. If the data did not have "close", it would thrown an exception since it would look for this work in a dictionary.
It is now possible to select the column.
See example QuandFuturesDataAlgorithm.py
This flag will be used to speed python algorithms execution, since it avoids a wrapping operation that is only required when there is custom data in python algorithms.