Overall Statistics
namespace QuantConnect
{
    public class BuyOneSecurity : QCAlgorithm
    {
        string _ticker = "uso";
        private Symbol _symbol;
        private Identity _price;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            
            SetCash(100000);

            _symbol = AddEquity(_ticker, Resolution.Daily, Market.USA).Symbol;
            _price = Identity(_symbol);
            PlotIndicator($"{_symbol.Value} Price", _price);
        }

        public override void OnData(Slice data)
        {
            if (!Portfolio.Invested)
            {
                SetHoldings(_symbol, 1);
                Log($"Purchased Security {_symbol.ID}");
            }
        }
        
        public override void OnEndOfAlgorithm()
        {
            Liquidate();
        }
    }
}