using QuantConnect.Securities; Security equity = new Security( Symbol.Create("AAPL", SecurityType.Equity, Market.USA), SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), new Cash("USD", 0, 1), SymbolProperties.GetDefault("AAPL", SecurityType.Equity, Market.USA), null );
using QuantConnect.Securities; Security equity = Securities["AAPL"]; decimal currentShares = equity.Holdings.Quantity; decimal currentPrice = equity.Price; Log($"Current holding: {currentShares} shares at {currentPrice:C2} per share.");This code retrieves an existing Security object for the AAPL equity instrument from the QuantConnect.Securities Securities dictionary and uses its Holdings property to get the current quantity of shares held and its Price property to get the current price of the underlying asset. These values are then displayed using the Log function.