alpacahq / alpacahq/Momentum-Trading-Example

Swap out Alpaca live data with Polygon API directly?

Offen
#18 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
714
Forks
221
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I'm not a US citizen and therefore can't access live data from Alpaca within my demo account.

I'm implementing Polygon via seems to work.

```

def get_polygon_credentials(alpaca_key=None):
#try:
# alpaca_key, _, _ = get_credentials(alpaca_key, 'ignored')
#except ValueError:
# pass

key_id = '######################' # os.environ.get('POLYGON_KEY_ID') or alpaca_key

#if key_id is None:
# raise ValueError('Key ID must be given to access Polygon API'
# ' (env: APCA_API_KEY_ID or POLYGON_KEY_ID)')
return key_id
```
plus

```
from polygon import RESTClient
from polygon import WebSocketClient, STOCKS_CLUSTER
```

I could not get macd to recognise. So using:

`from ta import trend`

Then:

` hist = trend.MACD`

Are there any other ways advised to use Polygon data alongside Alpaca and can I therefore trade using [](https://paper-api.alpaca.markets) ?

My output. Do the markets need to be live to run fully?

Getting current ticker data...
Success.
Tracking 0 symbols.
Getting historical data...
Success.
Watching 0 symbols.

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.