Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100000
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
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
Drawdown Recovery
0
# region imports
from AlgorithmImports import *
# endregion

class AutoGluonTabularV3_DataSourceTest(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2025, 9, 1)
        self.set_end_date(2025, 9, 5)
        
        self.selected_symbol = self.add_equity("AAPL").symbol
        self.brain_stock_ranking = self.add_data(BrainStockRanking2Day, self.selected_symbol).symbol
        
        # setup timers to check data availability twice every hour
        for hour in range(7, 16): 
            self.schedule.on(
                self.date_rules.every_day(self.selected_symbol),
                self.time_rules.at(hour, 0),
                self.print_latest_data
            )

    def history_with_type(self, symbol):
        return self.history(BrainStockRanking2Day, symbol, 1, Resolution.DAILY)

    def print_latest_data(self):
        # Case 1: Two overloads, with and without type, for the SAME symbol
        history_with_symbol = self.history(self.brain_stock_ranking, 1, Resolution.DAILY)
        typed_with_symbol = self.history_with_type(self.brain_stock_ranking)
        # Case 2: One overload, with type, for DIFFERENT symbol
        typed_with_underlying = self.history_with_type(self.selected_symbol)

        history_with_symbol_time = history_with_symbol.index.get_level_values('time').max()
        typed_with_symbol_time = typed_with_symbol.index.get_level_values('time').max()
        typed_with_underlying_time =  typed_with_underlying.index.get_level_values('time').max()

        # We expect that different symbols have different results
        if typed_with_symbol_time != typed_with_underlying_time:
            self.quit(f'{self.time} :: {history_with_symbol_time=}, {typed_with_symbol_time=}, {typed_with_underlying_time=}')