QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.19k stars 3.16k forks source link

SPXL Delisting Instead of Mapping #419

Closed jaredbroad closed 8 years ago

jaredbroad commented 8 years ago

With map file:

20081105,bgu 20120628,bgu 20501231,spxl

The SPXL is delisting instead of mapping the symbol to its new file.

jaredbroad commented 8 years ago

2016-06-07 19_38_23-algorithmic trading platform - quantconnect com

namespace QuantConnect 
{   
    public class SPXLDemo : QCAlgorithm
    {
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize() 
        {
            SetStartDate(2010, 1, 1);         
            SetEndDate(DateTime.Now.Date.AddDays(-1));
            SetCash(25000);
            AddSecurity(SecurityType.Equity, "SPXL", Resolution.Minute);
        }

        public void OnData(TradeBars data) 
        {   
            if (!Portfolio.HoldStock) 
            {
                Order("SPXL",  100);
            }
        }
    }
}