client-python icon indicating copy to clipboard operation
client-python copied to clipboard

Added Short Interest and IPOs support

Open justinpolygon opened this issue 1 year ago • 0 comments

Update client with Short Interest and IPOs support. This PR adds list_short_interest and list_ipos functions and working examples.

Short Interest

from polygon import RESTClient

client = RESTClient()  # POLYGON_API_KEY environment variable is used

short_interest = []
for si in client.list_short_interest(
    identifier="AMD",
    identifier_type="ticker",
    params={
        "date.gte": "2024-10-07",
        "date.lte": "2024-10-07",
    },
    limit=100
):
    short_interest.append(si)

print(short_interest)
$ python examples/rest/stocks-short_interest.py
[
    ShortInterest(
        currency_code="USD",
        date="2024-10-07",
        isin="US0079031078",
        name="Advanced Micro Devices Inc.",
        security_description="Ordinary Shares",
        short_volume=9180696,
        short_volume_exempt=48277,
        ticker="AMD",
        us_code="007903107",
    )
]

Company IPOs

from polygon import RESTClient

client = RESTClient()  # POLYGON_API_KEY environment variable is used

ipos = []
for ipo in client.list_ipos(ticker="RDDT"):
    ipos.append(ipo)

print(ipos)
$ python examples/rest/stocks-ipos.py
[
    IPOListing(
        currency_code="USD",
        final_issue_price=34.0,
        highest_offer_price=34.0,
        ipo_status="history",
        isin="US75734B1008",
        issue_end_date=None,
        issue_start_date=None,
        issuer_name="Reddit Inc.",
        last_updated="2024-03-26",
        listing_date="2024-03-21",
        listing_price=None,
        lot_size=None,
        lowest_offer_price=31.0,
        max_shares_offered=22000000,
        min_shares_offered=None,
        primary_exchange="XNYS",
        security_description="Ordinary Shares - Class A",
        security_type="CS",
        shares_outstanding=36871367,
        ticker="RDDT",
        total_offer_size=519401918.0,
        us_code="75734B100",
    )
]

justinpolygon avatar Oct 09 '24 23:10 justinpolygon