using System;
using System.Collections;
using System.Collections.Generic;
using QuantConnect.Securities;
using QuantConnect.Models;
namespace QuantConnect
{
/*
* QuantConnect University: Full Basic Template:
*
* The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
* We have explained some of these here, but the full algorithm can be found at:
* https://github.com/QuantConnect/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
*/
public class SimpleAlgorithm : QCAlgorithm
{
List<TradeBars> kdata = new List<TradeBars>();
//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
//Start and End Date range for the backtest:
SetStartDate(2014, 11, 1);
SetEndDate(DateTime.Now.Date.AddDays(-1));
//Cash allocation
SetCash(25000);
//Add as many securities as you like. All the data will be passed into the event handler:
AddSecurity(SecurityType.Equity, "IBM", Resolution.Minute, true);
}
//Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
public void OnData(TradeBars data)
{
kdata.Add(data);
}
public override void OnEndOfDay() {
Log("LOG it Here? At end of day");
Debug("DEBUG it Here? At end of day");
System.Console.WriteLine("CONSOLE it Here? At end of day");
}
public override void OnEndOfAlgorithm() {
Log("LOG it Here? At end of algorithm");
Debug("DEBUG it Here? At end of algorithm");
System.Console.WriteLine("CONSOLE it Here? At end of algorithm");
}
}
}