I am building on the Bootcamp Futures strategy by tryng to create an algo that simply holds and rolls into the contract with the highest OpenInterst, for four Futures assets: Gold, SP500, 30Y TBonds & the USD Index.

The problem is the code buys the newest OpenInterest contract without selling the old one.

I need to check if the underlying asset of a contract is held in my portfolio , and if it is, then liquidate it. As it stands, the code is currently buying multiple contracts of the same underlying asset but with different expiries, as they return different Futures.Symbols. 


I can check if the exact Contract is in there with; self.Portfolio[self.liquidContract.Symbol].Invested... But this doesn't tell me if I am holding a contract with a different expiry for the same underlyingSymbol.

Q1: How do I check if the "UnderlyingSymbol" is currently in my Portfolio - without specifying a contract expiry? For example, I want to check if "GC"(Gold) is in my portfolio. If it is then I would like to liquidate that contract and roll it into a future contract.
Using the "self.UnderlyingSymbol" seems to return "None", instead of the underlying symbol "GC"
Q2: The" USD Index Futures" don't seem to exist anymore/have any data?

Kind Regards,