I can't seem to access the Top Of Book (Aka, level 1) data at a given instant with my code. 

The logs show that for each Bid/AskSize quote I receive, either the BidSize field or the Ask Size field is left empty. The tick only contains the most recent order and doesn't show the current best orders. Does anyone know how I can fix this and get access to the current Top Of Book data?
 

caleb-eldredge_1734538672.jpg
from AlgorithmImports import *

class BidAskImbalanceAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2024, 6, 1)  # Set Start Date
        self.SetEndDate(2024, 6, 10)   # Set End Date
        self.SetCash(100000)           # Set Strategy Cash
        self.symbol = self.AddEquity("AMD", Resolution.Tick).Symbol
        self.target_percentage = 0.25
        self.imbalance_threshold = 0.7

    def OnData(self, data):
        if self.symbol not in data.Ticks:
            return

        ticks = data.Ticks[self.symbol]
        for tick in ticks:
            if tick.TickType != TickType.Quote:
                continue

            bid_size = tick.BidSize
            ask_size = tick.AskSize
            total_size = bid_size + ask_size

            if total_size == 0:
                self.Debug(f"Total size is zero. Bid: {bid_size}, Ask: {ask_size}")
                continue

            bid_imbalance = bid_size / total_size
            self.Debug(f"BidSize: {bid_size}, AskSize: {ask_size}, Bid Imbalance: {bid_imbalance}")

            holdings = self.Portfolio[self.symbol].Quantity
            self.Debug(f"Current Holdings: {holdings}, Bid Imbalance: {bid_imbalance}")

            if bid_imbalance > self.imbalance_threshold and holdings <= 0:
                self.Debug("Entering a long position.")
                self.SetHoldings(self.symbol, self.target_percentage)
            elif bid_imbalance < self.imbalance_threshold and holdings > 0:
                self.Debug("Exiting the position.")
                self.Liquidate(self.symbol)