Overall Statistics
Total Trades
2
Average Win
2.02%
Average Loss
0%
Compounding Annual Return
131.795%
Drawdown
0.600%
Expectancy
0
Net Profit
2.016%
Sharpe Ratio
12.144
Probabilistic Sharpe Ratio
95.778%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
1.626
Beta
-0.519
Annual Standard Deviation
0.109
Annual Variance
0.012
Information Ratio
5.471
Tracking Error
0.136
Treynor Ratio
-2.551
Total Fees
$0.00
Estimated Strategy Capacity
$72000000.00
Lowest Capacity Asset
AAPL R735QTJ8XC9X
namespace QuantConnect.Algorithm.CSharp
{
    public class TestAapl : QCAlgorithm
    {
    	private Symbol _aapl;
        public override void Initialize()
        {
            SetStartDate(2014, 6, 3);  //Set Start Date
            SetEndDate(2014, 6, 11);
            SetCash(64700);             //Set Strategy Cash
            //UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw;
            _aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
            var aapl = AddEquity("AAPL", Resolution.Hour);
            var zeroFeeModel = new FeeModel();
            aapl.SetFeeModel(zeroFeeModel);
        }

        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// Slice object keyed by symbol containing the stock data
        public override void OnData(Slice data)
        {
            decimal o = -1, c = -1;
            
            if (data.Bars.ContainsKey(_aapl)) {
            	o = data.Bars[_aapl].Open;
            	c = data.Bars[_aapl].Close;
            }
            if (Time.Day == (new DateTime(2014, 6, 5)).Day) {
            	SetHoldings(_aapl, 1);
            } else if (Time.Day == (new DateTime(2014, 6, 10)).Day) {
            	Liquidate(_aapl);
            }
            decimal aaplHoldingValue = 0;
            if (Portfolio.Securities.ContainsKey(_aapl))
            	aaplHoldingValue = Portfolio.Securities[_aapl].Holdings.HoldingsValue;
            Console.WriteLine($"{Time:MM-dd} O={o} C={c} Portfolio={Portfolio.TotalPortfolioValue} AAPL={aaplHoldingValue} Cash={Portfolio.CashBook.TotalValueInAccountCurrency}");
            
        }
        
        public override void OnOrderEvent(OrderEvent orderEvent)
        {
            if (orderEvent.Status.IsFill()) {
            	Console.WriteLine($"Order filled: {orderEvent.UtcTime:yyyy-MM-dd} @{orderEvent.FillPrice}x{orderEvent.FillQuantity}");
            }
        }

    }
}