Overall Statistics |
Total Trades 2 Average Win 0% Average Loss -0.07% Compounding Annual Return -0.125% Drawdown 3.400% Expectancy -1 Net Profit -0.073% Sharpe Ratio -0.015 Probabilistic Sharpe Ratio 20.881% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.002 Beta -0.006 Annual Standard Deviation 0.035 Annual Variance 0.001 Information Ratio -2.287 Tracking Error 0.183 Treynor Ratio 0.081 Total Fees $10.44 |
namespace QuantConnect { public class BuyOneSecurity : QCAlgorithm { string _ticker = "GSB"; private Symbol _symbol; private Identity _price; public override void Initialize() { SetStartDate(2020, 06, 01); SetEndDate(2021, 01, 01); 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, 0.1); Log($"Purchased Security {_symbol.ID}"); } } public override void OnSecuritiesChanged(SecurityChanges changes) { foreach (var securityChange in changes.RemovedSecurities) { Log(securityChange.Symbol.ID.ToString() + " - Delisted"); } } public void OnData(Splits data) { Log("_ticker: " + Securities[_ticker].Price); var split = data[_ticker]; Log($"{split.Time.ToIso8601Invariant()} >> SPLIT >> {split.Symbol} - " + $"{split.SplitFactor.ToStringInvariant()} - " + $"{Portfolio.Cash.ToStringInvariant()} - " + $"{Portfolio[_ticker].Quantity.ToStringInvariant()}" ); } public override void OnEndOfAlgorithm() { Liquidate(); } } }