rational-trading / rational-trading

GNU Affero General Public License v3.0
0 stars 1 forks source link

Polygon API Setup #27

Closed mileswatson closed 1 year ago

mileswatson commented 1 year ago

Create some python functions that can get stock news, financials, and pricing history for a given stock. Ideally specify MyPy types to make the interface easier to understand.

trevorgh commented 1 year ago

2 examples for financials using https://polygon.io/docs/stocks/get_vx_reference_financials

company_name*string balance_sheetobject - fac:currentAssets

luo-simon commented 1 year ago

I'm only familiar with using the requests library to interact with REST APIs - are we all okay if I use this library?

@StefanPitur @dylan-mankin

mileswatson commented 1 year ago

Have you tried the official Python library @luo-simon? https://github.com/polygon-io/client-python

luo-simon commented 1 year ago

Ah yes, forgot about this - thanks :) @mileswatson

luo-simon commented 1 year ago

Having a problem with testing the API via the official Python library. Tried waiting and retrying, but always seem to get this error message:

polygon.exceptions.BadResponse: {"status":"ERROR","request_id":"045474007c9d5f095b94247afe203b04","error":"You've exceeded the maximum requests per minute, please wait or upgrade your subscription to continue. https://polygon.io/pricing"}

Can someone else try running this and let me know if they get the same error? The basic code for doing this is as follows:

from polygon import RESTClient

client = RESTClient(api_key=config.API_KEY)
news = client.list_ticker_news(ticker="AAPL")

We can discuss more on Tues or earlier time if free.