Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
1477.166%
Drawdown
6.900%
Expectancy
0
Net Profit
0%
Sharpe Ratio
6.739
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
1.863
Beta
0.3
Annual Standard Deviation
0.28
Annual Variance
0.078
Information Ratio
6.369
Tracking Error
0.283
Treynor Ratio
6.297
Total Fees
$0.00
namespace QuantConnect 
{   
    /*
    *   QuantConnect University: Generic Quandl Data Importer
    *
    *   Using the underlying dynamic data class "Quandl" we take care of the data 
    *   importing and definition for you. Simply point QuantConnect to the Quandl Short Code.
    *
    *   The Quandl object has properties which match the spreadsheet headers.
    *   If you have multiple quandl streams look at data.Symbol to distinguish them.
    */
    public class QCUQuandlImporter : QCAlgorithm
    {
    	bool entryToMarket = false;
        string CosmoOil = "TSE/5007";
        string EtfsWtiCrudeOil = "TSE/1690";
        Symbol wto;
        
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize()
        {
            SetCash(25000);
            SetStartDate(2015, 4, 01);         
            SetEndDate(2015, 4, 30); 
            
            //Add Generic Quandl Data:
            wto = AddCfd("WTICOUSD", Resolution.Minute, market:"oanda").Symbol;
            AddData<Quandl>(CosmoOil);
            AddData<Quandl>(EtfsWtiCrudeOil);
        }
        
        public override void OnData(Slice data) 
        {
        	//In this toy example, this data has higher frequency, so is better to execute orders here
        	if (entryToMarket || !Portfolio.Invested)
        	{
        		SetHoldings(wto, 1);
        	}
        	
        }
        
        public void OnData(Quandl data) 
        {
        	if (data.Symbol == CosmoOil)
        	{
        		Log (Time + " Cosmo Oil => Close: " + data.Value);
        	}
        	else if (data.Symbol == EtfsWtiCrudeOil)
        	{
        		Log (Time + " Etfs Wti Crude Oil  => Close: " + data.Value);
        	}
        	// Implement your logic here
        	bool someCondition = false;
        	if (someCondition) 
        	{
        		entryToMarket = true;
        	}
        }
    }
    
    
}