| 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 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 VerticalTachyonReplicator : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2018, 10, 24); //Set Start Date
SetEndDate(2018, 10, 31);
SetCash(100000); //Set Strategy Cash
//Here is the coarse-find universe selection model
//coarse selection and fine selection methods are defined below
SetUniverseSelection(new FineFundamentalUniverseSelectionModel(CoarseSelectionFunction, FineSelectionFunction));
}
/// 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)
{
// if (!Portfolio.Invested)
// {
// SetHoldings(_spy, 1);
// Debug("Purchased Stock");
//}
}
// sort the data by daily dollar volume and take the top 'NumberOfSymbols'
public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
//number of symbols we select in coarse selection
var numberOfSymbolsCoarse = 100;
// select only symbols with fundamental data and sort descending by daily dollar volume
var sortedByDollarVolume = coarse
.Where(x => x.HasFundamentalData)
.OrderByDescending(x => x.DollarVolume);
// take the top entries from our sorted collection
var top5 = sortedByDollarVolume.Take(numberOfSymbolsCoarse);
// we need to return only the symbol objects
return top5.Select(x => x.Symbol);
}
// sort the data by P/E ratio and take the top 'numberOfSymbolsFine'
public IEnumerable<Symbol> FineSelectionFunction(IEnumerable<FineFundamental> fine)
{
//number of symbols we select in fine selection
var numberOfSymbolsFine = 5;
// sort descending by P/E ratio
var sortedByPeRatio = fine.OrderByDescending(x => x.ValuationRatios.PERatio);
// take the top entries from our sorted collection
var topFine = sortedByPeRatio.Take(numberOfSymbolsFine);
// we need to return only the symbol objects
return topFine.Select(x => x.Symbol);
}
}
}