Commit Graph

120 Commits

Author SHA1 Message Date
Martin Molinero 0ee2102bb1 Fix or ignore failing unit tests 2019-07-26 12:46:02 -03:00
Michael Handschuh eeae2e291e BUG #3021: Validate email addresses in NotificationEmail
* Adds Validate class in util with accompanying regular expressions
* Provides tests for NotificationEmail and Validate.EmailAddress
* Provides default values for NotificationEmail Subject and Message
  These default values resolve the underlying issue of #3021 w/out
  needing to modify external sources (such as impl of IMessagingHandler)
2019-07-08 02:52:04 -04:00
Martin Molinero 168fb98e20 Fix Turnover Ratio for Futures/CFDs
- `Futures` and `CFDs` sales value will use `ContractMultiplier` as the
rest of the securities.
- `FitnessScore` values will be truncated, not rounded, to 3 decimal places.
- Reducing code duplication for calculating the
`CompoundingAnnualPerformance`
2019-06-06 20:06:54 -03:00
Stefano Raggi f7e06510d4 Fix missing front month contract in energy futures backtesting
Energy futures (CL, HO, RB, NG) expire in the month before the contract month.

To handle these properly, the following changes have been implemented:
- the AlgoSeekFuturesReader has been updated to create the future symbol with the correct expiry date
- the zip entry names in futures data files now contain the full expiry date (in addition to the contract month)
- the sample data files have been updated to use the new zip entry names
- new unit tests have been added and existing ones updated
2019-04-29 09:40:59 +02:00
Stefano Raggi 273d6e90da Fix parsing of crypto tick data with sub-millisecond timestamps
- also updated extension methods ToInt32 and ToInt64 to support input strings with decimals
2019-01-21 16:47:27 +01:00
Martin Molinero d9195317e3 C# decimal to Python conversion
- This commit is related to PR 19 in QC/pythonnet
   - C# decimal will be cast to C# double and converted into python
   float
- Adding new `decimal.py` into the python algorithm project. This is
required for backwards compatibility with users performing operations
over expected decimal types (like `Price`)
- Updating two python regression test algorithms using custom python
execution models to be aware and ignore floating point precision errors
when handling order sizing.
2019-01-15 12:13:42 -03:00
Martin Molinero 103bf638b5 Adding Pandas MultiIndex cache
- Adding a cache for the `Pandas.MultiIndex`, giving a significant
performance improvement.
- Adding new `ListComparer` class. Adding unit tests.
2019-01-11 14:00:32 -03:00
Martin Molinero e4fc00efbf Composer will scan directory once
- `Composer` will scan the specified directory for binaries only once.
This gives a performance improvement:
- Regression tests execution times:
    - `master`: 11:11
    - `PR`: 9:56, 9:46
- Reverting the assert logic of a unit test

> We now have regression tests < 1 second as low as 0.5s!
2018-12-14 12:52:45 -03:00
Martin Molinero 767ee77fb1 Fix exception being thrown when deserializing backtest result and fix Color serialization 2018-09-09 19:55:23 -03:00
Michael Handschuh 1c07805be3 Fixes potential memory leak in StreamReaderEnumerable
This implements a finalizer to perform disposal.
Also adds ability to mark other objects for disposal when this instance
is disposed. This is useful for disposing, for example, a ZipFile that
was used to create the StreamReader instance.
2018-08-23 12:55:25 -04:00
Michael Handschuh 57affafdc2 Implement 'live' factor files
Adds reference price to dividend/split
Adds GetSplitsAndDividends to FactorFile
Adds Apply methods to FactorFile/FactorFileRow
Updates factor files to include reference prices
2018-08-14 17:58:44 -04:00
Martin Molinero 40b5629674 Fix infinite loop at ExchangeRoundDownInTimeZone 2018-08-09 14:26:04 -03:00
Stefano Raggi fadda32e08 Enable ignored/excluded Python unit tests 2018-08-09 11:51:53 +02:00
Martin Molinero 6929b6f632 Suppressing inlining on methods that call WhoCalledMe 2018-07-27 17:36:36 -03:00
Martin Molinero f45a7938cf ToOrderTicket now correctly sets order field 2018-07-11 10:21:08 -03:00
Michael Handschuh 2fa9b0b6f7 Make regression algorithms self-contained
Some algorithms had dependencies outside of the file that needed
to be copied into each project. The alternative here is to move
the Bitcoin and QuandlFuture type into Common\Data or similar
2018-07-06 02:05:03 -04:00
AlexCatarino a4233c7179 Improves Extensions.TryConvert to avoid test by exception
Instead of letting `PyObject.AsManagedObject` throw an exception because the types do not match, we check whether the target type is assignable from the python object type.

This PR fixes PR #2102 that caused a bug in Symbol[] convertion.

Unit tests were added to test all changes.
2018-06-12 22:39:16 +01:00
Juan José D'Ambrosio 4ace8cb255 Lean Visualizer C# toolbox project and Python Wrapper working 2018-04-27 11:49:52 -03:00
AlexCatarino 0a529b5485 Implements TryConvertToDelegate extension method
Condenses three PythonUtil static methods that converts python objects in a multidelegate into one.
2018-04-12 17:03:38 +01:00
Michael Handschuh 1c93dc7576 Add IEnumerable.BatchBy(batchSize) extension method 2018-03-21 08:26:51 -04:00
AlexCatarino 2f500fc1b6 Minor corrections 2018-03-08 12:06:54 +00:00
AlexCatarino 682b312c0f Moves GetStringBetweenChars to Extensions from PythonUtil
Since this method is not exclusive of python algorithms, it is being moved to Extension methods.
2018-03-07 23:24:35 +00:00
Stefano Raggi 8e085ca89e Fix CashBuyingPowerModel for StopMarket orders 2018-02-12 17:38:13 +01:00
Stefano Raggi 798b85c056 Exclude FactorFileGeneratorTests from Travis build
For now these tests are excluded from the Travis build because of occasional Yahoo server errors. In future they should be updated to read the Yahoo data from a local test file.
2017-12-04 18:38:52 +01:00
Andrew 18e2857e78 Don't include tick type in the filename
Update LeanDataTests to reflect correct crypto hour/daily filenames
2017-11-10 16:27:00 -05:00
Michael Handschuh a03cfe0077 Ignore ObjectDisposedException in DisposeSafely
No point in reporting this error since that is the objective of this function.

Add test for swallowing ObjectDiposedException that verifies that DisposeSafely
returns true and doesn't invoke the error handler when the object being disposed
throws an ObjectDisposedException
2017-11-02 11:46:55 -04:00
Andrew 02278ef519 Add btcusd daily data in updated format
Now lean expects both trades and quotes as seperate files. This commit adds the data in the updated format
2017-10-27 16:22:28 -04:00
Andrew 9d90ff1cb1 Hourly and daily crypto files need their tick type specified in their zip archive filename 2017-10-26 15:13:48 -04:00
Andrew 8264cc4a9f LeanDataTests passing for crypto securities
The Crypto security can be modeled with both trades and quotes easily, therefore it is necessary to make sure that the LeanData, LeanDataWriter and associated BaseData.Reader() methods can read/write both Trades and Quotes.
2017-10-25 16:52:31 -04:00
Andrew 406eef196b Specify crypto only switch statement in LeanData.GenerateLine
Because cryptocurrencies can be either Trades or Quotes, the Crypto security type needs it's own switch statement in LeanData.GenerateLine. This produces non-scaled TradeBars or QuoteBarrs.
2017-10-25 16:50:48 -04:00
Michael Handschuh ec70a3516e Add ExchangeRoundDownInTimeZone ext
Performs rounding of data time in the specified time zone until
the range is within market hours.
2017-10-02 12:16:06 -04:00
Michael Handschuh 05b3b2d90d Add RoundDownInTimeZone extension
Performs rounding of data time in the specified time zone.
2017-10-02 12:16:05 -04:00
Michael Handschuh 6292f1e286 Clean white space 2017-10-02 12:16:05 -04:00
Jared Broad fb7d1994ff Tidy and add tags 2017-09-20 17:14:44 -04:00
AlexCatarino 0b711f8dcd ToDecimal extension method allows negative numbers
When a string that represents a negative decimal was parsed with ToDecimal extension method, it returned a wrong number.
2017-07-28 13:18:21 +01:00
Andrew ce6f7c1224 Yahoo Api as of 7/11/2017 has the adjusted close and close swapped 2017-07-11 12:58:11 -04:00
Andrew 35cdd07897 Update zip entry path of equity Tick files 2017-07-10 11:55:54 -04:00
jameschch@outlook.com a7b3490699 Fixes yahoo downloader split/dividend data and factor files 2017-06-13 21:18:22 +01:00
AnshulYADAV, Computer Artist (CoArsey) 66de67c5a4 Implements YahooDataDownloader and its unit tests (#965)
* Implements YahooDataDownloader and its unit tests

* Replaces Datetime.Parse() with new Datetime() in YahooDataDownloaderTests

* Updates GetMethod_WithReveseDate_ShouldThrowException to have reverse dates and Daily resolution.

* Adds braces where they were avoided

* Uses var keyword in files Historical.cs and Token.cs
2017-06-12 09:53:46 -04:00
Stefano Raggi d8b424c233 Remove YahooDownloader toolbox project and FactorFileGenerator tests 2017-05-18 16:51:03 +02:00
Stefano Raggi d18fdce3de Disable failing FactorFileGeneratorTests
These tests use the Yahoo Finance API, which has been discontinued on 5/16/2017:
https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/td-p/250503/page/3
2017-05-18 14:52:26 +02:00
Juan José D'Ambrosio 703d75a96c Update LeanDataTests.cs
Using [international standard date notation](https://www.cl.cam.ac.uk/~mgk25/iso-time.html) in the `CorrectPaths_CanBeParsedCorrectly` test method to avoid [test fail](http://imgur.com/a/78MlM) because error in parsing the string dates with an specific culture format.
2017-05-11 05:54:31 -03:00
Andrew 9fcf90fe60 Remove optional boolean in LeanData.ToCsv() 2017-05-08 13:18:54 -04:00
Andrew 5cedbeae3f Leveraging existing extension method to remove trailing 0s 2017-04-05 12:49:28 -04:00
Stefano Raggi d9db470532 Update ToDecimal extension to handle whitespace 2017-04-02 20:50:27 +02:00
Andrew 22175bb7f0 QuoteBar.Reader does not apply scaling factor to forex and cfd 2017-03-27 12:01:24 -04:00
Andrew eb9d78470c LeanData.TryParsePath now returns a symbol
Instead of returning a heavier Security object, LeanData.TryParsePath will return a symbol, datetime and resolution.
2017-03-09 14:44:17 -05:00
Andrew 8e3a0715fc Added LeanData.TryParsePath() and associated tests
This method takes a path and will return a Security and DateTime.  This is useful in the ApiDataProvider that uses the api to retrieve files that are not present on disc.  The IDataProvider only ha a path to the file.  Using this method, the ApiDataProvider can extract the useful information from the path to communicate with the api.
2017-03-09 11:34:36 -05:00
Andrew 86de1fb763 Added tests for LeanData.GetCommonTickTypeForCommonDataTypes 2017-02-15 11:57:39 -05:00
Jared 45abca89fe Merge pull request #656 from QuantConnect/market-hours-early-close
Add Early Closes in market hours database
2017-01-17 17:55:16 -05:00