Comments (12)
from alpaca-backtrader-api.
I can't run too. Any update?
from alpaca-backtrader-api.
This is from bug. But it is already fixed.
Please release new version!
from alpaca-backtrader-api.
Hi, any updates regarding this. I have same issue.
Thanks in advance.
from alpaca-backtrader-api.
same problem here. any updates?
from alpaca-backtrader-api.
same issue.
from alpaca-backtrader-api.
+1
from alpaca-backtrader-api.
I don't think you can access the Polygon API from a paper trading account. Hoping @umitanuki would be so generous as to provide an update.
As for the above issue, it is caused by leaving "historical = True". For paper trading, it needs to be "False," which effectively deactivates the "fromdate". Relevant code ----->
data0 = DataFactory( dataname='AAPL', historical=False, #!!! fromdate=datetime(2015, 1, 1), timeframe=bt.TimeFrame.Minutes) cerebro.adddata(data0)
@umitanuki details this in his Medium post on this topic, saying "All you need to do is to change the “historical=True” to False and set broker to Alpaca." (source: https://medium.com/automation-generation/introducing-alpaca-backtrader-integration-898d8cabffdc)
HOWEVER, doing this causes a current event loop error, resulting in the following message:
Starting Portfolio Value: 10000.00 Exception in thread Thread-1: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/Users/MyName/PycharmProjects/alpacatest/venv/lib/python3.7/site-packages/alpaca_backtrader_api/alpacastore.py", line 416, in _t_streaming_prices base_url=self.p.base_url) File "/Users/MyName/PycharmProjects/alpacatest/venv/lib/python3.7/site-packages/alpaca_backtrader_api/alpacastore.py", line 91, in __init__ self.conn = tradeapi.StreamConn(api_key, api_secret, base_url) File "/Users/MyName/PycharmProjects/alpacatest/venv/lib/python3.7/site-packages/alpaca_trade_api/stream2.py", line 27, in __init__ self.loop = asyncio.get_event_loop() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py", line 644, in get_event_loop % threading.current_thread().name) RuntimeError: There is no current event loop in thread 'Thread-1'.
Alpaca + Backtrader are awesome. Really hoping we can get an example of an algorithm made in backtrader that can flipped "live" to Alpaca paper trading for testing. Fingers crossed.
from alpaca-backtrader-api.
I think this may have to do with polygon's depreciation of v1 aggregate api call. I was getting the same error as Andrew5194 and was able to fix it by forking this and updating the polygon call on line 355 of alpacastore.py (and a few other lines) to the v2 aggregate api call. Would be great if we could update this here so I can stay off my fork!
from alpaca-backtrader-api.
currently, alpaca_backtrader_api works with polygon as a datasource out of the box.
that means you need a live key to be able to access the polygon API
from alpaca-backtrader-api.
please check the version on pypi for the latest updates.
this issue should be resolved. make sure you are using a funded alpaca account.
let me know if there are any more issues with this.
from alpaca-backtrader-api.
@shlomikushchi I still have this issue. I have the latest package installed:
pip freeze | findstr alpaca-backtrader-api
alpaca-backtrader-api==0.7
I copy and pasted sma_crossover_strategy.py from samples folder. provided a live account ID and key (and actually changing "paper" to false for store) and still got this:
RuntimeError: There is no current event loop in thread 'Thread-11'.
from alpaca-backtrader-api.
Related Issues (20)
- Not a reliable API
- backtrader-api uses deprecated alpaca-trade-api - will it be migrated to alpaca-py?
- Documentation for creating new Alpaca is broken. HOT 1
- Trading Calender - Package Issue HOT 3
- Cannot import alpaca-backtrader-api (Python 3.9.9 MacOS) HOT 5
- backtest not going back far enough HOT 2
- Multiple datas has connection limited error?
- alpaca-trade-api uses UTC while `_clear_out_of_market_hours` assumes NY Time. HOT 1
- Alpaca AttributeError: 'Asset' has not attribute 'status'
- Data websocket error with paper trading. Error code = 1002 (protocol error)
- Multiple WebSocket Open or Proxy - for multiple strategies
- Cannot purchase Long and create a trailing stop
- The Default Value for 'stocklike'
- only getting minute data until 12pm EST everyday in historical mode HOT 1
- Multiple datas sample no longer works HOT 1
- alpaca-trade-api-python is being deprecated by alpaca-py HOT 1
- Replay with historical data only retrieve daily bars instead replaying every minute
- module 'finplot' has no attribute 'add_order' HOT 1
- error installing on Windows 11, Python 3.9 HOT 3
- Wrong timezone for DataFactory
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 alpaca-backtrader-api.