| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 11.563% Drawdown 12.500% Expectancy 0 Net Profit 0% Sharpe Ratio 0.955 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.114 Beta 0.009 Annual Standard Deviation 0.121 Annual Variance 0.015 Information Ratio 0.01 Tracking Error 0.17 Treynor Ratio 12.161 Total Fees $1.00 |
using System.Runtime.CompilerServices;
namespace QuantConnect
{
public class BasicTemplateAlgorithm : QCAlgorithm
{
private bool first;
public override void Initialize()
{
first=true;
SetStartDate(2013, 1, 1);
SetEndDate(DateTime.Now.Date.AddDays(-1));
SetCash(25000);
AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
}
public void OnData(TradeBars data)
{
if(first)
{
first=false;
int quantity = (int)Math.Floor(Portfolio.Cash / data["SPY"].Close);
Order("SPY", quantity);
Debug("Purchased SPY on " + Time.ToShortDateString());
Log(msgWithLine("This is a longer message send to log."));
}
}
public string msgWithLine(string msg, [CallerLineNumber] int sourceLineNumber = 0)
{
return "Linenumber="+sourceLineNumber+" "+msg;
}
}
}