Re: JBookTrader for overnight trading

120 views
Skip to first unread message

nonlinear

unread,
Sep 27, 2012, 3:06:19 PM9/27/12
to jbook...@googlegroups.com
Hello  Bangfu ,

I'll mention three things here:

1. You can capture both the day and night session by setting the trading schedule to arbitrary wide period within the day. For example:
TradingSchedule tradingSchedule = new TradingSchedule("0:01", "23:59", "America/New_York");

2. Alternatively, you can run three strategies at the same time, one for day session, and the other one for night session, and one for overnight session. For example:
TradingSchedule tradingSchedule = new TradingSchedule("9:30", "16:00", "America/New_York"); 
TradingSchedule tradingSchedule = new TradingSchedule("17:30", "23:59", "America/New_York");  
TradingSchedule tradingSchedule = new TradingSchedule("0:01", "9:30", "America/New_York");   

3. Once the trading schedule is set, you can run the strategy without restarting JBT or TWS until the contract expires. Effectively, once you start it, you can go away, and the strategy would trade every day on the schedule.

On Thursday, September 20, 2012 3:47:36 AM UTC-4, Bang wrote:
Hi Guys
 
Is there any way to set the TradingSchedule for both day & night session, or even a whole week?
 
Thanks advance
Bangfu
 
 
 

Klaus

unread,
Sep 30, 2012, 10:51:11 AM9/30/12
to jbook...@googlegroups.com
Hi, 

number 1 is a valid possibility. However, it should be recognized that this will also mean that (depending on instrument) you may end up with open positions over the weekend as on Friday trading typically stops earlier and if you have an open position at this time, you are just stuck with it.

An alternative would be to put the small gap at the end of the friday trading session to not run into the weekend problem. However, this would mean that during the week the position will be closed always before after the hour trading. It depends on your strategy, whether you want to do this - or not. 

Option 2 does not have the weekend problem, but does exactly do the intermediate position closing. 
Given that parameters might actually be different during the different slots, it seems the more appropriate approach, however.

It would however, be interesting to have an extension for JBT for full week trading schedules to minimize number of sale / buy actions for long-running strategies.

Cheers
  Klaus
Reply all
Reply to author
Forward
0 new messages