Commit Graph

144 Commits

Author SHA1 Message Date
AlexCatarino 3688a0f9af Enables custom margin call model setting in python
- Adds `MarginCallModelPythonWrapper` to wrap a python class that represents a margin call model.
- Adds `SetMarginCallModel` to enable the setting of custom margin call model.
2018-09-21 14:45:30 +01:00
AlexCatarino f1a1dd0091 Enables custom buying power model setting in python
- 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.
2018-08-21 12:04:49 +01:00
Martin Molinero 78742e5df6 Adding cash buffer for IB Cash Accounts 2018-08-10 17:21:50 -03:00
Martin Molinero 85e8a2bc91 Refactoring IBrokerageModel. Removing some unnecessary parameters 2018-08-06 10:21:12 -03:00
Juan José D'Ambrosio 4ace8cb255 Lean Visualizer C# toolbox project and Python Wrapper working 2018-04-27 11:49:52 -03:00
AlexCatarino 7707c166dd Refactors PandasConverter and PandasData
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.
2018-03-17 19:03:52 +00:00
AlexCatarino 0f57c2fd43 Fixes Custom Data for Python
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.
2018-03-01 19:28:30 +00:00
Jared 36a48a6824 Merge pull request #1554 from AlexCatarino/python-slice
Creates wrapper for Slice (python custom data)
2018-02-12 17:01:45 -05:00
Stefano Raggi 415542fcbc Set CashBuyingPowerModel as default for Crypto/GDAX 2018-02-12 17:38:12 +01:00
AlexCatarino 9dfc8ee3a0 Adds PythonSlice static constructor
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.
2018-02-12 16:23:23 +00:00
AlexCatarino cff1243b86 Creates wrapper for Slice (python custom data)
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.
2018-02-12 15:49:09 +00:00
AlexCatarino dd14821e75 Enables custom volatility models in python algorithms
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.
2018-01-31 12:17:24 +00: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
AlexCatarino 720c1f86d7 Minor improvements
- Rename variable `_type` for `_customDataType` for clarity
- `_baseDataProperties` as static member
2017-12-04 21:42:02 +00:00
AlexCatarino 3a6b18a470 Fixes PandasData support to C# custom data
Previous implementation didn't account for different subclasses that a custom ata class could inherit from.
2017-12-04 21:38:39 +00:00
AlexCatarino de2e877ce5 Fixes decimal to double convertion in PandasData 2017-12-04 21:38:39 +00:00
AlexCatarino 03eb342c8b Implements C# custom data support to PandasData
The previous custom data implementation did not account to custom data created in C# like FxcmVolume or DailyFx
2017-12-04 21:38:39 +00:00
AlexCatarino 52bded5a6a Minor changes
- 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
2017-11-17 16:18:57 +00:00
AlexCatarino 812906b0c3 Refactors PandasConverter
- 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
2017-11-17 16:09:44 +00:00
AlexCatarino 9023892838 Implements Tick data support in PandasConverter 2017-11-17 16:09:44 +00:00
AlexCatarino 2ff636869c Fixes summary of members in python wrapper classes
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
2017-11-16 14:00:22 +00:00
AlexCatarino 209922e147 Minor fixes and improvements 2017-10-31 00:16:15 +00:00
AlexCatarino de19c98827 Improves PandasConverter
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.
2017-10-27 23:49:01 +01:00
AlexCatarino 994c47e55b Implements SetSecurityInitializer for Python algorithms
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
2017-10-11 10:37:47 +01:00
AlexCatarino b4313ad740 Implements SetBrokerageModel for python algorithms
Adds BrokerageModelAlgorithm to showcase the implementation
2017-10-03 00:17:34 +01:00
AlexCatarino 9998e65df9 Adds support for custom models for python
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
2017-09-28 16:47:58 +01:00
AlexCatarino 9bbf52b4b8 Adds check for null Bid/Ask in QuoteBar for pandas.DataFrame 2017-09-13 23:09:10 +01:00
AlexCatarino 2d377b6f09 Adds QuoteBar handling to pandas.DataFrame creation 2017-08-21 13:41:00 +01:00
AlexCatarino b5dd2c403d Implements Indicator History in Jupyter project
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.
2017-08-18 18:36:42 +01:00
AlexCatarino ccce9a0087 Lower-cases pandas.Dataframe columns names
Also changes BasicQuantBookTemplate to reflect the changes
2017-08-18 18:24:25 +01:00
AlexCatarino b322dec666 Modifies the pandas dataframe created from a history request
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.
2017-08-18 18:23:11 +01:00
AlexCatarino 46ead54f79 Implements Quandl support for Python
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
2017-07-27 00:18:08 +01:00
Stefano Raggi b657c0d663 Fix speed issue in AlgorithmPythonWrapper 2017-05-21 22:40:55 +02:00
Stefano Raggi 226fa7321e Reduce Python locking in AlgorithmPythonWrapper
- Removed unnecessary Py.GIL() calls
- Cached some IAlgorithm properties
2017-05-21 14:45:01 +02:00
Stefano Raggi 8870a6baa1 Fix data type bug in BrokerageModelPythonWrapper.DefaultMarkets 2017-05-19 22:16:12 +02:00
Stefano Raggi 076204e92d Add BrokerageMessageHandlerPythonWrapper class 2017-05-19 21:46:01 +02:00
Stefano Raggi 5c4bd9a684 Add new methods to IAlgorithm for Python usage 2017-05-19 20:50:57 +02:00
AlexCatarino e7a744a236 Adds HasCustomData flag to SubscriptionManager
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.
2017-05-01 14:47:17 +01:00
jaredbroad 8f52e15564 Final rework of Pytuils 2017-04-30 18:02:15 -04:00
jaredbroad 469abd42cf Shuffle PyUtil to build-none, common project 2017-04-30 17:44:43 -04:00
jaredbroad 0e114cb94c Fix missing arg on Liquidate 2017-04-29 18:39:13 -04:00
AlexCatarino 050d5dc7dd Implements TradeBuilder for Python Framework 2017-04-10 12:06:53 +01:00
jaredbroad 664308e7fa Merge in the IDataProvider updates 2017-03-26 10:27:42 -04:00
AlexCatarino 9774af9adc Custom Data for Python Support 2017-02-09 17:48:50 -02:00