quantconnect-stubs 17357__py3-none-any.whl → 17410__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Common/Util/__init__.py +32 -0
- Common/Util/__init__.pyi +152 -0
- QuantConnect/Algorithm/Framework/Alphas/__init__.pyi +4 -14
- QuantConnect/Algorithm/Framework/Execution/__init__.pyi +4 -1
- QuantConnect/Algorithm/Framework/Selection/__init__.pyi +8 -2
- QuantConnect/Algorithm/__init__.pyi +70 -74
- QuantConnect/AlgorithmFactory/Python/Wrappers/__init__.pyi +24 -3
- QuantConnect/Api/__init__.pyi +36 -3
- QuantConnect/Brokerages/__init__.pyi +71 -0
- QuantConnect/Data/Market/__init__.pyi +23 -187
- QuantConnect/Data/__init__.pyi +6 -1
- QuantConnect/Indicators/__init__.pyi +144 -93
- QuantConnect/Interfaces/__init__.pyi +36 -5
- QuantConnect/Lean/Engine/DataFeeds/Enumerators/Factories/__init__.pyi +1 -2
- QuantConnect/Lean/Engine/DataFeeds/__init__.pyi +23 -2
- QuantConnect/Lean/Engine/Results/__init__.pyi +0 -38
- QuantConnect/Orders/Fees/__init__.pyi +35 -0
- QuantConnect/Orders/__init__.pyi +49 -0
- QuantConnect/Packets/__init__.pyi +52 -0
- QuantConnect/Python/__init__.pyi +16 -1
- QuantConnect/Securities/Interfaces/__init__.pyi +2 -0
- QuantConnect/Securities/__init__.pyi +30 -133
- QuantConnect/Util/__init__.pyi +15 -0
- QuantConnect/__init__.pyi +93 -0
- System/Buffers/Binary/__init__.pyi +33 -0
- System/Diagnostics/Tracing/__init__.pyi +8 -0
- System/IO/__init__.pyi +12 -0
- System/Runtime/CompilerServices/__init__.pyi +16 -0
- System/Runtime/Intrinsics/Arm/__init__.pyi +22 -14
- System/Threading/__init__.pyi +47 -47
- System/__init__.pyi +36 -0
- {quantconnect_stubs-17357.dist-info → quantconnect_stubs-17410.dist-info}/METADATA +1 -1
- {quantconnect_stubs-17357.dist-info → quantconnect_stubs-17410.dist-info}/RECORD +35 -33
- {quantconnect_stubs-17357.dist-info → quantconnect_stubs-17410.dist-info}/WHEEL +0 -0
- {quantconnect_stubs-17357.dist-info → quantconnect_stubs-17410.dist-info}/top_level.txt +0 -0
Common/Util/__init__.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
# If quantconnect-stubs is installed via pip and Lean is ran locally,
|
|
5
|
+
# importing anything from the current namespace makes the Python
|
|
6
|
+
# interpreter look in the quantconnect-stubs package for the implementation.
|
|
7
|
+
#
|
|
8
|
+
# The desired behavior is for the interpreter to use the implementation
|
|
9
|
+
# provided by the AddReference() call from Python.NET.
|
|
10
|
+
#
|
|
11
|
+
# To fix this, we temporarily remove the directory containing the
|
|
12
|
+
# quantconnect-stubs package from sys.path and re-import the current namespace
|
|
13
|
+
# so the relevant C# namespace is used when running Lean locally.
|
|
14
|
+
|
|
15
|
+
# Find the directory containing quantconnect-stubs (usually site-packages)
|
|
16
|
+
current_path = os.path.dirname(__file__)
|
|
17
|
+
while os.path.basename(current_path) != "Common":
|
|
18
|
+
current_path = os.path.dirname(current_path)
|
|
19
|
+
current_path = os.path.dirname(current_path)
|
|
20
|
+
|
|
21
|
+
# Temporarily remove the directory containing quantconnect-stubs from sys.path
|
|
22
|
+
original_path = sys.path[:]
|
|
23
|
+
sys.path.remove(current_path)
|
|
24
|
+
|
|
25
|
+
# Import the C# version of the current namespace
|
|
26
|
+
del sys.modules["Common.Util"]
|
|
27
|
+
from clr import AddReference
|
|
28
|
+
AddReference("Common.Util")
|
|
29
|
+
from Common.Util import *
|
|
30
|
+
|
|
31
|
+
# Restore sys.path
|
|
32
|
+
sys.path = original_path
|
Common/Util/__init__.pyi
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
from typing import overload
|
|
2
|
+
from enum import IntEnum
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import Common.Util
|
|
6
|
+
import QuantConnect
|
|
7
|
+
import System.Collections.Generic
|
|
8
|
+
|
|
9
|
+
Common_Util_ReadOnlyExtendedDictionary_TValue = typing.TypeVar("Common_Util_ReadOnlyExtendedDictionary_TValue")
|
|
10
|
+
Common_Util_ReadOnlyExtendedDictionary_TKey = typing.TypeVar("Common_Util_ReadOnlyExtendedDictionary_TKey")
|
|
11
|
+
Common_Util_BaseExtendedDictionary_TDictionary = typing.TypeVar("Common_Util_BaseExtendedDictionary_TDictionary")
|
|
12
|
+
Common_Util_BaseExtendedDictionary_TKey = typing.TypeVar("Common_Util_BaseExtendedDictionary_TKey")
|
|
13
|
+
Common_Util_BaseExtendedDictionary_TValue = typing.TypeVar("Common_Util_BaseExtendedDictionary_TValue")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ReadOnlyExtendedDictionary(typing.Generic[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue], Common.Util.BaseExtendedDictionary[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue], System.Collections.Generic.IReadOnlyDictionary[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue]):
|
|
17
|
+
"""This class has no documentation."""
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def is_read_only(self) -> bool:
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
def __getitem__(self, key: Common_Util_ReadOnlyExtendedDictionary_TKey) -> Common_Util_ReadOnlyExtendedDictionary_TValue:
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
@overload
|
|
27
|
+
def __init__(self) -> None:
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
@overload
|
|
31
|
+
def __init__(self, dictionary: System.Collections.Generic.IDictionary[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue]) -> None:
|
|
32
|
+
...
|
|
33
|
+
|
|
34
|
+
@overload
|
|
35
|
+
def __init__(self, data: System.Collections.Generic.IEnumerable[Common_Util_ReadOnlyExtendedDictionary_TValue], key_selector: typing.Callable[[Common_Util_ReadOnlyExtendedDictionary_TValue], Common_Util_ReadOnlyExtendedDictionary_TKey]) -> None:
|
|
36
|
+
...
|
|
37
|
+
|
|
38
|
+
def __setitem__(self, key: Common_Util_ReadOnlyExtendedDictionary_TKey, value: Common_Util_ReadOnlyExtendedDictionary_TValue) -> None:
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
@overload
|
|
42
|
+
def add(self, key: Common_Util_ReadOnlyExtendedDictionary_TKey, value: Common_Util_ReadOnlyExtendedDictionary_TValue) -> None:
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
@overload
|
|
46
|
+
def add(self, item: System.Collections.Generic.KeyValuePair[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue]) -> None:
|
|
47
|
+
...
|
|
48
|
+
|
|
49
|
+
def clear(self) -> None:
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
@overload
|
|
53
|
+
def remove(self, key: Common_Util_ReadOnlyExtendedDictionary_TKey) -> bool:
|
|
54
|
+
...
|
|
55
|
+
|
|
56
|
+
@overload
|
|
57
|
+
def remove(self, item: System.Collections.Generic.KeyValuePair[Common_Util_ReadOnlyExtendedDictionary_TKey, Common_Util_ReadOnlyExtendedDictionary_TValue]) -> bool:
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class BaseExtendedDictionary(typing.Generic[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue, Common_Util_BaseExtendedDictionary_TDictionary], QuantConnect.ExtendedDictionary[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue], System.Collections.Generic.IDictionary[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue], typing.Iterable[System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]]):
|
|
62
|
+
"""This class has no documentation."""
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def dictionary(self) -> Common_Util_BaseExtendedDictionary_TDictionary:
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def count(self) -> int:
|
|
70
|
+
...
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def is_read_only(self) -> bool:
|
|
74
|
+
...
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def get_keys(self) -> typing.Iterable[Common_Util_BaseExtendedDictionary_TKey]:
|
|
78
|
+
...
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def get_values(self) -> typing.Iterable[Common_Util_BaseExtendedDictionary_TValue]:
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
def __contains__(self, key: Common_Util_BaseExtendedDictionary_TKey) -> bool:
|
|
85
|
+
...
|
|
86
|
+
|
|
87
|
+
def __getitem__(self, key: Common_Util_BaseExtendedDictionary_TKey) -> Common_Util_BaseExtendedDictionary_TValue:
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
@overload
|
|
91
|
+
def __init__(self) -> None:
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
@overload
|
|
95
|
+
def __init__(self, dictionary: Common_Util_BaseExtendedDictionary_TDictionary) -> None:
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
@overload
|
|
99
|
+
def __init__(self, data: System.Collections.Generic.IEnumerable[Common_Util_BaseExtendedDictionary_TValue], key_selector: typing.Callable[[Common_Util_BaseExtendedDictionary_TValue], Common_Util_BaseExtendedDictionary_TKey]) -> None:
|
|
100
|
+
...
|
|
101
|
+
|
|
102
|
+
@overload
|
|
103
|
+
def __init__(self, dictionary: System.Collections.Generic.IDictionary[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]) -> None:
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
def __iter__(self) -> typing.Iterator[System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]]:
|
|
107
|
+
...
|
|
108
|
+
|
|
109
|
+
def __len__(self) -> int:
|
|
110
|
+
...
|
|
111
|
+
|
|
112
|
+
def __setitem__(self, key: Common_Util_BaseExtendedDictionary_TKey, value: Common_Util_BaseExtendedDictionary_TValue) -> None:
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
@overload
|
|
116
|
+
def add(self, key: Common_Util_BaseExtendedDictionary_TKey, value: Common_Util_BaseExtendedDictionary_TValue) -> None:
|
|
117
|
+
...
|
|
118
|
+
|
|
119
|
+
@overload
|
|
120
|
+
def add(self, item: System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]) -> None:
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
def clear(self) -> None:
|
|
124
|
+
...
|
|
125
|
+
|
|
126
|
+
def contains(self, item: System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]) -> bool:
|
|
127
|
+
...
|
|
128
|
+
|
|
129
|
+
def contains_key(self, key: Common_Util_BaseExtendedDictionary_TKey) -> bool:
|
|
130
|
+
...
|
|
131
|
+
|
|
132
|
+
def copy_to(self, array: typing.List[System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]], array_index: int) -> None:
|
|
133
|
+
...
|
|
134
|
+
|
|
135
|
+
def get_enumerator(self) -> System.Collections.Generic.IEnumerator[System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]]:
|
|
136
|
+
...
|
|
137
|
+
|
|
138
|
+
def get_items(self) -> System.Collections.Generic.IEnumerable[System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]]:
|
|
139
|
+
...
|
|
140
|
+
|
|
141
|
+
@overload
|
|
142
|
+
def remove(self, key: Common_Util_BaseExtendedDictionary_TKey) -> bool:
|
|
143
|
+
...
|
|
144
|
+
|
|
145
|
+
@overload
|
|
146
|
+
def remove(self, item: System.Collections.Generic.KeyValuePair[Common_Util_BaseExtendedDictionary_TKey, Common_Util_BaseExtendedDictionary_TValue]) -> bool:
|
|
147
|
+
...
|
|
148
|
+
|
|
149
|
+
def try_get_value(self, key: Common_Util_BaseExtendedDictionary_TKey, value: typing.Optional[Common_Util_BaseExtendedDictionary_TValue]) -> typing.Tuple[bool, Common_Util_BaseExtendedDictionary_TValue]:
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
|
|
@@ -20,6 +20,8 @@ import QuantConnect.Securities
|
|
|
20
20
|
import System
|
|
21
21
|
import System.Collections.Generic
|
|
22
22
|
|
|
23
|
+
QuantConnect_Algorithm_Framework_Alphas_AlphaModel = typing.Any
|
|
24
|
+
|
|
23
25
|
|
|
24
26
|
class InsightType(IntEnum):
|
|
25
27
|
"""Specifies the type of insight"""
|
|
@@ -569,7 +571,7 @@ class INamedModel(metaclass=abc.ABCMeta):
|
|
|
569
571
|
...
|
|
570
572
|
|
|
571
573
|
|
|
572
|
-
class AlphaModel(
|
|
574
|
+
class AlphaModel(QuantConnect.Python.BasePythonWrapper[QuantConnect_Algorithm_Framework_Alphas_AlphaModel], QuantConnect.Algorithm.Framework.Alphas.IAlphaModel, QuantConnect.Algorithm.Framework.Alphas.INamedModel):
|
|
573
575
|
"""Provides a base class for alpha models."""
|
|
574
576
|
|
|
575
577
|
@property
|
|
@@ -940,19 +942,7 @@ class HistoricalReturnsAlphaModel(QuantConnect.Algorithm.Framework.Alphas.AlphaM
|
|
|
940
942
|
class ConstantAlphaModel(QuantConnect.Algorithm.Framework.Alphas.AlphaModel):
|
|
941
943
|
"""Provides an implementation of IAlphaModel that always returns the same insight for each security"""
|
|
942
944
|
|
|
943
|
-
|
|
944
|
-
def __init__(self, type: QuantConnect.Algorithm.Framework.Alphas.InsightType, direction: QuantConnect.Algorithm.Framework.Alphas.InsightDirection, period: datetime.timedelta) -> None:
|
|
945
|
-
"""
|
|
946
|
-
Initializes a new instance of the ConstantAlphaModel class
|
|
947
|
-
|
|
948
|
-
:param type: The type of insight
|
|
949
|
-
:param direction: The direction of the insight
|
|
950
|
-
:param period: The period over which the insight with come to fruition
|
|
951
|
-
"""
|
|
952
|
-
...
|
|
953
|
-
|
|
954
|
-
@overload
|
|
955
|
-
def __init__(self, type: QuantConnect.Algorithm.Framework.Alphas.InsightType, direction: QuantConnect.Algorithm.Framework.Alphas.InsightDirection, period: datetime.timedelta, magnitude: typing.Optional[float], confidence: typing.Optional[float], weight: typing.Optional[float] = None) -> None:
|
|
945
|
+
def __init__(self, type: QuantConnect.Algorithm.Framework.Alphas.InsightType, direction: QuantConnect.Algorithm.Framework.Alphas.InsightDirection, period: datetime.timedelta, magnitude: typing.Optional[float] = None, confidence: typing.Optional[float] = None, weight: typing.Optional[float] = None) -> None:
|
|
956
946
|
"""
|
|
957
947
|
Initializes a new instance of the ConstantAlphaModel class
|
|
958
948
|
|
|
@@ -13,9 +13,12 @@ import QuantConnect.Data.Market
|
|
|
13
13
|
import QuantConnect.Data.UniverseSelection
|
|
14
14
|
import QuantConnect.Indicators
|
|
15
15
|
import QuantConnect.Orders
|
|
16
|
+
import QuantConnect.Python
|
|
16
17
|
import QuantConnect.Securities
|
|
17
18
|
import System
|
|
18
19
|
|
|
20
|
+
QuantConnect_Algorithm_Framework_Execution_ExecutionModel = typing.Any
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
class IExecutionModel(QuantConnect.Algorithm.Framework.INotifiedSecurityChanges, metaclass=abc.ABCMeta):
|
|
21
24
|
"""Algorithm framework model that executes portfolio targets"""
|
|
@@ -41,7 +44,7 @@ class IExecutionModel(QuantConnect.Algorithm.Framework.INotifiedSecurityChanges,
|
|
|
41
44
|
...
|
|
42
45
|
|
|
43
46
|
|
|
44
|
-
class ExecutionModel(
|
|
47
|
+
class ExecutionModel(QuantConnect.Python.BasePythonWrapper[QuantConnect_Algorithm_Framework_Execution_ExecutionModel], QuantConnect.Algorithm.Framework.Execution.IExecutionModel):
|
|
45
48
|
"""Provides a base class for execution models"""
|
|
46
49
|
|
|
47
50
|
@property
|
|
@@ -13,11 +13,13 @@ import QuantConnect.Data.Fundamental
|
|
|
13
13
|
import QuantConnect.Data.Market
|
|
14
14
|
import QuantConnect.Data.UniverseSelection
|
|
15
15
|
import QuantConnect.Interfaces
|
|
16
|
+
import QuantConnect.Python
|
|
16
17
|
import QuantConnect.Scheduling
|
|
17
18
|
import QuantConnect.Securities
|
|
18
|
-
import System
|
|
19
19
|
import System.Collections.Generic
|
|
20
20
|
|
|
21
|
+
QuantConnect_Algorithm_Framework_Selection_UniverseSelectionModel = typing.Any
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
class IUniverseSelectionModel(metaclass=abc.ABCMeta):
|
|
23
25
|
"""Algorithm framework model that defines the universes to be used by an algorithm"""
|
|
@@ -36,9 +38,13 @@ class IUniverseSelectionModel(metaclass=abc.ABCMeta):
|
|
|
36
38
|
...
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
class UniverseSelectionModel(
|
|
41
|
+
class UniverseSelectionModel(QuantConnect.Python.BasePythonWrapper[QuantConnect_Algorithm_Framework_Selection_UniverseSelectionModel], QuantConnect.Algorithm.Framework.Selection.IUniverseSelectionModel):
|
|
40
42
|
"""Provides a base class for universe selection models."""
|
|
41
43
|
|
|
44
|
+
def __init__(self) -> None:
|
|
45
|
+
"""Initializes a new instance of the UniverseSelectionModel class."""
|
|
46
|
+
...
|
|
47
|
+
|
|
42
48
|
def create_universes(self, algorithm: QuantConnect.Algorithm.QCAlgorithm) -> typing.Iterable[QuantConnect.Data.UniverseSelection.Universe]:
|
|
43
49
|
"""
|
|
44
50
|
Creates the universes for this algorithm. Called once after IAlgorithm.initialize
|
|
@@ -4,6 +4,7 @@ import datetime
|
|
|
4
4
|
import typing
|
|
5
5
|
import warnings
|
|
6
6
|
|
|
7
|
+
import Common.Util
|
|
7
8
|
import QuantConnect
|
|
8
9
|
import QuantConnect.Algorithm
|
|
9
10
|
import QuantConnect.Algorithm.Framework.Alphas
|
|
@@ -1055,7 +1056,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1055
1056
|
@property
|
|
1056
1057
|
def securities(self) -> QuantConnect.Securities.SecurityManager:
|
|
1057
1058
|
"""
|
|
1058
|
-
Security collection is an array of the security objects such as
|
|
1059
|
+
Security collection is an array of the security objects such as Equity and Forex. Securities data
|
|
1059
1060
|
manages the properties of tradeable assets such as price, open and close time and holdings information.
|
|
1060
1061
|
"""
|
|
1061
1062
|
...
|
|
@@ -1065,7 +1066,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1065
1066
|
...
|
|
1066
1067
|
|
|
1067
1068
|
@property
|
|
1068
|
-
def active_securities(self) ->
|
|
1069
|
+
def active_securities(self) -> Common.Util.ReadOnlyExtendedDictionary[QuantConnect.Symbol, QuantConnect.Securities.Security]:
|
|
1069
1070
|
"""
|
|
1070
1071
|
Read-only dictionary containing all active securities. An active security is
|
|
1071
1072
|
a security that is currently selected by the universe or has holdings or open orders.
|
|
@@ -1377,7 +1378,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1377
1378
|
|
|
1378
1379
|
@property
|
|
1379
1380
|
def benchmark(self) -> QuantConnect.Benchmarks.IBenchmark:
|
|
1380
|
-
"""
|
|
1381
|
+
"""The IBenchmark for the algorithm"""
|
|
1381
1382
|
...
|
|
1382
1383
|
|
|
1383
1384
|
@property
|
|
@@ -1490,11 +1491,11 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1490
1491
|
"""
|
|
1491
1492
|
Creates and adds a new Cfd security to the algorithm
|
|
1492
1493
|
|
|
1493
|
-
:param ticker: The
|
|
1494
|
+
:param ticker: The CFD ticker symbol
|
|
1494
1495
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1495
|
-
:param market: The cfd trading market, Market. Default value is null and looked up using
|
|
1496
|
+
:param market: The cfd trading market, Market. Default value is null and looked up using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1496
1497
|
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1497
|
-
:param leverage: The requested leverage for this
|
|
1498
|
+
:param leverage: The requested leverage for this CFD. Default is set by security_initializer
|
|
1498
1499
|
:returns: The new Cfd security.
|
|
1499
1500
|
"""
|
|
1500
1501
|
...
|
|
@@ -1516,27 +1517,17 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1516
1517
|
...
|
|
1517
1518
|
|
|
1518
1519
|
def add_crypto(self, ticker: str, resolution: typing.Optional[QuantConnect.Resolution] = None, market: str = None, fill_forward: bool = True, leverage: float = ...) -> QuantConnect.Securities.Crypto.Crypto:
|
|
1519
|
-
"""
|
|
1520
|
-
Creates and adds a new Crypto security to the algorithm
|
|
1521
|
-
|
|
1522
|
-
:param ticker: The currency pair
|
|
1523
|
-
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1524
|
-
:param market: The cfd trading market, Market. Default value is null and looked up using BrokerageModel.DefaultMarkets in AddSecurity{T}
|
|
1525
|
-
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1526
|
-
:param leverage: The requested leverage for this equity. Default is set by security_initializer
|
|
1527
|
-
:returns: The new Crypto security.
|
|
1528
|
-
"""
|
|
1529
1520
|
...
|
|
1530
1521
|
|
|
1531
1522
|
def add_crypto_future(self, ticker: str, resolution: typing.Optional[QuantConnect.Resolution] = None, market: str = None, fill_forward: bool = True, leverage: float = ...) -> QuantConnect.Securities.CryptoFuture.CryptoFuture:
|
|
1532
1523
|
"""
|
|
1533
1524
|
Creates and adds a new CryptoFuture security to the algorithm
|
|
1534
1525
|
|
|
1535
|
-
:param ticker: The
|
|
1526
|
+
:param ticker: The crypto future ticker symbol
|
|
1536
1527
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1537
|
-
:param market: The
|
|
1528
|
+
:param market: The The crypto future trading market, Market. Default value is null and looked up using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1538
1529
|
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1539
|
-
:param leverage: The requested leverage for this
|
|
1530
|
+
:param leverage: The requested leverage for this crypto future. Default is set by security_initializer
|
|
1540
1531
|
:returns: The new CryptoFuture security.
|
|
1541
1532
|
"""
|
|
1542
1533
|
...
|
|
@@ -1684,29 +1675,14 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1684
1675
|
|
|
1685
1676
|
:param ticker: The currency pair
|
|
1686
1677
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1687
|
-
:param market: The foreign exchange trading market, Market. Default value is null and looked up using
|
|
1678
|
+
:param market: The foreign exchange trading market, Market. Default value is null and looked up using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1688
1679
|
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1689
|
-
:param leverage: The requested leverage for this
|
|
1680
|
+
:param leverage: The requested leverage for this forex security. Default is set by security_initializer
|
|
1690
1681
|
:returns: The new Forex security.
|
|
1691
1682
|
"""
|
|
1692
1683
|
...
|
|
1693
1684
|
|
|
1694
1685
|
def add_future(self, ticker: str, resolution: typing.Optional[QuantConnect.Resolution] = None, market: str = None, fill_forward: bool = True, leverage: float = ..., extended_market_hours: bool = False, data_mapping_mode: typing.Optional[QuantConnect.DataMappingMode] = None, data_normalization_mode: typing.Optional[QuantConnect.DataNormalizationMode] = None, contract_depth_offset: int = 0) -> QuantConnect.Securities.Future.Future:
|
|
1695
|
-
"""
|
|
1696
|
-
Creates and adds a new Future security to the algorithm
|
|
1697
|
-
|
|
1698
|
-
:param ticker: The future ticker
|
|
1699
|
-
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1700
|
-
:param market: The futures market, Market. Default is value null and looked up using BrokerageModel.DefaultMarkets in AddSecurity{T}
|
|
1701
|
-
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1702
|
-
:param leverage: The requested leverage for this equity. Default is set by security_initializer
|
|
1703
|
-
:param extended_market_hours: Use extended market hours data
|
|
1704
|
-
:param data_mapping_mode: The contract mapping mode to use for the continuous future contract
|
|
1705
|
-
:param data_normalization_mode: The price scaling mode to use for the continuous future contract
|
|
1706
|
-
:param contract_depth_offset: The continuous future contract desired offset from the current front month.
|
|
1707
|
-
For example, 0 (default) will use the front month, 1 will use the back month contract
|
|
1708
|
-
:returns: The new Future security.
|
|
1709
|
-
"""
|
|
1710
1686
|
...
|
|
1711
1687
|
|
|
1712
1688
|
def add_future_contract(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], resolution: typing.Optional[QuantConnect.Resolution] = None, fill_forward: bool = True, leverage: float = ..., extended_market_hours: bool = False) -> QuantConnect.Securities.Future.Future:
|
|
@@ -1716,7 +1692,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1716
1692
|
:param symbol: The futures contract symbol
|
|
1717
1693
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1718
1694
|
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1719
|
-
:param leverage: The requested leverage for this
|
|
1695
|
+
:param leverage: The requested leverage for this future. Default is set by security_initializer
|
|
1720
1696
|
:param extended_market_hours: Use extended market hours data
|
|
1721
1697
|
:returns: The new Future security.
|
|
1722
1698
|
"""
|
|
@@ -1757,15 +1733,6 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1757
1733
|
...
|
|
1758
1734
|
|
|
1759
1735
|
def add_index(self, ticker: str, resolution: typing.Optional[QuantConnect.Resolution] = None, market: str = None, fill_forward: bool = True) -> QuantConnect.Securities.Index.Index:
|
|
1760
|
-
"""
|
|
1761
|
-
Creates and adds a new Index security to the algorithm
|
|
1762
|
-
|
|
1763
|
-
:param ticker: The currency pair
|
|
1764
|
-
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1765
|
-
:param market: The index trading market, Market. Default value is null and looked up using BrokerageModel.DefaultMarkets in AddSecurity{T}
|
|
1766
|
-
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1767
|
-
:returns: The new Index security.
|
|
1768
|
-
"""
|
|
1769
1736
|
...
|
|
1770
1737
|
|
|
1771
1738
|
@overload
|
|
@@ -1773,9 +1740,9 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1773
1740
|
"""
|
|
1774
1741
|
Creates and adds index options to the algorithm.
|
|
1775
1742
|
|
|
1776
|
-
:param underlying: The underlying ticker of the
|
|
1743
|
+
:param underlying: The underlying ticker of the IndexOption
|
|
1777
1744
|
:param resolution: Resolution of the index option contracts, i.e. the granularity of the data
|
|
1778
|
-
:param market: The foreign exchange trading market, Market. Default value is null and looked up using
|
|
1745
|
+
:param market: The foreign exchange trading market, Market. Default value is null and looked up using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1779
1746
|
:param fill_forward: If true, this will fill in missing data points with the previous data point
|
|
1780
1747
|
:returns: Canonical Option security.
|
|
1781
1748
|
"""
|
|
@@ -1808,16 +1775,6 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1808
1775
|
|
|
1809
1776
|
@overload
|
|
1810
1777
|
def add_index_option(self, underlying: str, target_option: str, resolution: typing.Optional[QuantConnect.Resolution] = None, market: str = None, fill_forward: bool = True) -> QuantConnect.Securities.IndexOption.IndexOption:
|
|
1811
|
-
"""
|
|
1812
|
-
Creates and adds index options to the algorithm.
|
|
1813
|
-
|
|
1814
|
-
:param underlying: The underlying ticker of the Index Option
|
|
1815
|
-
:param target_option: The target option ticker. This is useful when the option ticker does not match the underlying, e.g. SPX index and the SPXW weekly option. If null is provided will use underlying
|
|
1816
|
-
:param resolution: Resolution of the index option contracts, i.e. the granularity of the data
|
|
1817
|
-
:param market: The foreign exchange trading market, Market. Default value is null and looked up using BrokerageModel.DefaultMarkets in AddSecurity{T}
|
|
1818
|
-
:param fill_forward: If true, this will fill in missing data points with the previous data point
|
|
1819
|
-
:returns: Canonical Option security.
|
|
1820
|
-
"""
|
|
1821
1778
|
...
|
|
1822
1779
|
|
|
1823
1780
|
def add_index_option_contract(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], resolution: typing.Optional[QuantConnect.Resolution] = None, fill_forward: bool = True) -> QuantConnect.Securities.IndexOption.IndexOption:
|
|
@@ -1854,7 +1811,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1854
1811
|
|
|
1855
1812
|
:param underlying: Underlying asset Symbol to use as the option's underlying
|
|
1856
1813
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1857
|
-
:param market: The option's market, Market. Default value is null, but will be resolved using
|
|
1814
|
+
:param market: The option's market, Market. Default value is null, but will be resolved using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1858
1815
|
:param fill_forward: If true, data will be provided to the algorithm every Second, Minute, Hour, or Day, while the asset is open and depending on the Resolution this option was configured to use.
|
|
1859
1816
|
:param leverage: The requested leverage for the
|
|
1860
1817
|
:returns: The new option security instance.
|
|
@@ -1871,7 +1828,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1871
1828
|
:param underlying: Underlying asset Symbol to use as the option's underlying
|
|
1872
1829
|
:param target_option: The target option ticker. This is useful when the option ticker does not match the underlying, e.g. SPX index and the SPXW weekly option. If null is provided will use underlying
|
|
1873
1830
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1874
|
-
:param market: The option's market, Market. Default value is null, but will be resolved using
|
|
1831
|
+
:param market: The option's market, Market. Default value is null, but will be resolved using IBrokerageModel.default_markets in AddSecurity{T}
|
|
1875
1832
|
:param fill_forward: If true, data will be provided to the algorithm every Second, Minute, Hour, or Day, while the asset is open and depending on the Resolution this option was configured to use.
|
|
1876
1833
|
:param leverage: The requested leverage for the
|
|
1877
1834
|
:returns: The new option security instance.
|
|
@@ -1885,7 +1842,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
1885
1842
|
:param symbol: The option contract symbol
|
|
1886
1843
|
:param resolution: The Resolution of market data, Tick, Second, Minute, Hour, or Daily. Default is Resolution.MINUTE
|
|
1887
1844
|
:param fill_forward: If true, returns the last available data even if none in that timeslice. Default is true
|
|
1888
|
-
:param leverage: The requested leverage for this
|
|
1845
|
+
:param leverage: The requested leverage for this option. Default is set by security_initializer
|
|
1889
1846
|
:param extended_market_hours: Use extended market hours data
|
|
1890
1847
|
:returns: The new Option security.
|
|
1891
1848
|
"""
|
|
@@ -3377,8 +3334,8 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
3377
3334
|
|
|
3378
3335
|
def framework_post_initialize(self) -> None:
|
|
3379
3336
|
"""
|
|
3380
|
-
Called by setup handlers after
|
|
3381
|
-
the data gather in the
|
|
3337
|
+
Called by setup handlers after initialize and allows the algorithm a chance to organize
|
|
3338
|
+
the data gather in the initialize method
|
|
3382
3339
|
"""
|
|
3383
3340
|
...
|
|
3384
3341
|
|
|
@@ -3475,6 +3432,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
3475
3432
|
"""
|
|
3476
3433
|
...
|
|
3477
3434
|
|
|
3435
|
+
@overload
|
|
3478
3436
|
def get_last_known_price(self, security: QuantConnect.Securities.Security) -> QuantConnect.Data.BaseData:
|
|
3479
3437
|
"""
|
|
3480
3438
|
Get the last known price using the history provider.
|
|
@@ -3486,7 +3444,21 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
3486
3444
|
:param security: Security object for which to retrieve historical data
|
|
3487
3445
|
:returns: A single BaseData object with the last known price.
|
|
3488
3446
|
"""
|
|
3489
|
-
|
|
3447
|
+
...
|
|
3448
|
+
|
|
3449
|
+
@overload
|
|
3450
|
+
def get_last_known_price(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> QuantConnect.Data.BaseData:
|
|
3451
|
+
"""
|
|
3452
|
+
Get the last known price using the history provider.
|
|
3453
|
+
Useful for seeding securities with the correct price
|
|
3454
|
+
|
|
3455
|
+
|
|
3456
|
+
This method is obsolete please use 'GetLastKnownPrices' which will return the last data point for each type associated with the requested security
|
|
3457
|
+
|
|
3458
|
+
:param symbol: Symbol for which to retrieve historical data
|
|
3459
|
+
:returns: A single BaseData object with the last known price.
|
|
3460
|
+
"""
|
|
3461
|
+
...
|
|
3490
3462
|
|
|
3491
3463
|
@overload
|
|
3492
3464
|
def get_last_known_prices(self, security: QuantConnect.Securities.Security) -> typing.Iterable[QuantConnect.Data.BaseData]:
|
|
@@ -3501,13 +3473,33 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
3501
3473
|
@overload
|
|
3502
3474
|
def get_last_known_prices(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> typing.Iterable[QuantConnect.Data.BaseData]:
|
|
3503
3475
|
"""
|
|
3504
|
-
Yields data to
|
|
3476
|
+
Yields data to warm up a security for all its subscribed data types
|
|
3505
3477
|
|
|
3506
3478
|
:param symbol: The symbol we want to get seed data for
|
|
3507
3479
|
:returns: Securities historical data.
|
|
3508
3480
|
"""
|
|
3509
3481
|
...
|
|
3510
3482
|
|
|
3483
|
+
@overload
|
|
3484
|
+
def get_last_known_prices(self, securities: typing.List[QuantConnect.Securities.Security]) -> QuantConnect.Data.Market.DataDictionary[typing.Iterable[QuantConnect.Data.BaseData]]:
|
|
3485
|
+
"""
|
|
3486
|
+
Yields data to warm up multiple securities for all their subscribed data types
|
|
3487
|
+
|
|
3488
|
+
:param securities: The securities we want to get seed data for
|
|
3489
|
+
:returns: Securities historical data.
|
|
3490
|
+
"""
|
|
3491
|
+
...
|
|
3492
|
+
|
|
3493
|
+
@overload
|
|
3494
|
+
def get_last_known_prices(self, symbols: typing.List[QuantConnect.Symbol]) -> QuantConnect.Data.Market.DataDictionary[typing.Iterable[QuantConnect.Data.BaseData]]:
|
|
3495
|
+
"""
|
|
3496
|
+
Yields data to warm up multiple securities for all their subscribed data types
|
|
3497
|
+
|
|
3498
|
+
:param symbols: The symbols we want to get seed data for
|
|
3499
|
+
:returns: Securities historical data.
|
|
3500
|
+
"""
|
|
3501
|
+
...
|
|
3502
|
+
|
|
3511
3503
|
def get_locked(self) -> bool:
|
|
3512
3504
|
"""Gets whether or not this algorithm has been locked and fully initialized"""
|
|
3513
3505
|
...
|
|
@@ -3548,7 +3540,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
3548
3540
|
"""
|
|
3549
3541
|
...
|
|
3550
3542
|
|
|
3551
|
-
def get_parameters(self) ->
|
|
3543
|
+
def get_parameters(self) -> Common.Util.ReadOnlyExtendedDictionary[str, str]:
|
|
3552
3544
|
"""Gets a read-only dictionary with all current parameters"""
|
|
3553
3545
|
...
|
|
3554
3546
|
|
|
@@ -4412,7 +4404,11 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
4412
4404
|
...
|
|
4413
4405
|
|
|
4414
4406
|
def on_brokerage_message(self, message_event: QuantConnect.Brokerages.BrokerageMessageEvent) -> None:
|
|
4415
|
-
"""
|
|
4407
|
+
"""
|
|
4408
|
+
Brokerage message event handler. This method is called for all types of brokerage messages.
|
|
4409
|
+
|
|
4410
|
+
:param message_event: The brokerage message event instance containing the message details.
|
|
4411
|
+
"""
|
|
4416
4412
|
...
|
|
4417
4413
|
|
|
4418
4414
|
def on_brokerage_reconnect(self) -> None:
|
|
@@ -4475,7 +4471,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
4475
4471
|
"""
|
|
4476
4472
|
Used to send data updates to algorithm framework models
|
|
4477
4473
|
|
|
4478
|
-
:param slice: The current data
|
|
4474
|
+
:param slice: The current data Slice
|
|
4479
4475
|
"""
|
|
4480
4476
|
...
|
|
4481
4477
|
|
|
@@ -5242,14 +5238,14 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
5242
5238
|
Sets the benchmark used for computing statistics of the algorithm to the specified symbol
|
|
5243
5239
|
|
|
5244
5240
|
:param symbol: symbol to use as the benchmark
|
|
5245
|
-
:param security_type: Is the symbol an equity, forex, base, etc. Default SecurityType.
|
|
5241
|
+
:param security_type: Is the symbol an equity, forex, base, etc. Default SecurityType.EQUITY
|
|
5246
5242
|
"""
|
|
5247
5243
|
...
|
|
5248
5244
|
|
|
5249
5245
|
@overload
|
|
5250
5246
|
def set_benchmark(self, ticker: str) -> None:
|
|
5251
5247
|
"""
|
|
5252
|
-
Sets the benchmark used for computing statistics of the algorithm to the specified ticker, defaulting to SecurityType.
|
|
5248
|
+
Sets the benchmark used for computing statistics of the algorithm to the specified ticker, defaulting to SecurityType.EQUITY
|
|
5253
5249
|
if the ticker doesn't exist in the algorithm
|
|
5254
5250
|
|
|
5255
5251
|
:param ticker: Ticker to use as the benchmark
|
|
@@ -5636,7 +5632,7 @@ class QCAlgorithm(System.MarshalByRefObject, QuantConnect.Interfaces.IAlgorithm)
|
|
|
5636
5632
|
"""
|
|
5637
5633
|
Set the start date for the backtest
|
|
5638
5634
|
|
|
5639
|
-
:param start:
|
|
5635
|
+
:param start: The start date for the backtest
|
|
5640
5636
|
"""
|
|
5641
5637
|
...
|
|
5642
5638
|
|
|
@@ -6708,18 +6704,18 @@ class DollarVolumeUniverseDefinitions(System.Object):
|
|
|
6708
6704
|
|
|
6709
6705
|
def top(self, count: int, universe_settings: QuantConnect.Data.UniverseSelection.UniverseSettings = None) -> QuantConnect.Data.UniverseSelection.Universe:
|
|
6710
6706
|
"""
|
|
6711
|
-
Creates a new coarse
|
|
6707
|
+
Creates a new coarse Universe that contains the top count of stocks
|
|
6712
6708
|
by daily dollar volume
|
|
6713
6709
|
|
|
6714
6710
|
|
|
6715
|
-
This method is deprecated. Use method `Universe.
|
|
6711
|
+
This method is deprecated. Use method `Universe.Top(...)` instead
|
|
6716
6712
|
|
|
6717
6713
|
:param count: The number of stock to select
|
|
6718
6714
|
:param universe_settings: The settings for stocks added by this universe.
|
|
6719
6715
|
Defaults to QCAlgorithm.universe_settings
|
|
6720
6716
|
:returns: A new coarse universe for the top count of stocks by dollar volume.
|
|
6721
6717
|
"""
|
|
6722
|
-
warnings.warn("This method is deprecated. Use method `Universe.
|
|
6718
|
+
warnings.warn("This method is deprecated. Use method `Universe.Top(...)` instead", DeprecationWarning)
|
|
6723
6719
|
|
|
6724
6720
|
|
|
6725
6721
|
class UniverseDefinitions(System.Object):
|