Overall Statistics |
Total Trades 6 Average Win 0.45% Average Loss 0% Compounding Annual Return 4.046% Drawdown 0.300% Expectancy 0 Net Profit 1.367% Sharpe Ratio 3.766 Probabilistic Sharpe Ratio 99.757% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.03 Beta 0.012 Annual Standard Deviation 0.009 Annual Variance 0 Information Ratio -1.398 Tracking Error 0.102 Treynor Ratio 2.685 Total Fees $60.68 |
using QuantConnect.Data.Custom.SmartInsider; public class SmartInsiderAlgorithm : QCAlgorithm { public override void Initialize() { SetStartDate(2019, 3, 1); SetEndDate(2019, 7, 4); SetCash(1000000); AddUniverseSelection(new CoarseFundamentalUniverseSelectionModel(CoarseUniverse)); // Request underlying equity data. var ibm = AddEquity("IBM", Resolution.Minute).Symbol; // Add Smart Insider stock buyback transaction data for the underlying IBM asset var si = AddData<SmartInsiderTransaction>(ibm).Symbol; // Request 60 days of history with the SmartInsiderTransaction IBM Custom Data Symbol. var history = History<SmartInsiderTransaction>(si, 60, Resolution.Daily); // Count the number of items we get from our history request Debug($"We got {history.Count()} items from our history request"); } public IEnumerable<Symbol> CoarseUniverse(IEnumerable<CoarseFundamental> coarse) { var symbols = coarse.Where(x => x.HasFundamentalData && x.DollarVolume > 50000000) .Select(x => x.Symbol) .Take(10); foreach (var symbol in symbols) { AddData<SmartInsiderTransaction>(symbol); } return symbols; } public override void OnData(Slice data) { // Get all SmartInsider data available var transactions = data.Get<SmartInsiderTransaction>(); foreach (var transaction in transactions.Values) { if (transaction.VolumePercentage == null || transaction.EventType == null) { continue; } // Using the Smart Insider transaction information, buy when company does a stock buyback if (transaction.EventType == SmartInsiderEventType.Transaction && transaction.VolumePercentage > 5) { SetHoldings(transaction.Symbol.Underlying, (decimal)transaction.VolumePercentage / 100); } } } public override void OnSecuritiesChanged(SecurityChanges changes) { foreach (var r in changes.RemovedSecurities.Where(x => x.Symbol.SecurityType == SecurityType.Equity)) { // If removed from the universe, liquidate and remove the custom data from the algorithm Liquidate(r.Symbol); RemoveSecurity(QuantConnect.Symbol.CreateBase(typeof(SmartInsiderTransaction), r.Symbol, Market.USA)); } } }