37 Commits

Author SHA1 Message Date
Jhonathan Abreu 40cfcfc336 Fix: Insight constructors not setting correct values (#8058) 2024-05-24 19:02:59 -03:00
Ricardo Andrés Marino Rojas b147c7ccfd Api Clean up, Documentation and Standarization part five (#8016)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Update endpoints and add tests

* Remove JsonProperty tags

* Enhance unit tests

* Add live/insights/read/response

* Add missing class

* Remove old insights property

* Improve read live insights unit test

* Nit change

* Fix failing unit tests

* Revert "Fix failing unit tests"

This reverts commit a2b7c1d34ef5b058a0e753853613ddd3f9d7d3dc.

* Add Insights.Ticker back

* Nit change

* Address requested changes
2024-05-13 18:14:40 -03:00
Jhonathan Abreu 90a6d2f68f Insight and PortfolioTarget tag (#7456)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add Tag property to Insight

* Add PortfolioTarget Tag property

* Minor change

* Minor unit test fix
2023-09-07 16:59:01 -04:00
Lehonti Ramos 026ba6ed5b Modernization of syntax used in argument check exceptions (#7380)
* Changed argument exceptions so that they used the nameof() operator for parameter names

* Update IQSocket.cs

---------

Co-authored-by: John Doe <john@doe>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
2023-07-17 14:53:17 -03:00
Martin-Molinero 1a22f20340 Avoid expiring insights twice (#7243)
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
- Avoid expiring insights twice. Adding unit test
2023-05-15 10:01:07 -03:00
Martin-Molinero 7db8df3f8d Add Insight expiration helper methods (#7127)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
- Add InsightManager expiration helper methods. Adding unit tests
2023-03-22 19:15:47 -03:00
Martin-Molinero bbbab6d9a8 Refactor alpha statistics phase I (#7055)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* Refactor alpha statistics

- Refactor alpha statistics, cleaning up and simplifying no longer required calculations and scoring
- Adding new InsightEvaluator abstraction, adding C# & PY regression
  algorithms

* Optimization backtest result json converter update

* Address reviews

- Remove IAlphaHandler, move insight storage responsability to IResultHandler
  and centralizing insight collection on the QCAlgorithm.Insights to be
  reused by the framework models
- Fix portfolio turnover single day backtests and duplicate time
  sampling handling. Updating regression algorithms

* Add InsightCollection tests and minor fixes

* Adding more & improved tests
2023-03-10 13:12:23 -03:00
Alexandre Catarino 7cc6e31c43 Fixes Insight Period Calculation (#6978)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
The calculations of `CloseTimeUtc` are correct and consistent: if the exchange is closed when the insight expires, `CloseTimeUtc` is the next open.

However, the definition of the `Period` was not consistent. Normally, it is defined by the different between `CloseTimeUtc` and `GeneratedTimeUtc`, but when we create an Insight with the Resolution and bar count overload, the period was defined by them:

```csharp
insight.Period = Resolution.ToTimeSpan().Multiply(BarCount);
```

which is incorrect, since it doesn't take the days the exchange is closed into account. The `ComputePeriod` method enforced consistency between the Resolution and bar Count overload and the `DateTime` overload, so the period for this overload was also incorrect.
2023-02-20 16:23:13 -03:00
Jhonathan Abreu 194f01e621 Move Algorithm namespace's messages to Messages folder (#6916) 2023-02-09 18:35:29 -03:00
Martin-Molinero 4e00324b57 Bug insight internal to procted internal (#5357)
* Update Insight.cs

* Insight protected to protected internal

Co-authored-by: Jared <jaredbroad@gmail.com>
2021-03-03 16:14:36 -08:00
Martin-Molinero 1b6301d813 Update Insight.cs (#5356) 2021-03-03 16:02:57 -08:00
Jared d24695856d Update Insight.cs (#5355) 2021-03-03 15:17:25 -08:00
Martin-Molinero e91af0814f Add notification targets and events to live packet (#5210)
* Add notification targets and events to live packet

- Add notification targets and events to live packet. Adding unit tests

* Add project name to job packet

* Add ShortToString and WebNotification Header

- Adding ShortToString implemnetation of OrderEvent and Insight
- Add Web notification headers

* Add more unit tests

* Revert json lower case fields
2021-01-27 10:26:35 -03:00
Adam May 58949b8d4d Make Insight.Clone() virtual to allow GeneratedInsightsCollection to clone derived types properly 2020-04-08 13:05:21 +10:00
Martin Molinero 982ab3099f Remove Order based insights
- Removing order based insight generator.
- Removing regression and unit tests.
2020-04-01 20:21:19 -03:00
Jack Simonson 64d0ecb1b7 Update Insight.cs
Add Weight to Insight constructors where missing/necessary.
2020-01-28 09:56:57 -08:00
Gerardo Salazar eb7bd53c64 Adds new property CreatedTime to Insight JSON output
* Deprecates `generated-time` in Insight JSON
* Deprecates `GeneratedTime` in `SerializedInsight` and make pass-through
2020-01-23 17:12:49 -08:00
Michael Handschuh d709d1c4e0 Update Common to respect CA1304 and CA1305
Updates all occurrences of parsing/ToString-ing to go through the new
StringExtensions methods that use CultureInfo.InvariantCulture

See #3045
2019-09-12 14:13:24 -04:00
Martin Molinero 64d43c1487 Add Insight.ReferenceValueFinal 2019-07-09 17:53:58 -03:00
Martin Molinero 7af29e3697 Add Insight Portfolio Weight
- Adding optional portfolio Weight property for `Insights`
2019-04-24 10:58:45 -03:00
Martin Molinero 32ac3146b4 Merge Framework and Classic Algorithms
- Merging Framework and Bridge algorithms into classic QCAlgorithm
class.
- Removing Framework project, VS17 and VS15
2019-04-03 21:54:32 -03:00
AlexCatarino 5931a42d48 Implements Insight Expiry Helper
Implement a new overload to `Insight` constructor that accepts a  `Func<DateTime, DateTime>` that is used to compute the `CloseTimeUtc` and `Period` after the `Insight` object is emitted (`SetPeriodAndCloseTime` method).

Adds the static Expiry class with functions that can be used to compute a future date/time (expiry) given a date/time.

Closes #3038
2019-04-03 21:46:14 +01:00
Martin Molinero 9d5b1f5be6 Fix auto generated insight period
- Updating regression test to assert of period value
2019-03-28 18:43:09 -03:00
Martin Molinero 5b04cfe202 Emiting Insights based on Fills
- Classic Algorithms will emight insights based on order fills.
   - To be able to update generated insights closed time, we will not
   clone emitted insights.
   - `InsightAnalysisContext` will update `AnalysisEndTimeUtc` when the
   Insight period is closed and the period is `EndOfTimeTimeSpan`
- Adding new regression algorithm asserting on the new emitted insights
- Adding unit tests
- `LiveTradingResultHandler` will store `AlphaRunTimeStatistics`
- Making `DefaultAlphaHandler.ProcessAsynchronousEvents` virtual to
facilitate cloud changes
2019-03-26 16:09:22 -03:00
Michael Handschuh d5f88c6bb7 Add Insight.IsActive and Insight.IsExpired methods
Easily check if an insight is active or expired
2018-08-10 13:52:17 -04:00
Michael Handschuh 4fd16f6daf Fix resolution of insight close times, allow user defined close times
Fixes a bug where we were using the security's data resolution to compute
the insight's close time. This led a case such as insight.Period == 20days
to step 20days worth of tradable minutes (assuming minute data resolution),
yielding a close time that was very far in the future.

We also add different means of specifying an insight's period/close time:
1. Specify insight period as a TimeSpan and we compute close time
2. Specify insight period and a resolution and bar count and we compute close time
3. Specify insight close time local directly and we compute the insight period

The key here is maintaining consistency between the three different approaches
which is heavily validated with the corresponding unit tests.

Edits also made to trust the insight's close time as the analysis end time in
the case where the analysis period == insight period (extra analysis period = 0).
Given the current setup (extra analysis period == 0), this guarantees that close
and analysis end times are equivalent.

Regression statistics were updated and expectedly we get many more insights that
have completed analysis, and as such, average scores have also changed.
2018-08-07 11:21:11 -04:00
Michael Handschuh d2c546e78e Make Insight.FromSerializedInsight public
This is needed elsewhere and seems less worse than exposing it
via InternalsVisibleTo
2018-07-19 13:46:11 -04:00
AlexCatarino b15cfacff2 Insight.Group retuns the original Insight array with modified Insights
Use the new return type in PairsTradingAlphaModel.
2018-05-10 16:18:07 +01:00
AlexCatarino 659c64d5ce Adds single Insight overload to Insight.Group
pythonnet does not find the method overload when we only provide one `Insight` instance, that leads to a discrepancy from C# API.
2018-05-10 11:50:12 +01:00
AlexCatarino 62adc3a24b Changes Insight.Group return type to IEnumerable<Insight> from Guid 2018-05-09 14:49:00 +01:00
Michael Handschuh 2e0111b858 Handle null group-id in FromSerializedInsight
Also updates the insight serialization tests to exercse the null
group-id case to prevent future regressions.
2018-04-23 13:26:41 -04:00
Michael Handschuh 5f33d61220 Add Insight.GroupId and Insight.Group( insights )
Provides a means of grouping insights together.
This new value is serialized as 'group-id'.
2018-04-19 12:47:08 -04:00
Michael Handschuh c3c6a9aff8 Add Insight.SourceModel
This identifier is used to determine the alpha model that generated.
This is NOT ideal, since it requires users to specify the value, more
thought will be givent to how we can resolve this value automatically

Adds test for surviving roundtrip copy operation.
2018-04-17 16:36:47 -04:00
AlexCatarino bf1aa7fa4c Implements Insight.Price helper method.
Implements `Insight.Price` method to make it easier to create new instances of `Insight` of `InsightType.Price`.
Standardize the parameter order to `Symbol`, `TimeSpan`, `InsightType`, `InsightDirection`, `Double`, `Double`.
2018-04-10 19:49:29 +01:00
Michael Handschuh f11acf1246 Remove Insight.Equals
This method is misleading at best and incorrect at worst.
Insight objects should use reference equality or compare ids to
perform equality checking. The only usage, in MacdAlphaModel,
was easily converted to not relying on this method.
2018-04-03 23:32:34 -04:00
Michael Handschuh 0d5fca0733 Add insight serialization tests
Moved costruction of insight from serialized insight to the insight
object so it could access private properties, such as the id
2018-03-12 16:28:41 -04:00
Michael Handschuh 6b239674e2 Renames Alpha -> Insight
The term 'alpha' is used to describe the entire algorithm. Therefore, 'alpha'
produces insights. From this we have things like IAlphaModel, which is the model
defining how insights are produced. We have IAlphaHandler, which defines how the
insights from a single 'alpha' (the algorithm) are managed, analyzed, and stored.
Types closer to the individual prediction level, such as InsightDirection, or
InsightScore relate directly to exactly 1 insight. The distinction between the
two became more clear as we developed the insights API, and from that effort it
was decided to harmonize alpha/insight terminology across the various QC systems.
2018-03-09 16:12:56 -05:00