quantconnect-stubs 17397__py3-none-any.whl → 17412__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/Data/Consolidators/__init__.pyi +1 -1
- QuantConnect/Algorithm/Framework/Alphas/__init__.pyi +18 -18
- QuantConnect/Algorithm/Framework/Execution/__init__.pyi +2 -2
- QuantConnect/Algorithm/Framework/Portfolio/__init__.pyi +14 -14
- QuantConnect/Algorithm/Framework/Selection/__init__.pyi +3 -3
- QuantConnect/Algorithm/__init__.pyi +365 -310
- QuantConnect/AlgorithmFactory/Python/Wrappers/__init__.pyi +12 -11
- QuantConnect/Api/Serialization/__init__.pyi +1 -3
- QuantConnect/Api/__init__.pyi +67 -8
- QuantConnect/Benchmarks/__init__.pyi +1 -1
- QuantConnect/Brokerages/Authentication/__init__.pyi +10 -2
- QuantConnect/Brokerages/LevelOneOrderBook/__init__.pyi +6 -5
- QuantConnect/Brokerages/__init__.pyi +82 -11
- QuantConnect/Commands/__init__.pyi +3 -2
- QuantConnect/Data/Auxiliary/__init__.pyi +13 -13
- QuantConnect/Data/Common/__init__.pyi +1 -1
- QuantConnect/Data/Custom/Tiingo/__init__.pyi +2 -1
- QuantConnect/Data/Fundamental/__init__.pyi +11 -12
- QuantConnect/Data/Market/__init__.pyi +42 -42
- QuantConnect/Data/UniverseSelection/__init__.pyi +29 -29
- QuantConnect/Data/__init__.pyi +44 -45
- QuantConnect/DataSource/__init__.pyi +7 -7
- QuantConnect/Indicators/__init__.pyi +238 -98
- QuantConnect/Interfaces/__init__.pyi +24 -23
- QuantConnect/Lean/Engine/DataFeeds/Enumerators/__init__.pyi +1 -1
- QuantConnect/Lean/Engine/DataFeeds/Queues/__init__.pyi +2 -1
- QuantConnect/Lean/Engine/DataFeeds/WorkScheduling/__init__.pyi +3 -2
- QuantConnect/Lean/Engine/DataFeeds/__init__.pyi +19 -19
- QuantConnect/Lean/Engine/HistoricalData/__init__.pyi +1 -1
- QuantConnect/Lean/Engine/Results/__init__.pyi +0 -38
- QuantConnect/Notifications/__init__.pyi +1 -3
- QuantConnect/Optimizer/Parameters/__init__.pyi +1 -3
- QuantConnect/Orders/Fees/__init__.pyi +35 -0
- QuantConnect/Orders/__init__.pyi +75 -28
- QuantConnect/Python/__init__.pyi +1 -1
- QuantConnect/Report/__init__.pyi +3 -5
- QuantConnect/Research/__init__.pyi +17 -16
- QuantConnect/Scheduling/__init__.pyi +17 -17
- QuantConnect/Securities/Cfd/__init__.pyi +2 -2
- QuantConnect/Securities/Crypto/__init__.pyi +2 -2
- QuantConnect/Securities/CryptoFuture/__init__.pyi +1 -1
- QuantConnect/Securities/Equity/__init__.pyi +1 -1
- QuantConnect/Securities/Forex/__init__.pyi +1 -1
- QuantConnect/Securities/Future/__init__.pyi +8 -8
- QuantConnect/Securities/FutureOption/__init__.pyi +9 -9
- QuantConnect/Securities/Index/__init__.pyi +2 -2
- QuantConnect/Securities/IndexOption/__init__.pyi +3 -3
- QuantConnect/Securities/Option/StrategyMatcher/__init__.pyi +6 -6
- QuantConnect/Securities/Option/__init__.pyi +54 -54
- QuantConnect/Securities/Positions/__init__.pyi +6 -6
- QuantConnect/Securities/__init__.pyi +80 -81
- QuantConnect/Statistics/__init__.pyi +2 -2
- QuantConnect/Util/__init__.pyi +36 -37
- QuantConnect/__init__.pyi +69 -68
- System/ComponentModel/DataAnnotations/__init__.pyi +1 -1
- System/ComponentModel/__init__.pyi +1 -1
- System/IO/__init__.pyi +12 -0
- System/Threading/__init__.pyi +3 -3
- {quantconnect_stubs-17397.dist-info → quantconnect_stubs-17412.dist-info}/METADATA +1 -1
- {quantconnect_stubs-17397.dist-info → quantconnect_stubs-17412.dist-info}/RECORD +62 -62
- {quantconnect_stubs-17397.dist-info → quantconnect_stubs-17412.dist-info}/WHEEL +0 -0
- {quantconnect_stubs-17397.dist-info → quantconnect_stubs-17412.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@ from enum import IntEnum
|
|
|
3
3
|
import datetime
|
|
4
4
|
import typing
|
|
5
5
|
|
|
6
|
+
import Common.Util
|
|
6
7
|
import QuantConnect
|
|
7
8
|
import QuantConnect.Algorithm
|
|
8
9
|
import QuantConnect.Algorithm.Framework.Alphas
|
|
@@ -372,7 +373,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
372
373
|
"""
|
|
373
374
|
...
|
|
374
375
|
|
|
375
|
-
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 = 0, extended_market_hours: bool = False) -> QuantConnect.Securities.Future.Future:
|
|
376
|
+
def add_future_contract(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], resolution: typing.Optional[QuantConnect.Resolution] = None, fill_forward: bool = True, leverage: float = 0, extended_market_hours: bool = False) -> QuantConnect.Securities.Future.Future:
|
|
376
377
|
"""
|
|
377
378
|
Creates and adds a new single Future contract to the algorithm
|
|
378
379
|
|
|
@@ -385,7 +386,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
385
386
|
"""
|
|
386
387
|
...
|
|
387
388
|
|
|
388
|
-
def add_option_contract(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], resolution: typing.Optional[QuantConnect.Resolution] = None, fill_forward: bool = True, leverage: float = 0, extended_market_hours: bool = False) -> QuantConnect.Securities.Option.Option:
|
|
389
|
+
def add_option_contract(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], resolution: typing.Optional[QuantConnect.Resolution] = None, fill_forward: bool = True, leverage: float = 0, extended_market_hours: bool = False) -> QuantConnect.Securities.Option.Option:
|
|
389
390
|
"""
|
|
390
391
|
Creates and adds a new single Option contract to the algorithm
|
|
391
392
|
|
|
@@ -416,7 +417,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
416
417
|
...
|
|
417
418
|
|
|
418
419
|
@overload
|
|
419
|
-
def add_security(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, data_mapping_mode: typing.Optional[QuantConnect.DataMappingMode] = None, data_normalization_mode: typing.Optional[QuantConnect.DataNormalizationMode] = None, contract_depth_offset: int = 0) -> QuantConnect.Securities.Security:
|
|
420
|
+
def add_security(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], resolution: typing.Optional[QuantConnect.Resolution] = 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.Security:
|
|
420
421
|
"""
|
|
421
422
|
Set a required SecurityType-symbol and resolution for algorithm
|
|
422
423
|
|
|
@@ -470,7 +471,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
470
471
|
"""
|
|
471
472
|
...
|
|
472
473
|
|
|
473
|
-
def get_last_known_price(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> QuantConnect.Data.BaseData:
|
|
474
|
+
def get_last_known_price(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> QuantConnect.Data.BaseData:
|
|
474
475
|
"""
|
|
475
476
|
Get the last known price using the history provider.
|
|
476
477
|
Useful for seeding securities with the correct price
|
|
@@ -481,7 +482,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
481
482
|
...
|
|
482
483
|
|
|
483
484
|
@overload
|
|
484
|
-
def get_last_known_prices(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> typing.Iterable[QuantConnect.Data.BaseData]:
|
|
485
|
+
def get_last_known_prices(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> typing.Iterable[QuantConnect.Data.BaseData]:
|
|
485
486
|
"""
|
|
486
487
|
Yields data to warmup a security for all it's subscribed data types
|
|
487
488
|
|
|
@@ -540,7 +541,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
540
541
|
"""
|
|
541
542
|
...
|
|
542
543
|
|
|
543
|
-
def get_parameters(self) ->
|
|
544
|
+
def get_parameters(self) -> Common.Util.ReadOnlyExtendedDictionary[str, str]:
|
|
544
545
|
"""Gets a read-only dictionary with all current parameters"""
|
|
545
546
|
...
|
|
546
547
|
|
|
@@ -548,7 +549,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
548
549
|
"""Initialise the Algorithm and Prepare Required Data:"""
|
|
549
550
|
...
|
|
550
551
|
|
|
551
|
-
def liquidate(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract] = None, asynchronous: bool = False, tag: str = "Liquidated", order_properties: QuantConnect.Interfaces.IOrderProperties = None) -> typing.List[QuantConnect.Orders.OrderTicket]:
|
|
552
|
+
def liquidate(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security] = None, asynchronous: bool = False, tag: str = "Liquidated", order_properties: QuantConnect.Interfaces.IOrderProperties = None) -> typing.List[QuantConnect.Orders.OrderTicket]:
|
|
552
553
|
"""
|
|
553
554
|
Liquidate your portfolio holdings
|
|
554
555
|
|
|
@@ -711,7 +712,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
711
712
|
"""
|
|
712
713
|
...
|
|
713
714
|
|
|
714
|
-
def remove_security(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], tag: str = None) -> bool:
|
|
715
|
+
def remove_security(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], tag: str = None) -> bool:
|
|
715
716
|
"""
|
|
716
717
|
Removes the security with the specified symbol. This will cancel all
|
|
717
718
|
open orders and then liquidate any existing holdings
|
|
@@ -957,7 +958,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
957
958
|
"""
|
|
958
959
|
...
|
|
959
960
|
|
|
960
|
-
def shortable(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], short_quantity: float, update_order_id: typing.Optional[int] = None) -> bool:
|
|
961
|
+
def shortable(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], short_quantity: float, update_order_id: typing.Optional[int] = None) -> bool:
|
|
961
962
|
"""
|
|
962
963
|
Determines if the Symbol is shortable at the brokerage
|
|
963
964
|
|
|
@@ -970,7 +971,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
970
971
|
"""
|
|
971
972
|
...
|
|
972
973
|
|
|
973
|
-
def shortable_quantity(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> int:
|
|
974
|
+
def shortable_quantity(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> int:
|
|
974
975
|
"""
|
|
975
976
|
Gets the quantity shortable for the given asset
|
|
976
977
|
|
|
@@ -999,7 +1000,7 @@ class AlgorithmPythonWrapper(QuantConnect.Python.BasePythonWrapper[QuantConnect.
|
|
|
999
1000
|
"""
|
|
1000
1001
|
...
|
|
1001
1002
|
|
|
1002
|
-
def ticker(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> str:
|
|
1003
|
+
def ticker(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> str:
|
|
1003
1004
|
"""
|
|
1004
1005
|
For the given symbol will resolve the ticker it used at the current algorithm date
|
|
1005
1006
|
|
|
@@ -6,10 +6,8 @@ import QuantConnect.Api
|
|
|
6
6
|
import QuantConnect.Api.Serialization
|
|
7
7
|
import System
|
|
8
8
|
|
|
9
|
-
JsonConverter = typing.Any
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
class ProductJsonConverter(JsonConverter):
|
|
10
|
+
class ProductJsonConverter:
|
|
13
11
|
"""Provides an implementation of JsonConverter that can deserialize Product"""
|
|
14
12
|
|
|
15
13
|
@property
|
QuantConnect/Api/__init__.pyi
CHANGED
|
@@ -2,6 +2,7 @@ from typing import overload
|
|
|
2
2
|
from enum import IntEnum
|
|
3
3
|
import datetime
|
|
4
4
|
import typing
|
|
5
|
+
import warnings
|
|
5
6
|
|
|
6
7
|
import QuantConnect
|
|
7
8
|
import QuantConnect.Algorithm.Framework.Alphas
|
|
@@ -20,26 +21,57 @@ import System.Collections.Generic
|
|
|
20
21
|
import System.Collections.Specialized
|
|
21
22
|
import System.Text.RegularExpressions
|
|
22
23
|
|
|
23
|
-
JsonConverter = typing.Any
|
|
24
24
|
|
|
25
|
+
class ApiUtils(System.Object):
|
|
26
|
+
"""API utility methods"""
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
@staticmethod
|
|
29
|
+
def create_json_post_request(endpoint: str, payload: typing.Any = None, json_serializer_settings: typing.Any = None) -> typing.Any:
|
|
30
|
+
"""
|
|
31
|
+
Creates a POST HttpRequestMessage with the specified endpoint and payload as json body
|
|
32
|
+
|
|
33
|
+
:param endpoint: The request endpoint
|
|
34
|
+
:param payload: The request payload
|
|
35
|
+
:param json_serializer_settings: Settings for the json serializer
|
|
36
|
+
:returns: The POST request.
|
|
37
|
+
"""
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def create_post_request(endpoint: str, payload: typing.List[System.Collections.Generic.KeyValuePair[str, str]] = None) -> typing.Any:
|
|
42
|
+
"""
|
|
43
|
+
Creates a POST HttpRequestMessage with the specified endpoint and payload as form url encoded content.
|
|
44
|
+
|
|
45
|
+
:param endpoint: The request endpoint
|
|
46
|
+
:param payload: The request payload
|
|
47
|
+
:returns: The POST request.
|
|
48
|
+
"""
|
|
49
|
+
...
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ApiConnection(System.Object, System.IDisposable):
|
|
27
53
|
"""API Connection and Hash Manager"""
|
|
28
54
|
|
|
29
55
|
@property
|
|
30
56
|
def client(self) -> typing.Any:
|
|
31
|
-
"""
|
|
32
|
-
|
|
57
|
+
"""
|
|
58
|
+
Authorized client to use for requests.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
RestSharp is deprecated and will be removed in a future release. Please use the SetClient method or the request methods that take an HttpRequestMessage
|
|
62
|
+
"""
|
|
63
|
+
warnings.warn("RestSharp is deprecated and will be removed in a future release. Please use the SetClient method or the request methods that take an HttpRequestMessage", DeprecationWarning)
|
|
33
64
|
|
|
34
65
|
@client.setter
|
|
35
66
|
def client(self, value: typing.Any) -> None:
|
|
36
|
-
|
|
67
|
+
warnings.warn("RestSharp is deprecated and will be removed in a future release. Please use the SetClient method or the request methods that take an HttpRequestMessage", DeprecationWarning)
|
|
37
68
|
|
|
38
69
|
@property
|
|
39
70
|
def connected(self) -> bool:
|
|
40
71
|
"""Return true if connected successfully."""
|
|
41
72
|
...
|
|
42
73
|
|
|
74
|
+
@overload
|
|
43
75
|
def __init__(self, user_id: int, token: str) -> None:
|
|
44
76
|
"""
|
|
45
77
|
Create a new Api Connection Class.
|
|
@@ -49,6 +81,33 @@ class ApiConnection(System.Object):
|
|
|
49
81
|
"""
|
|
50
82
|
...
|
|
51
83
|
|
|
84
|
+
@overload
|
|
85
|
+
def __init__(self, user_id: int, token: str, base_url: str = None, default_headers: System.Collections.Generic.Dictionary[str, str] = None, timeout: int = 0) -> None:
|
|
86
|
+
"""
|
|
87
|
+
Create a new Api Connection Class.
|
|
88
|
+
|
|
89
|
+
:param user_id: User Id number from QuantConnect.com account. Found at www.quantconnect.com/account
|
|
90
|
+
:param token: Access token for the QuantConnect account. Found at www.quantconnect.com/account
|
|
91
|
+
:param base_url: The client's base address
|
|
92
|
+
:param default_headers: Default headers for the client
|
|
93
|
+
:param timeout: The client timeout in seconds
|
|
94
|
+
"""
|
|
95
|
+
...
|
|
96
|
+
|
|
97
|
+
def dispose(self) -> None:
|
|
98
|
+
"""Disposes of the HTTP client"""
|
|
99
|
+
...
|
|
100
|
+
|
|
101
|
+
def set_client(self, base_url: str, default_headers: System.Collections.Generic.Dictionary[str, str] = None, timeout: int = 0) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Overrides the current client
|
|
104
|
+
|
|
105
|
+
:param base_url: The client's base address
|
|
106
|
+
:param default_headers: Default headers for the client
|
|
107
|
+
:param timeout: The client timeout in seconds
|
|
108
|
+
"""
|
|
109
|
+
...
|
|
110
|
+
|
|
52
111
|
|
|
53
112
|
class StringRepresentation(System.Object):
|
|
54
113
|
"""Class to return the string representation of an API response class"""
|
|
@@ -3561,7 +3620,7 @@ class Authentication(System.Object):
|
|
|
3561
3620
|
...
|
|
3562
3621
|
|
|
3563
3622
|
|
|
3564
|
-
class LiveAlgorithmResultsJsonConverter
|
|
3623
|
+
class LiveAlgorithmResultsJsonConverter:
|
|
3565
3624
|
"""Custom JsonConverter for LiveResults data for live algorithms"""
|
|
3566
3625
|
|
|
3567
3626
|
@property
|
|
@@ -3605,7 +3664,7 @@ class AuthenticationResponse(QuantConnect.Api.RestResponse):
|
|
|
3605
3664
|
"""Verify if the credentials are OK."""
|
|
3606
3665
|
|
|
3607
3666
|
|
|
3608
|
-
class ParameterSetJsonConverter
|
|
3667
|
+
class ParameterSetJsonConverter:
|
|
3609
3668
|
"""Json converter for ParameterSet which creates a light weight easy to consume serialized version"""
|
|
3610
3669
|
|
|
3611
3670
|
def can_convert(self, object_type: typing.Type) -> bool:
|
|
@@ -3634,7 +3693,7 @@ class ParameterSetJsonConverter(JsonConverter):
|
|
|
3634
3693
|
...
|
|
3635
3694
|
|
|
3636
3695
|
|
|
3637
|
-
class OptimizationBacktestJsonConverter
|
|
3696
|
+
class OptimizationBacktestJsonConverter:
|
|
3638
3697
|
"""Json converter for OptimizationBacktest which creates a light weight easy to consume serialized version"""
|
|
3639
3698
|
|
|
3640
3699
|
def can_convert(self, object_type: typing.Type) -> bool:
|
|
@@ -37,7 +37,7 @@ class SecurityBenchmark(System.Object, QuantConnect.Benchmarks.IBenchmark):
|
|
|
37
37
|
...
|
|
38
38
|
|
|
39
39
|
@staticmethod
|
|
40
|
-
def create_instance(securities: QuantConnect.Securities.SecurityManager, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> QuantConnect.Benchmarks.SecurityBenchmark:
|
|
40
|
+
def create_instance(securities: QuantConnect.Securities.SecurityManager, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> QuantConnect.Benchmarks.SecurityBenchmark:
|
|
41
41
|
"""
|
|
42
42
|
Helper function that will create a security with the given SecurityManager
|
|
43
43
|
for a specific symbol and then create a SecurityBenchmark for it
|
|
@@ -10,7 +10,6 @@ import System
|
|
|
10
10
|
import System.Threading
|
|
11
11
|
import System.Threading.Tasks
|
|
12
12
|
|
|
13
|
-
DelegatingHandler = typing.Any
|
|
14
13
|
AuthenticationHeaderValue = typing.Any
|
|
15
14
|
HttpResponseMessage = typing.Any
|
|
16
15
|
|
|
@@ -91,7 +90,7 @@ class TokenCredentials(System.Object):
|
|
|
91
90
|
...
|
|
92
91
|
|
|
93
92
|
|
|
94
|
-
class TokenHandler(
|
|
93
|
+
class TokenHandler(metaclass=abc.ABCMeta):
|
|
95
94
|
"""
|
|
96
95
|
Provides base functionality for token-based HTTP request handling,
|
|
97
96
|
including automatic retries and token refresh on unauthorized responses.
|
|
@@ -166,6 +165,15 @@ class OAuthTokenHandler(typing.Generic[QuantConnect_Brokerages_Authentication_OA
|
|
|
166
165
|
"""
|
|
167
166
|
...
|
|
168
167
|
|
|
168
|
+
def dispose(self, disposing: bool) -> None:
|
|
169
|
+
"""
|
|
170
|
+
Disposes of resources
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
This codeEntityType is protected.
|
|
174
|
+
"""
|
|
175
|
+
...
|
|
176
|
+
|
|
169
177
|
def get_access_token(self, cancellation_token: System.Threading.CancellationToken) -> QuantConnect.Brokerages.Authentication.TokenCredentials:
|
|
170
178
|
"""
|
|
171
179
|
Retrieves a valid access token from the Lean platform.
|
|
@@ -7,6 +7,7 @@ import QuantConnect
|
|
|
7
7
|
import QuantConnect.Brokerages.LevelOneOrderBook
|
|
8
8
|
import QuantConnect.Data
|
|
9
9
|
import QuantConnect.Data.Market
|
|
10
|
+
import QuantConnect.Securities
|
|
10
11
|
import System
|
|
11
12
|
|
|
12
13
|
QuantConnect_Brokerages_LevelOneOrderBook__EventContainer_Callable = typing.TypeVar("QuantConnect_Brokerages_LevelOneOrderBook__EventContainer_Callable")
|
|
@@ -51,7 +52,7 @@ class LevelOneServiceManager(System.Object, System.IDisposable):
|
|
|
51
52
|
"""
|
|
52
53
|
...
|
|
53
54
|
|
|
54
|
-
def handle_last_trade(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], trade_date_time_utc: typing.Optional[datetime.datetime], last_quantity: typing.Optional[float], last_price: typing.Optional[float], sale_condition: str = ..., exchange: str = ...) -> None:
|
|
55
|
+
def handle_last_trade(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], trade_date_time_utc: typing.Optional[datetime.datetime], last_quantity: typing.Optional[float], last_price: typing.Optional[float], sale_condition: str = ..., exchange: str = ...) -> None:
|
|
55
56
|
"""
|
|
56
57
|
Handles incoming last trade data for a symbol and routes it to the corresponding LevelOneMarketData instance.
|
|
57
58
|
|
|
@@ -64,7 +65,7 @@ class LevelOneServiceManager(System.Object, System.IDisposable):
|
|
|
64
65
|
"""
|
|
65
66
|
...
|
|
66
67
|
|
|
67
|
-
def handle_open_interest(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], open_interest_date_time_utc: typing.Optional[datetime.datetime], open_interest: typing.Optional[float]) -> None:
|
|
68
|
+
def handle_open_interest(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], open_interest_date_time_utc: typing.Optional[datetime.datetime], open_interest: typing.Optional[float]) -> None:
|
|
68
69
|
"""
|
|
69
70
|
Handles open interest updates for the specified symbol.
|
|
70
71
|
If the symbol is subscribed, forwards the open interest data to the corresponding
|
|
@@ -76,7 +77,7 @@ class LevelOneServiceManager(System.Object, System.IDisposable):
|
|
|
76
77
|
"""
|
|
77
78
|
...
|
|
78
79
|
|
|
79
|
-
def handle_quote(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], quote_date_time_utc: typing.Optional[datetime.datetime], bid_price: typing.Optional[float], bid_size: typing.Optional[float], ask_price: typing.Optional[float], ask_size: typing.Optional[float]) -> None:
|
|
80
|
+
def handle_quote(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], quote_date_time_utc: typing.Optional[datetime.datetime], bid_price: typing.Optional[float], bid_size: typing.Optional[float], ask_price: typing.Optional[float], ask_size: typing.Optional[float]) -> None:
|
|
80
81
|
"""
|
|
81
82
|
Handles incoming quote data for a symbol.
|
|
82
83
|
Deduplicates updates and routes changes to the relevant LevelOneMarketData instance.
|
|
@@ -90,7 +91,7 @@ class LevelOneServiceManager(System.Object, System.IDisposable):
|
|
|
90
91
|
"""
|
|
91
92
|
...
|
|
92
93
|
|
|
93
|
-
def set_ignore_zero_size_updates(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], ignore_zero_size_updates: bool) -> None:
|
|
94
|
+
def set_ignore_zero_size_updates(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], ignore_zero_size_updates: bool) -> None:
|
|
94
95
|
"""
|
|
95
96
|
Sets the LevelOneMarketData.ignore_zero_size_updates flag for the specified symbol,
|
|
96
97
|
controlling how zero-sized quote updates are handled for that symbol's market data stream.
|
|
@@ -216,7 +217,7 @@ class LevelOneMarketData(System.Object):
|
|
|
216
217
|
def ignore_zero_size_updates(self, value: bool) -> None:
|
|
217
218
|
...
|
|
218
219
|
|
|
219
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
220
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
220
221
|
"""
|
|
221
222
|
Initializes a new instance of the LevelOneMarketData class for a given symbol.
|
|
222
223
|
|
|
@@ -34,7 +34,7 @@ QuantConnect_Brokerages__EventContainer_ReturnType = typing.TypeVar("QuantConnec
|
|
|
34
34
|
class ISymbolMapper(metaclass=abc.ABCMeta):
|
|
35
35
|
"""Provides the mapping between Lean symbols and brokerage specific symbols."""
|
|
36
36
|
|
|
37
|
-
def get_brokerage_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> str:
|
|
37
|
+
def get_brokerage_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> str:
|
|
38
38
|
"""
|
|
39
39
|
Converts a Lean symbol instance to a brokerage symbol
|
|
40
40
|
|
|
@@ -86,7 +86,7 @@ class BestBidAskUpdatedEventArgs(System.EventArgs):
|
|
|
86
86
|
"""Gets the new best ask size"""
|
|
87
87
|
...
|
|
88
88
|
|
|
89
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], best_bid_price: float, best_bid_size: float, best_ask_price: float, best_ask_size: float) -> None:
|
|
89
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], best_bid_price: float, best_bid_size: float, best_ask_price: float, best_ask_size: float) -> None:
|
|
90
90
|
"""
|
|
91
91
|
Initializes a new instance of the BestBidAskUpdatedEventArgs class
|
|
92
92
|
|
|
@@ -522,7 +522,7 @@ class DefaultOrderBook(System.Object, QuantConnect.Brokerages.IOrderBookUpdater[
|
|
|
522
522
|
"""The best ask size"""
|
|
523
523
|
...
|
|
524
524
|
|
|
525
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
525
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
526
526
|
"""
|
|
527
527
|
Initializes a new instance of the DefaultOrderBook class
|
|
528
528
|
|
|
@@ -1214,7 +1214,7 @@ class OptionNotificationEventArgs(System.EventArgs):
|
|
|
1214
1214
|
...
|
|
1215
1215
|
|
|
1216
1216
|
@overload
|
|
1217
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], position: float) -> None:
|
|
1217
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], position: float) -> None:
|
|
1218
1218
|
"""
|
|
1219
1219
|
Initializes a new instance of the OptionNotificationEventArgs class
|
|
1220
1220
|
|
|
@@ -1224,7 +1224,7 @@ class OptionNotificationEventArgs(System.EventArgs):
|
|
|
1224
1224
|
...
|
|
1225
1225
|
|
|
1226
1226
|
@overload
|
|
1227
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract], position: float, tag: str) -> None:
|
|
1227
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security], position: float, tag: str) -> None:
|
|
1228
1228
|
"""
|
|
1229
1229
|
Initializes a new instance of the OptionNotificationEventArgs class
|
|
1230
1230
|
|
|
@@ -1247,7 +1247,7 @@ class DelistingNotificationEventArgs(System.Object):
|
|
|
1247
1247
|
"""Gets the option symbol which has received a notification"""
|
|
1248
1248
|
...
|
|
1249
1249
|
|
|
1250
|
-
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
1250
|
+
def __init__(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
1251
1251
|
"""
|
|
1252
1252
|
Initializes a new instance of the DelistingNotificationEventArgs class
|
|
1253
1253
|
|
|
@@ -1947,7 +1947,7 @@ class BrokerageMultiWebSocketEntry(System.Object):
|
|
|
1947
1947
|
"""
|
|
1948
1948
|
...
|
|
1949
1949
|
|
|
1950
|
-
def add_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
1950
|
+
def add_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
1951
1951
|
"""
|
|
1952
1952
|
Adds a symbol to the entry
|
|
1953
1953
|
|
|
@@ -1955,7 +1955,7 @@ class BrokerageMultiWebSocketEntry(System.Object):
|
|
|
1955
1955
|
"""
|
|
1956
1956
|
...
|
|
1957
1957
|
|
|
1958
|
-
def contains(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> bool:
|
|
1958
|
+
def contains(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> bool:
|
|
1959
1959
|
"""
|
|
1960
1960
|
Returns whether the symbol is subscribed
|
|
1961
1961
|
|
|
@@ -1963,7 +1963,7 @@ class BrokerageMultiWebSocketEntry(System.Object):
|
|
|
1963
1963
|
"""
|
|
1964
1964
|
...
|
|
1965
1965
|
|
|
1966
|
-
def remove_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
1966
|
+
def remove_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
1967
1967
|
"""
|
|
1968
1968
|
Removes a symbol from the entry
|
|
1969
1969
|
|
|
@@ -2041,7 +2041,7 @@ class SymbolPropertiesDatabaseSymbolMapper(System.Object, QuantConnect.Brokerage
|
|
|
2041
2041
|
"""
|
|
2042
2042
|
...
|
|
2043
2043
|
|
|
2044
|
-
def get_brokerage_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> str:
|
|
2044
|
+
def get_brokerage_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> str:
|
|
2045
2045
|
"""
|
|
2046
2046
|
Converts a Lean symbol instance to a brokerage symbol
|
|
2047
2047
|
|
|
@@ -2073,7 +2073,7 @@ class SymbolPropertiesDatabaseSymbolMapper(System.Object, QuantConnect.Brokerage
|
|
|
2073
2073
|
"""
|
|
2074
2074
|
...
|
|
2075
2075
|
|
|
2076
|
-
def is_known_lean_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> bool:
|
|
2076
|
+
def is_known_lean_symbol(self, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> bool:
|
|
2077
2077
|
"""
|
|
2078
2078
|
Checks if the Lean symbol is supported by the brokerage
|
|
2079
2079
|
|
|
@@ -2290,6 +2290,74 @@ class DefaultBrokerageModel(System.Object, QuantConnect.Brokerages.IBrokerageMod
|
|
|
2290
2290
|
...
|
|
2291
2291
|
|
|
2292
2292
|
|
|
2293
|
+
class dYdXBrokerageModel(QuantConnect.Brokerages.DefaultBrokerageModel):
|
|
2294
|
+
"""This class has no documentation."""
|
|
2295
|
+
|
|
2296
|
+
@property
|
|
2297
|
+
def default_markets(self) -> System.Collections.Generic.IReadOnlyDictionary[QuantConnect.SecurityType, str]:
|
|
2298
|
+
"""Gets a map of the default markets to be used for each security type"""
|
|
2299
|
+
...
|
|
2300
|
+
|
|
2301
|
+
def __init__(self, account_type: QuantConnect.AccountType = ...) -> None:
|
|
2302
|
+
"""
|
|
2303
|
+
Initializes a new instance of the dYdXBrokerageModel class
|
|
2304
|
+
|
|
2305
|
+
:param account_type: The type of account to be modeled, defaults to AccountType.MARGIN
|
|
2306
|
+
"""
|
|
2307
|
+
...
|
|
2308
|
+
|
|
2309
|
+
def can_submit_order(self, security: QuantConnect.Securities.Security, order: QuantConnect.Orders.Order, message: typing.Optional[QuantConnect.Brokerages.BrokerageMessageEvent]) -> typing.Tuple[bool, QuantConnect.Brokerages.BrokerageMessageEvent]:
|
|
2310
|
+
"""
|
|
2311
|
+
Returns true if the brokerage could accept this order. This takes into account
|
|
2312
|
+
order type, security type, and order size limits.
|
|
2313
|
+
|
|
2314
|
+
:param security: The security of the order
|
|
2315
|
+
:param order: The order to be processed
|
|
2316
|
+
:param message: If this function returns false, a brokerage message detailing why the order may not be submitted
|
|
2317
|
+
:returns: True if the brokerage could process the order, false otherwise.
|
|
2318
|
+
"""
|
|
2319
|
+
...
|
|
2320
|
+
|
|
2321
|
+
def can_update_order(self, security: QuantConnect.Securities.Security, order: QuantConnect.Orders.Order, request: QuantConnect.Orders.UpdateOrderRequest, message: typing.Optional[QuantConnect.Brokerages.BrokerageMessageEvent]) -> typing.Tuple[bool, QuantConnect.Brokerages.BrokerageMessageEvent]:
|
|
2322
|
+
"""
|
|
2323
|
+
Returns true if the brokerage could accept this order update. This takes into account
|
|
2324
|
+
order type, security type, and order size limits. dYdX can only update inverse, linear, and option orders
|
|
2325
|
+
|
|
2326
|
+
:param security: The security of the order
|
|
2327
|
+
:param order: The order to be updated
|
|
2328
|
+
:param request: The requested update to be made to the order
|
|
2329
|
+
:param message: If this function returns false, a brokerage message detailing why the order may not be updated
|
|
2330
|
+
:returns: True if the brokerage could update the order, false otherwise.
|
|
2331
|
+
"""
|
|
2332
|
+
...
|
|
2333
|
+
|
|
2334
|
+
def get_benchmark(self, securities: QuantConnect.Securities.SecurityManager) -> QuantConnect.Benchmarks.IBenchmark:
|
|
2335
|
+
"""
|
|
2336
|
+
Get the benchmark for this model
|
|
2337
|
+
|
|
2338
|
+
:param securities: SecurityService to create the security with if needed
|
|
2339
|
+
:returns: The benchmark for this brokerage.
|
|
2340
|
+
"""
|
|
2341
|
+
...
|
|
2342
|
+
|
|
2343
|
+
def get_fee_model(self, security: QuantConnect.Securities.Security) -> QuantConnect.Orders.Fees.IFeeModel:
|
|
2344
|
+
"""
|
|
2345
|
+
Provides dYdX fee model
|
|
2346
|
+
|
|
2347
|
+
:param security:
|
|
2348
|
+
"""
|
|
2349
|
+
...
|
|
2350
|
+
|
|
2351
|
+
def get_margin_interest_rate_model(self, security: QuantConnect.Securities.Security) -> QuantConnect.Securities.IMarginInterestRateModel:
|
|
2352
|
+
"""
|
|
2353
|
+
Gets a new margin interest rate model for the security
|
|
2354
|
+
|
|
2355
|
+
:param security: The security to get a margin interest rate model for
|
|
2356
|
+
:returns: The margin interest rate model for this brokerage.
|
|
2357
|
+
"""
|
|
2358
|
+
...
|
|
2359
|
+
|
|
2360
|
+
|
|
2293
2361
|
class BinanceBrokerageModel(QuantConnect.Brokerages.DefaultBrokerageModel):
|
|
2294
2362
|
"""Provides Binance specific properties"""
|
|
2295
2363
|
|
|
@@ -2624,6 +2692,9 @@ class BrokerageName(IntEnum):
|
|
|
2624
2692
|
INTERACTIVE_BROKERS_FIX = 33
|
|
2625
2693
|
"""Transaction and submit/execution rules will use interactive brokers Fix models"""
|
|
2626
2694
|
|
|
2695
|
+
D_YD_X = 34
|
|
2696
|
+
"""Transaction and submit/execution rules will use dYdX models"""
|
|
2697
|
+
|
|
2627
2698
|
|
|
2628
2699
|
class BrokerageModel(System.Object):
|
|
2629
2700
|
"""Provides factory method for creating an IBrokerageModel from the BrokerageName enum"""
|
|
@@ -9,6 +9,7 @@ import QuantConnect.Data.Market
|
|
|
9
9
|
import QuantConnect.Interfaces
|
|
10
10
|
import QuantConnect.Orders
|
|
11
11
|
import QuantConnect.Packets
|
|
12
|
+
import QuantConnect.Securities
|
|
12
13
|
import System
|
|
13
14
|
import System.IO
|
|
14
15
|
|
|
@@ -172,7 +173,7 @@ class BaseCommand(System.Object, QuantConnect.Commands.ICommand, metaclass=abc.A
|
|
|
172
173
|
def id(self, value: str) -> None:
|
|
173
174
|
...
|
|
174
175
|
|
|
175
|
-
def get_symbol(self, ticker: str, security_type: QuantConnect.SecurityType, market: str, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract] = None) -> QuantConnect.Symbol:
|
|
176
|
+
def get_symbol(self, ticker: str, security_type: QuantConnect.SecurityType, market: str, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security] = None) -> QuantConnect.Symbol:
|
|
176
177
|
"""
|
|
177
178
|
Creats symbol using symbol properties.
|
|
178
179
|
|
|
@@ -552,7 +553,7 @@ class AddSecurityCommand(QuantConnect.Commands.BaseCommand):
|
|
|
552
553
|
def symbol(self, value: QuantConnect.Symbol) -> None:
|
|
553
554
|
...
|
|
554
555
|
|
|
555
|
-
def __init__(self, command: QuantConnect.Commands.AddSecurityCommand, success: bool, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract]) -> None:
|
|
556
|
+
def __init__(self, command: QuantConnect.Commands.AddSecurityCommand, success: bool, symbol: typing.Union[QuantConnect.Symbol, str, QuantConnect.Data.Market.BaseContract, QuantConnect.Securities.Security]) -> None:
|
|
556
557
|
"""Initializes a new instance of the Result class"""
|
|
557
558
|
...
|
|
558
559
|
|