Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-20.282%
Drawdown
74.300%
Expectancy
0
Net Profit
-53.499%
Sharpe Ratio
-0.287
Probabilistic Sharpe Ratio
0.371%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.08
Beta
-0.29
Annual Standard Deviation
0.375
Annual Variance
0.14
Information Ratio
-0.464
Tracking Error
0.44
Treynor Ratio
0.372
Total Fees
$9.20
namespace QuantConnect
{
    public class BuyOneSecurity : QCAlgorithm
    {
        string _ticker = "opi";
        private Symbol _symbol;
        private Identity _price;

        public override void Initialize()
        {
            SetStartDate(2016, 12, 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();
        }
    }
}