SecurityBenchmark
QuantConnect.Benchmarks.SecurityBenchmark
SecurityBenchmark(security: Security)
Bases: Object, IBenchmark
Creates a benchmark defined by the closing price of a security instance
Initializes a new instance of the SecurityBenchmark class
create_instance
create_instance(
securities: SecurityManager,
symbol: Union[Symbol, str, BaseContract],
) -> SecurityBenchmark
Helper function that will create a security with the given SecurityManager for a specific symbol and then create a SecurityBenchmark for it
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
securities
|
SecurityManager
|
SecurityService to create the security |
required |
symbol
|
Union[Symbol, str, BaseContract]
|
The symbol to create a security benchmark with |
required |
Returns:
| Type | Description |
|---|---|
SecurityBenchmark
|
The new SecurityBenchmark. |
evaluate
evaluate(time: Union[datetime, date]) -> float
Evaluates this benchmark at the specified time in units of the account's currency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Union[datetime, date]
|
The time to evaluate the benchmark at |
required |
Returns:
| Type | Description |
|---|---|
float
|
The value of the benchmark at the specified time in units of the account's currency. |