Comments (7)
Can I have more details about what we want to achieve exactly? The first thing I think of is to use the lifecycle method after_market_closes but maybe we want a more complex behavior.
from lumibot.
This is an interesting point.
I'm wondering if an override in the is_market_open
method would help where one could manually extend the hours of the day. This issue comes up a lot. When just using bars and time, trading times/restrictions can be added in manually. e.g. Client only wants to trade the LSE or afterhour coins.
This can come up too when clients just want to set the times they trade. I've had clients not want to have their algo trade during lunch.
from lumibot.
I wonder if we couldn't have an option for the user to create a parameter dictionary that would give hours (and maybe days) where trading is permitted or excluded. These could have labels for the keys. For example:
trading_hours = dict(
late_start=dict(
start=datetime.time(0, 0),
end=datetime.time(9, 35),
trading=False,
),
lunch=dict(
start=datetime.time(11, 45),
end=datetime.time(13, 15),
trading=False,
)
)
We could then layer this logic over the is_market_open
logic to determine market openness.
from lumibot.
from lumibot.
@grzesir Is this matter specific to crypto trading or are there some stocks that can be traded outside opening hours.
@neilsmurphy I think it is possible to add the dictionary trading_hours
you suggested to how the method StrategyExecutor._run_trading_session
behave without too much trouble (Inside the while statement). We can also add a function to be executed in that time range.
from lumibot.
Is this feature implemented? If so, any doc on it?
from lumibot.
from lumibot.
Related Issues (20)
- Alpaca broker fails to authorize and/or connect... HOT 3
- UnboundLocalError: cannot access local variable 'loop_limit' where it is not associated with a value HOT 12
- Add support for bybit HOT 3
- TradingView - webhooks HOT 3
- Kraken stop_limit order not working HOT 1
- {"code":40310000,"message":"new orders are rejected by user request"} HOT 1
- Not possible to get historical_prices in minutes while backtesting HOT 2
- Error when attempting `pip install lumibot` HOT 6
- Polygon feather cache files become stale on splits HOT 1
- OOM when using PolygonBacktesting with many (100+) stocks
- Bug: strategy returns wrong position quantity when requested after order is filled (`self.get_position(asset)`)
- Bug: `get_orders()` not working
- Github Codespace incompatibility HOT 2
- Naive time - no tzinfo set HOT 13
- Adjusted option prices become stale too when stocks split.
- Polygon Backtesting does not include dividends HOT 8
- Python version 3.9 does not support match statements HOT 4
- Error emitted on keyboard interrupt
- metadata-generation-failed HOT 3
- Issue duckdb conversion HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lumibot.