Add implicit conversion from FuturesContract to Symbol

Modified algorithms to use futures contract objects directly instead of accessing their Symbol property.
Removed unnecessary import statements and redundant lines in various files.
This commit is contained in:
Jhonathan Abreu
2024-12-27 09:04:50 -04:00
parent a5d3fdce18
commit 0333b40e7d
17 changed files with 21 additions and 19 deletions
@@ -12,7 +12,6 @@
# limitations under the License.
from AlgorithmImports import *
import QuantConnect.Data.UniverseSelection
### <summary>
### This example demonstrates how to add futures with daily resolution.
@@ -25,7 +25,7 @@ class ConsolidateRegressionAlgorithm(QCAlgorithm):
self.set_end_date(2020, 1, 20)
SP500 = Symbol.create(Futures.Indices.SP_500_E_MINI, SecurityType.FUTURE, Market.CME)
symbol = list(self.futures_chain(SP500))[0].symbol
symbol = list(self.futures_chain(SP500))[0]
self._future = self.add_future_contract(symbol)
tradable_dates_count = len(list(Time.each_tradeable_day_in_time_zone(self._future.exchange.hours,
@@ -12,7 +12,6 @@
# limitations under the License.
from AlgorithmImports import *
from datetime import timedelta
### <summary>
### Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.OptionChain(Symbol)"/> method
@@ -12,7 +12,6 @@
# limitations under the License.
from AlgorithmImports import *
from datetime import timedelta
### <summary>
### Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.OptionChains(IEnumerable{Symbol})"/> method
@@ -12,7 +12,6 @@
# limitations under the License.
from AlgorithmImports import *
from datetime import timedelta
### <summary>
### Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.FuturesChain(Symbol, bool)"/>
@@ -12,7 +12,6 @@
# limitations under the License.
from AlgorithmImports import *
from datetime import timedelta
### <summary>
### Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.FuturesChains(IEnumerable{Symbol}, bool)"/>