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

Before trading start #389

Merged
merged 2 commits into from Sep 4, 2014

Conversation

Projects
None yet
4 participants
@richafrank
Member

richafrank commented Aug 27, 2014

A TradingAlgorithm method called before each trading day.

This method is called after initialize, but before the first bar of each trading day, with the algo's current datetime set to midnight of the next bar's datetime.

if (next_day is not None
and next_day < self.perf_tracker.last_close):
self._call_before_trading_start(next_day)

This comment has been minimized.

@richafrank

richafrank Sep 2, 2014

Member

@ehebert Any suggestions for ways to consolidate the checks for whether to call before trading start?

This comment has been minimized.

@ehebert

ehebert Sep 2, 2014

Member

This may be out of scope, but what if the data sources emitted a MARKET_OPEN event?

This comment has been minimized.

@richafrank

richafrank Sep 3, 2014

Member

I like that idea, but I also agree: not going to make that part of this PR.

@richafrank richafrank force-pushed the before_trading_start branch from f145cfa to 4aadd2c Sep 3, 2014

@coveralls

This comment has been minimized.

coveralls commented Sep 3, 2014

Coverage Status

Coverage increased (+0.06%) when pulling 4aadd2c on before_trading_start into 1b2d799 on master.

mkt_close < self.perf_tracker.last_close
try:
mkt_open, mkt_close = \
trading.environment \

This comment has been minimized.

@ssanderson

ssanderson Sep 3, 2014

Member

I've been using TradingEnvironment.instance() where possible to make the singleton-ness of the environment more clear. There's plenty of legacy places where this is still used as written though, so might just warrant one big cleanup elsewhere.

This comment has been minimized.

@richafrank

richafrank Sep 3, 2014

Member

That's a good idea. I agree, let's keep that change separate.

@richafrank richafrank force-pushed the before_trading_start branch from 4aadd2c to 6a5eaea Sep 3, 2014

@coveralls

This comment has been minimized.

coveralls commented Sep 3, 2014

Coverage Status

Coverage increased (+0.06%) when pulling 6a5eaea on before_trading_start into 1b2d799 on master.

@richafrank richafrank merged commit 6a5eaea into master Sep 4, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@richafrank richafrank deleted the before_trading_start branch Oct 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment