Overall Statistics
Total Trades
2
Average Win
2.50%
Average Loss
0%
Compounding Annual Return
281.969%
Drawdown
0.300%
Expectancy
0
Net Profit
3.360%
Sharpe Ratio
17.924
Probabilistic Sharpe Ratio
99.834%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
2.219
Beta
-0.913
Annual Standard Deviation
0.103
Annual Variance
0.011
Information Ratio
10.825
Tracking Error
0.133
Treynor Ratio
-2.021
Total Fees
$0.00
Estimated Strategy Capacity
$280000000.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.Daily);
            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 == new DateTime(2014, 6, 5)) {
            	SetHoldings(_aapl, 1);
            } else if (Time == new DateTime(2014, 6, 10)) {
            	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}");
            }
        }

    }
}