Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trading hours on Independence Day 2017 and after Thanksgiving Day #641

Closed
michaelsrew opened this issue Nov 26, 2016 · 6 comments
Closed

Comments

@michaelsrew
Copy link

michaelsrew commented Nov 26, 2016

I think QuantConnect.Lean trades during after hours like it would be normal trading hours on the 25.11.
The after hours startet on the 25.11 at 13:00 till 17:00 i think.

https://www.nyse.com/markets/hours-calendars

check also Christmas Eve Observed on the 23.11 maybe it is also till 13:00.

best regards

@michaelsrew
Copy link
Author

michaelsrew commented Dec 2, 2016

From Terminal:
//test
public class BasicTemplateAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2016, 11, 25);
SetEndDate(2016, 11, 26);
SetCash(25000);
AddSecurity(SecurityType.Equity, "VRX", Resolution.Minute, true, false);
}

    public void OnData(TradeBars data) 
    {   
        if (!Portfolio.HoldStock) 
        {
            int quantity = (int)Math.Floor(Portfolio.Cash / data["VRX"].Close);      
            if (Time.Hour > 14) {
            	Order("VRX",  quantity);
            	Debug("Purchased SPY on " + Time.ToShortDateString() + " " + Time.ToShortTimeString());
            }
        }
    }
}

Downloaded Trade CSV File:
Time,Symbol,Price,Quantity,Type,Status,Value,Tag
2016-11-25T20:00:00Z,VRX,17.03,1467,Market,3,24983.01,

Backtest Console:
Successfully sent backtest request for 'Muscular Black Cormorant', (Compile Id: 0760a76d23f295a7b1ba092dee6af187)
166 | 10:56:38:
Backtest ID: 98f4ea612126666675c34def8d46c5a6 successfully sent to cloud.
167 | 10:56:47:
Launching analysis for 98f4ea612126666675c34def8d46c5a6 with LEAN Engine v2.2.0.2.893
168 | 10:56:47:
Purchased SPY on 11/25/2016 15:00
169 | 10:56:47:
Algorithm Id:(98f4ea612126666675c34def8d46c5a6) completed in 0.25 seconds at 2k data points per second. Processing total of 394 data points.

best regards

@jaredbroad
Copy link
Member

jaredbroad commented Dec 2, 2016 via email

@michaelsrew
Copy link
Author

Hmm it works with almost every stock.... SPY, GOOG,.....
:)

@michaelsrew
Copy link
Author

Or,
i dont exactly know how it works but..... the FILLFORWARD is true so because of the trading hours it bought the stock... maybe.

@jaredbroad
Copy link
Member

Yes that'll be it -- the FF is creating the bars and the market hours don't support half days yet. Thank you for reporting, we'll try and submit a fix soon.

@jaredbroad
Copy link
Member

Fixed in #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants