Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-0.99
Tracking Error
0.146
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
# endregion

class FatBlackDuck(QCAlgorithm):

    def SymbolData(self, symbol, lookback):
        self._consolidator = TradeBarConsolidator(timedelta(days=5))
        
        history_df = self.History(symbol, lookback)
        for bar in history_df.itertuples():
            trade_bar = TradeBar(bar.Index[2], symbol, bar.open, bar.high, bar.low, bar.close, bar.volume, timedelta(1))
            self.Update(trade_bar)


    @property
    def IsReady(self):
        return self.Prices.IsReady
    
    def Update(self, trade_bar):
        self._consolidator.Update(trade_bar)


    def Initialize(self):
        self.SetStartDate(2022, 6, 20)
        self.SetCash(100000)
        self.lookback = 1000
        
        future_contract_1 = self.AddFuture(Futures.Energies.MicroCrudeOilWTI, Resolution.Daily)
        future_contract_2 = self.AddFuture(Futures.Metals.MicroGold, Resolution.Daily)

        
        future_contract_1.SetFilter(0, 50)
        future_contract_2.SetFilter(0, 70)
        
        self.symbol_1 = future_contract_1.Symbol
        self.symbol_2 = future_contract_2.Symbol

        self.symbol_data_1 = self.SymbolData(self.symbol_1, self.lookback)  
        self.symbol_data_2 = self.SymbolData(self.symbol_2, self.lookback) 

        self.Log(self.symbol_data_1) 
        self.Log(self.symbol_data_2)