Giter VIP home page Giter VIP logo

Comments (12)

Andrew5194 avatar Andrew5194 commented on July 28, 2024

image

from alpaca-backtrader-api.

shinhwas avatar shinhwas commented on July 28, 2024

I can't run too. Any update?

from alpaca-backtrader-api.

shinhwas avatar shinhwas commented on July 28, 2024

This is from bug. But it is already fixed.
Please release new version!

from alpaca-backtrader-api.

eliasluoma avatar eliasluoma commented on July 28, 2024

Hi, any updates regarding this. I have same issue.

Thanks in advance.

from alpaca-backtrader-api.

mmahalwy avatar mmahalwy commented on July 28, 2024

same problem here. any updates?

from alpaca-backtrader-api.

cole-seph avatar cole-seph commented on July 28, 2024

same issue.

from alpaca-backtrader-api.

SathishN avatar SathishN commented on July 28, 2024

+1

from alpaca-backtrader-api.

 avatar commented on July 28, 2024

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.

wstewarttennes avatar wstewarttennes commented on July 28, 2024

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.

shlomiku avatar shlomiku commented on July 28, 2024

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.

shlomiku avatar shlomiku commented on July 28, 2024

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.

algoeng avatar algoeng commented on July 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.