alpacahq / alpacahq/alpaca-backtrader-api

Encountering error using sample

Offen
#151 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
702
Forks
160
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,
Getting started with alpaca and backtrader, and while I can backtest just fine I am running into a weird error when trying to switch to live-paper mode.

Long story short, I ended up using the sample in this very repo, [strategy_readme_sample](https://github.com/alpacahq/alpaca-backtrader-api/blob/master/sample/strategy_readme_sample.py) to reduce mistakes I may have made.

The script has not been modified, save loading my credentials

Turns out the same issue happens. Once I run the script as-is, I get this error:

### Script as-is output:
```
Starting Portfolio Value: 72948.0
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/lib64/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/alpaca_backtrader_api/alpacastore.py", line 723, in _t_streaming_prices
method=method,
UnboundLocalError: local variable 'method' referenced before assignment
```

This seems to happen every time I try to paper trade with live data.

Is this because I do not have a funded account? My goal is to place "real" paper trades with my Alpaca paper account keys, and see them on my dashboard.

I have successfully placed trades using the Python Alpaca API SDK, without backtrader. I do not see why I would need a funded account between the two since the API is the same.

Any ideas?

Thanks in advance!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.