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 -10.684 Tracking Error 0.136 Treynor Ratio 0 Total Fees $0.00 |
using System; using System.Collections.Concurrent; using System.Linq; using QuantConnect.Data.Market; using QuantConnect.Data.UniverseSelection; using QuantConnect.Indicators; namespace QuantConnect.Algorithm.CSharp { public class yunotwork : QCAlgorithm { public override void Initialize() { UniverseSettings.Resolution = Resolution.Minute; // doesn't matter, still gives wrong current price :( UniverseSettings.ExtendedMarketHours = false; // doesn't matter //UniverseSettings.FillForward = true; // doesn't matter UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw; //can only compare x.Price to History request with Raw data SetStartDate(2020, 6, 2); SetEndDate(2020, 6, 4); SetCash(100000); AddUniverse(CoarseFilterFunction, FineSelectionFunction); } IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) { var _symbols = coarse .Where(x => x.HasFundamentalData) .Where(x => x.DollarVolume > 800000) .Where(x => x.Price > 2) .Where(x => { var history = History(x.Symbol, 1, Resolution.Daily); var close = history.FirstOrDefault()?.Close; // If history is empty, close will be null. In this case, we will not consider the security if (close == null) { return false; } if (x.Symbol.Value == "GNUS") { Debug("========="); Debug($"'Current price': {x.Price.ToString()}"); Debug($"'1dayago price': {close.ToString()}"); Debug("---------"); } return (x.Price> (decimal)1.3 * close); }) .Select(x => x.Symbol).Take(5); return _symbols; } IEnumerable<Symbol> FineSelectionFunction(IEnumerable<FineFundamental> fine) { var _symbols = fine .Where(x => x.EarningReports.BasicAverageShares.ThreeMonths > 0) .Where(x => { var averageShares = x.EarningReports.BasicAverageShares.ThreeMonths; var history = History(x.Symbol, 1, Resolution.Daily); var close = history.FirstOrDefault()?.Close; if (close == null) { return false; } var marketcap = averageShares * close; // MarketCap > 25m return (marketcap > 25000000); }) .Select(x => x.Symbol).Take(5); return _symbols; } } }