Lean
$LEAN_TAG$
|
Defines a alpha prediction for a single symbol generated by the algorithm More...
Public Member Functions | |
bool | IsExpired (DateTime utcTime) |
Determines whether or not this insight is considered expired at the specified utcTime More... | |
bool | IsActive (DateTime utcTime) |
Determines whether or not this insight is considered active at the specified utcTime More... | |
void | Expire (DateTime utcTime) |
Expire this insight More... | |
void | Cancel (DateTime utcTime) |
Cancel this insight More... | |
Insight (Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction) | |
Initializes a new instance of the Insight class More... | |
Insight (Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction, double? magnitude, double? confidence, string sourceModel=null, double? weight=null) | |
Initializes a new instance of the Insight class More... | |
Insight (Symbol symbol, Func< DateTime, DateTime > expiryFunc, InsightType type, InsightDirection direction) | |
Initializes a new instance of the Insight class More... | |
Insight (Symbol symbol, Func< DateTime, DateTime > expiryFunc, InsightType type, InsightDirection direction, double? magnitude, double? confidence, string sourceModel=null, double? weight=null) | |
Initializes a new instance of the Insight class More... | |
Insight (DateTime generatedTimeUtc, Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction, double? magnitude, double? confidence, string sourceModel=null, double? weight=null) | |
Initializes a new instance of the Insight class. This constructor is provided mostly for testing purposes. When running inside an algorithm, the generated and close times are set based on the algorithm's time. More... | |
void | SetPeriodAndCloseTime (SecurityExchangeHours exchangeHours) |
Sets the insight period and close times if they have not already been set. More... | |
virtual Insight | Clone () |
Creates a deep clone of this insight instance More... | |
override string | ToString () |
Returns a string that represents the current object. More... | |
string | ShortToString () |
Returns a short string that represents the current object. More... | |
Static Public Member Functions | |
static Insight | Price (Symbol symbol, Resolution resolution, int barCount, InsightDirection direction, double? magnitude=null, double? confidence=null, string sourceModel=null, double? weight=null) |
Creates a new insight for predicting the percent change in price over the specified period More... | |
static Insight | Price (Symbol symbol, DateTime closeTimeLocal, InsightDirection direction, double? magnitude=null, double? confidence=null, string sourceModel=null, double? weight=null) |
Creates a new insight for predicting the percent change in price over the specified period More... | |
static Insight | Price (Symbol symbol, TimeSpan period, InsightDirection direction, double? magnitude=null, double? confidence=null, string sourceModel=null, double? weight=null) |
Creates a new insight for predicting the percent change in price over the specified period More... | |
static Insight | Price (Symbol symbol, Func< DateTime, DateTime > expiryFunc, InsightDirection direction, double? magnitude=null, double? confidence=null, string sourceModel=null, double? weight=null) |
Creates a new insight for predicting the percent change in price over the specified period More... | |
static IEnumerable< Insight > | Group (params Insight[] insights) |
Creates a new, unique group id and sets it on each insight More... | |
static IEnumerable< Insight > | Group (Insight insight) |
Creates a new, unique group id and sets it on each insight More... | |
static Insight | FromSerializedInsight (SerializedInsight serializedInsight) |
Creates a new Insight object from the specified serialized form More... | |
static DateTime | ComputeCloseTime (SecurityExchangeHours exchangeHours, DateTime generatedTimeUtc, Resolution resolution, int barCount) |
Computes the insight closing time from the given generated time, resolution and bar count. This will step through market hours using the given resolution, respecting holidays, early closes, weekends, etc.. More... | |
static DateTime | ComputeCloseTime (SecurityExchangeHours exchangeHours, DateTime generatedTimeUtc, TimeSpan period) |
computs the insight closing time from the given generated time and period More... | |
Properties | |
Guid | Id [get, protected set] |
Gets the unique identifier for this insight More... | |
Guid? | GroupId [get, protected set] |
Gets the group id this insight belongs to, null if not in a group More... | |
string | SourceModel [get, set] |
Gets an identifier for the source model that generated this insight. More... | |
DateTime | GeneratedTimeUtc [get, set] |
Gets the utc time this insight was generated More... | |
DateTime | CloseTimeUtc [get, set] |
Gets the insight's prediction end time. This is the time when this insight prediction is expected to be fulfilled. This time takes into account market hours, weekends, as well as the symbol's data resolution More... | |
Symbol | Symbol [get] |
Gets the symbol this insight is for More... | |
InsightType | Type [get] |
Gets the type of insight, for example, price insight or volatility insight More... | |
decimal | ReferenceValue [get, set] |
Gets the initial reference value this insight is predicting against. The value is dependent on the specified InsightType More... | |
decimal | ReferenceValueFinal [get, set] |
Gets the final reference value, used for scoring, this insight is predicting against. The value is dependent on the specified InsightType More... | |
InsightDirection | Direction [get] |
Gets the predicted direction, down, flat or up More... | |
TimeSpan | Period [get, set] |
Gets the period over which this insight is expected to come to fruition More... | |
double? | Magnitude [get] |
Gets the predicted percent change in the insight type (price/volatility) More... | |
double? | Confidence [get] |
Gets the confidence in this insight More... | |
double? | Weight [get] |
Gets the portfolio weight of this insight More... | |
InsightScore | Score [get, protected set] |
Gets the most recent scores for this insight More... | |
decimal | EstimatedValue [get, set] |
Gets the estimated value of this insight in the account currency More... | |
Defines a alpha prediction for a single symbol generated by the algorithm
Serialization of this type is delegated to the InsightJsonConverter which uses the SerializedInsight as a model.
Definition at line 32 of file Insight.cs.
QuantConnect.Algorithm.Framework.Alphas.Insight.Insight | ( | Symbol | symbol, |
TimeSpan | period, | ||
InsightType | type, | ||
InsightDirection | direction | ||
) |
Initializes a new instance of the Insight class
symbol | The symbol this insight is for |
period | The period over which the prediction will come true |
type | The type of insight, price/volatility |
direction | The predicted direction |
Definition at line 172 of file Insight.cs.
QuantConnect.Algorithm.Framework.Alphas.Insight.Insight | ( | Symbol | symbol, |
TimeSpan | period, | ||
InsightType | type, | ||
InsightDirection | direction, | ||
double? | magnitude, | ||
double? | confidence, | ||
string | sourceModel = null , |
||
double? | weight = null |
||
) |
Initializes a new instance of the Insight class
symbol | The symbol this insight is for |
period | The period over which the prediction will come true |
type | The type of insight, price/volatility |
direction | The predicted direction |
magnitude | The predicted magnitude as a percentage change |
confidence | The confidence in this insight |
sourceModel | An identifier defining the model that generated this insight |
weight | The portfolio weight of this insight |
Definition at line 188 of file Insight.cs.
QuantConnect.Algorithm.Framework.Alphas.Insight.Insight | ( | Symbol | symbol, |
Func< DateTime, DateTime > | expiryFunc, | ||
InsightType | type, | ||
InsightDirection | direction | ||
) |
Initializes a new instance of the Insight class
symbol | The symbol this insight is for |
expiryFunc | Func that defines the expiry time |
type | The type of insight, price/volatility |
direction | The predicted direction |
Definition at line 214 of file Insight.cs.
QuantConnect.Algorithm.Framework.Alphas.Insight.Insight | ( | Symbol | symbol, |
Func< DateTime, DateTime > | expiryFunc, | ||
InsightType | type, | ||
InsightDirection | direction, | ||
double? | magnitude, | ||
double? | confidence, | ||
string | sourceModel = null , |
||
double? | weight = null |
||
) |
Initializes a new instance of the Insight class
symbol | The symbol this insight is for |
expiryFunc | Func that defines the expiry time |
type | The type of insight, price/volatility |
direction | The predicted direction |
magnitude | The predicted magnitude as a percentage change |
confidence | The confidence in this insight |
sourceModel | An identifier defining the model that generated this insight |
weight | The portfolio weight of this insight |
Definition at line 230 of file Insight.cs.
QuantConnect.Algorithm.Framework.Alphas.Insight.Insight | ( | DateTime | generatedTimeUtc, |
Symbol | symbol, | ||
TimeSpan | period, | ||
InsightType | type, | ||
InsightDirection | direction, | ||
double? | magnitude, | ||
double? | confidence, | ||
string | sourceModel = null , |
||
double? | weight = null |
||
) |
Initializes a new instance of the Insight class. This constructor is provided mostly for testing purposes. When running inside an algorithm, the generated and close times are set based on the algorithm's time.
generatedTimeUtc | The time this insight was generated in utc |
symbol | The symbol this insight is for |
period | The period over which the prediction will come true |
type | The type of insight, price/volatility |
direction | The predicted direction |
magnitude | The predicted magnitude as a percentage change |
confidence | The confidence in this insight |
sourceModel | An identifier defining the model that generated this insight |
weight | The portfolio weight of this insight |
Definition at line 249 of file Insight.cs.
bool QuantConnect.Algorithm.Framework.Alphas.Insight.IsExpired | ( | DateTime | utcTime | ) |
Determines whether or not this insight is considered expired at the specified utcTime
utcTime | The algorithm's current time in UTC. See IAlgorithm.UtcTime |
Definition at line 128 of file Insight.cs.
bool QuantConnect.Algorithm.Framework.Alphas.Insight.IsActive | ( | DateTime | utcTime | ) |
Determines whether or not this insight is considered active at the specified utcTime
utcTime | The algorithm's current time in UTC. See IAlgorithm.UtcTime |
Definition at line 138 of file Insight.cs.
void QuantConnect.Algorithm.Framework.Alphas.Insight.Expire | ( | DateTime | utcTime | ) |
Expire this insight
utcTime | The algorithm's current time in UTC. See IAlgorithm.UtcTime |
Definition at line 147 of file Insight.cs.
void QuantConnect.Algorithm.Framework.Alphas.Insight.Cancel | ( | DateTime | utcTime | ) |
Cancel this insight
utcTime | The algorithm's current time in UTC. See IAlgorithm.UtcTime |
Definition at line 160 of file Insight.cs.
void QuantConnect.Algorithm.Framework.Alphas.Insight.SetPeriodAndCloseTime | ( | SecurityExchangeHours | exchangeHours | ) |
Sets the insight period and close times if they have not already been set.
exchangeHours | The insight's security exchange hours |
Definition at line 296 of file Insight.cs.
|
virtual |
Creates a deep clone of this insight instance
Definition at line 310 of file Insight.cs.
|
static |
Creates a new insight for predicting the percent change in price over the specified period
symbol | The symbol this insight is for |
resolution | The resolution used to define the insight's period and also used to determine the insight's close time |
barCount | The number of resolution time steps to make in market hours to compute the insight's closing time |
direction | The predicted direction |
magnitude | The predicted magnitude as a percent change |
confidence | The confidence in this insight |
sourceModel | The model generating this insight |
weight | The portfolio weight of this insight |
Definition at line 338 of file Insight.cs.
|
static |
Creates a new insight for predicting the percent change in price over the specified period
symbol | The symbol this insight is for |
closeTimeLocal | The insight's closing time in the security's exchange time zone |
direction | The predicted direction |
magnitude | The predicted magnitude as a percent change |
confidence | The confidence in this insight |
sourceModel | The model generating this insight |
weight | The portfolio weight of this insight |
Definition at line 360 of file Insight.cs.
|
static |
Creates a new insight for predicting the percent change in price over the specified period
symbol | The symbol this insight is for |
period | The period over which the prediction will come true |
direction | The predicted direction |
magnitude | The predicted magnitude as a percent change |
confidence | The confidence in this insight |
sourceModel | The model generating this insight |
weight | The portfolio weight of this insight |
Definition at line 378 of file Insight.cs.
|
static |
Creates a new insight for predicting the percent change in price over the specified period
symbol | The symbol this insight is for |
expiryFunc | Func that defines the expiry time |
direction | The predicted direction |
magnitude | The predicted magnitude as a percent change |
confidence | The confidence in this insight |
sourceModel | The model generating this insight |
weight | The portfolio weight of this insight |
Definition at line 401 of file Insight.cs.
|
static |
Creates a new, unique group id and sets it on each insight
insights | The insights to be grouped |
Definition at line 410 of file Insight.cs.
|
static |
Creates a new, unique group id and sets it on each insight
insight | The insight to be grouped |
|
static |
Creates a new Insight object from the specified serialized form
serializedInsight | The insight DTO |
Definition at line 441 of file Insight.cs.
|
static |
Computes the insight closing time from the given generated time, resolution and bar count. This will step through market hours using the given resolution, respecting holidays, early closes, weekends, etc..
exchangeHours | The exchange hours of the insight's security |
generatedTimeUtc | The insight's generated time in utc |
resolution | The resolution used to 'step-through' market hours to compute a reasonable close time |
barCount | The number of resolution steps to take |
Definition at line 495 of file Insight.cs.
|
static |
computs the insight closing time from the given generated time and period
exchangeHours | The exchange hours of the insight's security |
generatedTimeUtc | The insight's generated time in utc |
period | The insight's period |
Definition at line 525 of file Insight.cs.
override string QuantConnect.Algorithm.Framework.Alphas.Insight.ToString | ( | ) |
Returns a string that represents the current object.
<filterpriority>2</filterpriority>
Definition at line 573 of file Insight.cs.
string QuantConnect.Algorithm.Framework.Alphas.Insight.ShortToString | ( | ) |
Returns a short string that represents the current object.
Definition at line 582 of file Insight.cs.
|
getprotected set |
Gets the unique identifier for this insight
Definition at line 39 of file Insight.cs.
|
getprotected set |
Gets the group id this insight belongs to, null if not in a group
Definition at line 44 of file Insight.cs.
|
getset |
Gets an identifier for the source model that generated this insight.
Definition at line 49 of file Insight.cs.
|
getset |
Gets the utc time this insight was generated
The algorithm framework handles setting this value appropriately. If providing custom Insight implementation, be sure to set this value to algorithm.UtcTime when the insight is generated.
Definition at line 59 of file Insight.cs.
|
getset |
Gets the insight's prediction end time. This is the time when this insight prediction is expected to be fulfilled. This time takes into account market hours, weekends, as well as the symbol's data resolution
Definition at line 66 of file Insight.cs.
|
get |
Gets the symbol this insight is for
Definition at line 71 of file Insight.cs.
|
get |
Gets the type of insight, for example, price insight or volatility insight
Definition at line 76 of file Insight.cs.
|
getset |
Gets the initial reference value this insight is predicting against. The value is dependent on the specified InsightType
Definition at line 81 of file Insight.cs.
|
getset |
Gets the final reference value, used for scoring, this insight is predicting against. The value is dependent on the specified InsightType
Definition at line 86 of file Insight.cs.
|
get |
Gets the predicted direction, down, flat or up
Definition at line 91 of file Insight.cs.
|
getset |
Gets the period over which this insight is expected to come to fruition
Definition at line 96 of file Insight.cs.
|
get |
Gets the predicted percent change in the insight type (price/volatility)
Definition at line 101 of file Insight.cs.
|
get |
Gets the confidence in this insight
Definition at line 106 of file Insight.cs.
|
get |
Gets the portfolio weight of this insight
Definition at line 111 of file Insight.cs.
|
getprotected set |
Gets the most recent scores for this insight
Definition at line 116 of file Insight.cs.
|
getset |
Gets the estimated value of this insight in the account currency
Definition at line 121 of file Insight.cs.