Overall Statistics |
Total Trades 1 Average Win 0% Average Loss -59.93% Compounding Annual Return -5.941% Drawdown 99.900% Expectancy -1 Net Profit -59.929% Sharpe Ratio 2.411 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 3976.461 Beta -136.512 Annual Standard Deviation 1645.678 Annual Variance 2708255.142 Information Ratio 2.411 Tracking Error 1645.681 Treynor Ratio -29.066 |
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; using System.Globalization; namespace QuantConnect { public class Google : BaseData { public decimal Open = 0; public decimal High = 0; public decimal Low = 0; public decimal Close = 0; public decimal AdjustedClose = 0; public decimal Volume = 0; public Google() { this.Symbol = ""; } public override string GetSource(SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed) { var startDate = new DateTime(2000, 1, 1).ToString("yyyy-MM-dd"); var endDate = DateTime.Now.ToString("yyyy-MM-dd"); //QUANDL WRAPPER ON Google FINANCE API TO SORT DATA: //https://www.quandl.com/api/v1/datasets/GOOG/NYSE_TKC.csv?trim_start=2000-01-01&trim_end=2014-12-03&sort_order=asc return "https://www.quandl.com/api/v1/datasets/GOOG/" + config.Symbol + ".csv?trim_start=" + startDate + "&trim_end=" + endDate + "&sort_order=asc&exclude_headers=true";; } public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint datafeed) { Google gBar = new Google(); try { string[] data = line.Split(','); //Required. gBar.Symbol = config.Symbol; gBar.Time = DateTime.ParseExact(data[0], "yyyy-MM-dd", CultureInfo.InvariantCulture); //User configured / optional data on each bar: gBar.Open = Convert.ToDecimal(data[1]); gBar.High = Convert.ToDecimal(data[2]); gBar.Low = Convert.ToDecimal(data[3]); gBar.Close = Convert.ToDecimal(data[4]); gBar.Volume = Convert.ToDecimal(data[5]); //This is the value the engine uses for portfolio calculations gBar.Value = gBar.Close; } catch { } return gBar; } } }
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; namespace QuantConnect { // Name your algorithm class anything, as long as it inherits QCAlgorithm public class CustomDataYahooQuandl : QCAlgorithm { //Initialize the data and resolution you require for your strategy: public override void Initialize() { SetStartDate(2000, 1, 1); SetEndDate(2014, 12, 3); SetCash(25000); //Quandl Indexes AddData<Yahoo>("INDEX_SPY", Resolution.Minute); AddData<Yahoo>("INDEX_VIX", Resolution.Minute); //Google Finance API has better TKC data. AddData<Google>("NYSE_TKC", Resolution.Minute); } public void OnData(TradeBars data) { //QuantConnect SPY Minute Events here: } public void OnData(Google data) { //Google/Quandl TKC Events here: if (!Portfolio.Invested && data.Value > 0) { var quantity = (int) (Portfolio.Cash / data.Value); Order("NYSE_TKC", quantity); } } public void OnData(Yahoo data) { // SPY & VIX here } } }
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; using System.Globalization; namespace QuantConnect { public class Yahoo : BaseData { public decimal Open = 0; public decimal High = 0; public decimal Low = 0; public decimal Close = 0; public decimal AdjustedClose = 0; public decimal Volume = 0; public Yahoo() { this.Symbol = ""; } public override string GetSource(SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed) { var startDate = new DateTime(2000, 1, 1).ToString("yyyy-MM-dd"); var endDate = DateTime.Now.ToString("yyyy-MM-dd"); //QUANDL WRAPPER ON YAHOO FINANCE API TO SORT DATA: //https://www.quandl.com/api/v1/datasets/YAHOO/INDEX_SPY.csv?trim_start=2000-01-01&trim_end=2014-12-03&sort_order=asc return "https://www.quandl.com/api/v1/datasets/YAHOO/" + config.Symbol + ".csv?trim_start=" + startDate + "&trim_end=" + endDate + "&sort_order=asc&exclude_headers=true";; } public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint datafeed) { Yahoo yBar = new Yahoo(); try { string[] data = line.Split(','); //Required. yBar.Symbol = config.Symbol; yBar.Time = DateTime.ParseExact(data[0], "yyyy-MM-dd", CultureInfo.InvariantCulture); //User configured / optional data on each bar: yBar.Open = Convert.ToDecimal(data[1]); yBar.High = Convert.ToDecimal(data[2]); yBar.Low = Convert.ToDecimal(data[3]); yBar.Close = Convert.ToDecimal(data[4]); yBar.Volume = Convert.ToDecimal(data[5]); yBar.AdjustedClose = Convert.ToDecimal(data[6]); //This is the value the engine uses for portfolio calculations yBar.Value = yBar.AdjustedClose; } catch { } return yBar; } } }