Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp { public class TachyonMultidimensionalPrism : QCAlgorithm { Dictionary<Symbol, SymbolData> symbols; public override void Initialize() { SetStartDate(2020, 2, 10); //Set Start Date SetEndDate(2020, 2, 18); SetCash(100000); //Set Strategy Cash Symbol spy = AddEquity("SPY", Resolution.Minute).Symbol; symbols = new Dictionary<Symbol, SymbolData>(); AddUniverse(CoarseSelection); } public IEnumerable<Symbol> CoarseSelection(IEnumerable<CoarseFundamental> universe){ var selected = new List<Symbol>(); universe = universe .OrderByDescending(x => x.DollarVolume).Take(1000); foreach(var coarse in universe){ var symbol = coarse.Symbol; selected.Add(symbol); if(!symbols.ContainsKey(symbol)){ symbols.Add(symbol, new SymbolData(this, symbol)); } } return selected; } public override void OnEndOfDay(Symbol symbol){ symbols[symbol].SetEOD(Securities[symbol].Close); } } public class SymbolData { private QCAlgorithm algorithm; private Symbol symbol; private decimal EOD; public SymbolData(QCAlgorithm algorithm, Symbol symbol) { this.algorithm = algorithm; this.symbol = symbol; var history = algorithm.History(symbol, 1, Resolution.Daily); if(history.Any()){ EOD = history.ElementAt(0).Close; } } public decimal GetEOD(){ return EOD; } public void SetEOD(decimal eod){ this.EOD = eod; } } }