Skip to content

Dividend objects returned by list_dividends() don't have a "currency" attribute #494

@bfoz

Description

@bfoz

When fetching dividends using the python client (v1.12.2), the resulting objects are missing the "currency" field that the API documentation suggests should be there.

Fetching from the Documentation page (or https://api.polygon.io/v3/reference/dividends?ticker=ENB&apiKey=) yields:

{
    "results": [
        {
            "cash_amount": 0.8875,
            "currency": "CAD",
            "declaration_date": "2023-08-01",
            "dividend_type": "CD",
            "ex_dividend_date": "2023-08-14",
            "frequency": 4,
            "pay_date": "2023-09-01",
            "record_date": "2023-08-15",
            "ticker": "ENB"
        },
       ...

However, using the python client yields:

from polygon import RESTClient
client = RESTClient(key)
dividends = list(client.list_dividends('ENB'))
print(dividends[0])
print(dividends[0].cash_amount)
print(dividends[0].currency)

Dividend(cash_amount=0.8875, declaration_date='2023-08-01', dividend_type='CD', ex_dividend_date='2023-08-14', frequency=4, pay_date='2023-09-01', record_date='2023-08-15', ticker='ENB')
0.8875
Traceback (most recent call last):
  File "...", line 12, in <module>
    print(dividends[0].currency)
          ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Dividend' object has no attribute 'currency'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions