Commit Graph

48 Commits

Author SHA1 Message Date
AlexCatarino e40a318f88 Fixes "object isn't callable" bug in Universe Selection
Reverse the order that a `PyObject` is attempt to be converted into a `Universe` object and a `Func`.
2018-07-03 17:19:03 +01:00
AlexCatarino 4853e50dd2 Fixes ambigous call bug for Download method
Adds more overloads and remove the optional arguments.
2018-06-28 19:00:31 +01:00
Michael Handschuh bb21171943 Implements python Consolidate API
Collapse QuoteBar to TradeBar if trade bar handler specified
2018-06-12 13:17:49 -04:00
AlexCatarino 19d403fd46 Assures that Coarse and Fine Fundamental are passed as List to AddUniverse 2018-05-23 15:13:07 +01:00
AlexCatarino e9cef63e12 Refactors GetSymbolsFromPyObject method
GetSymbolsFromPyObject now returns IEnumerable<Symbol> and throws if its argument is not Symbol or Symbol[] object and if the Symbol has not been added to the Securities object.
2018-03-23 19:19:52 +00:00
AlexCatarino f588e190f2 Fix data consolidation with python custom data
When creating a CRL type in runtime to represent a python custom data class, we need define `DynamicData` as its parent class so that it passes the `IsAssignableFrom` condition in `SubscriptionManager.AddConsolidator`
2018-03-14 17:55:22 +00:00
AlexCatarino 5e2f24b90f Uses PyObject.TryConvert to determine which indicator type will be registered
Minor fixes in RegisterIndicator tests.
2018-03-08 10:54:19 +00:00
AlexCatarino 28c5fe3f16 Fixes RegisterIndicator for python algorithms
The check for Lean indicators was testing for `Indicator`, `BarIndicator` and `TradeBarIndicator` types where it should check for `IndicatorBase<T>` which includes `WindowIndicator<T>`.
2018-03-08 10:51:29 +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
AlexCatarino e3cda2afe8 Improves Plot(string,PyObject) logic and test
In this new approach, we test whether the argument is a Indicator before we try to plot it. If fail, throws a ArgumentException error.
2018-02-28 18:46:00 +00:00
AlexCatarino bd18dfc2f8 Adds test for new Plot overload
This text is ignore since Travis does have pythonnet installed.
2018-02-27 22:11:07 +00:00
AlexCatarino 0ea19b0558 Adds overload to Plot method to handle indicator special cases
For cases where implicit conversion to decimal from indicator was not properly handled by pythonnet, we expliticly get `Current.Value` and redirect to `Plot(string,decimal)` overload.
2018-02-27 12:36:37 +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
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
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
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
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 783d841a59 Changes AddData method return type
Unlike other methods used to add securities to the algorithm that return a Security or a derived object, AddData was returning void. This commit change it to return Security for consistency.
2017-11-16 14:41:08 +00:00
AlexCatarino b31e7e18a6 Adds support for Historical Requests of Custom Data for python 2017-11-01 12:43:06 +00:00
AlexCatarino c01470e1db Fixes PlotIndicator for python algorithms
Available PlotIndicator method overloads did not cover all the possibilities, so we now use PyObject as a pseudo-generic.
2017-10-24 20:24:52 +01:00
AlexCatarino c43a87d93e Enables Universe Selection Helpers in Python 2017-10-24 19:06:16 +01:00
AlexCatarino 6fc55de371 Extends SetBenchmark to accept functions as paramenters in Python 2017-10-12 23:57:20 +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 58a7f0cf8a Moves ToFunc method from QCAlgorithm to Util/PythonUtil
ToFunc method is used to convert a PyObject that represents a method into a System.Func. Since this method will be used across different classes, we are moving it to PythonUtil class.
2017-10-06 16:44:53 +01:00
AlexCatarino 1346acf0cf Adds support for FilteredIdentity indicator for python
Also adds FilteredIdentityAlgorithm as a working example.
2017-10-05 12:12:45 +01:00
AlexCatarino b4313ad740 Implements SetBrokerageModel for python algorithms
Adds BrokerageModelAlgorithm to showcase the implementation
2017-10-03 00:17:34 +01:00
AlexCatarino 751a66a36a Refactors Custom Models for python
Moves custom model setters from QCAlgorithm class to Security class.
Modifies algorithm examples to reflect the change.
2017-09-29 22:56:52 +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 b03c9daa6f Improves Custom Universe Selection
Covers the case where the Symbol of a custom data source is important.
Adds CustomDataUniverseAlgorithm python algorithm as an working example
2017-09-27 00:33:19 +01:00
AlexCatarino a082f930fa Adds support for Custom Universe Selection
Includes DropboxBaseDataUniverseSelectionAlgorithm python algorithm as an working example
2017-09-27 00:33:19 +01:00
AlexCatarino 3da8449fea Improves Universe Selection for python
In python algorithm using Universe Selection, the selector method should return a List<Symbol>. To make it more pythonic, we allow returning python list. The conversion is, then, performed in C# side.
2017-09-27 00:33:19 +01:00
AlexCatarino e35ba389d9 Adds support for user-defined universe selection for python
Adds UserDefinedUniverseAlgorithm python script to show how to use user-defined universe selection for python.
2017-09-20 22:45:51 +01:00
AlexCatarino d2c144ff1e Fixes hard-coded resolution in AddData for Python algorithms 2017-08-30 17:59:55 +01:00
Stefano Raggi 492bc70229 Fix Options and Futures subscriptions at Tick resolution
Previously Tick resolution subscriptions only received ticks with TickType.Trade, now TickType.Quote and TickType.OpenInterest are received as well.

This PR replaces PR #1065
2017-08-22 02:20:36 +02:00
AlexCatarino bcd25b56b4 Refactors PyObject to List of Symbol parsing 2017-08-21 13:52:48 +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
AlexCatarino 3c23759efd Implements History Requests returning pandas.DataFrame
Algorithms written in python can access to new overloads for the QCAlgorithm.History method that returns a dictionary with pandas.DataFrame
2017-07-06 15:09:59 +01:00
AlexCatarino 77d1b537ee Charting support for python
Adds overloads to Plot and PlotIndicator to handle calls from python.
Adds CustomChartingAlgorithm and changes MACDTrendAlgorithm to showcase the feature
2017-06-02 10:45:45 +01:00
AnshulYADAV, Computer Artist (CoArsey) 350e58567f Fixes 18 warnings with code CS1572 (#908)
* Fixes 5 warnings with code CD1572

* Adds the Xml Comment parameter and implements the missing selector parameter

* Fixes rest of the 13 warnings with code CS1572
2017-05-12 09:28:46 -04:00
AlexCatarino bb1c960fb5 Removes lock from AddData method
AddData method has a lock that prevents the subscription of new custom data after initialization.
2017-05-02 17:34:17 +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
AlexCatarino 68fd8a4120 New Python Support Framework
Initial commit
2017-01-10 16:12:19 -02:00