Skip to main content

An SDK for getting JSON objects using the IEX Cloud API.

Project description

A python package for getting JSON objects from the IEX Cloud API.

Description

This package was heavily based off of iexfinance however that project uses pandas which doesn’t work great when using docker and alpine. This package primarily exists to only return JSON.

Install

From PyPI with pip (latest stable release):

$ pip3 install jinx

From development repository (dev version):

$ git clone https://github.com/brettelliot/jinx.git
$ cd jinx
$ python3 setup.py install

Authentication

An IEX Cloud account is required to acecss the IEX Cloud API. Various plans are availalbe, free, paid, and pay-as-you-go.

Your IEX Cloud (secret) authentication token can be passed to any function or at the instantiation of a Stock object. The easiest way to store a token is in the IEX_TOKEN environment variable.

The desired IEX API version can be specified using the IEX_API_VERSION environment variable. The following versions are currently supported:

  • v1 - default (now same as iexcloud-v1)

  • iexcloud-beta

  • iexcloud-v1

  • iexcloud-sandbox - for use with the sandbox environment (test token must be used)

Usage

The Stock provides access to most endpoints, and can be instantiated with a symbol:

>>> from jinx.stock import Stock
>>> import json
>>> aapl = Stock('aapl')
>>> aapl_bs = aapl.get_balance_sheet()
>>> print (json.dumps(aapl_bs, sort_keys=True, indent=4))
{
    "balancesheet": [
        {
            "accountsPayable": 33018121739,
            "capitalSurplus": null,
            "commonStock": 4496599335,
            "currency": "USD",
            "currentAssets": 144612403174,
            "currentCash": 30172961915,
            "currentLongTermDebt": 10881096169,
            "fiscalDate": "2020-03-22",
            "goodwill": null,
            "intangibleAssets": null,
            "inventory": 3498769850,
            "longTermDebt": 101705344870,
            "longTermInvestments": 102909761019,
            "minorityInterest": 0,
            "netTangibleAssets": 78477657414,
            "otherAssets": 33597449752,
            "otherCurrentAssets": 14914938794,
            "otherCurrentLiabilities": 42539380185,
            "otherLiabilities": 21528724378,
            "propertyPlantEquipment": 44907661177,
            "receivables": 15986486509,
            "reportDate": "2020-03-20",
            "retainedEarnings": 33344074958,
            "shareholderEquity": 80276696449,
            "shortTermInvestments": 67226412874,
            "totalAssets": 325814813094,
            "totalCurrentLiabilities": 96306268790,
            "totalLiabilities": 245573706847,
            "treasuryStock": null
        }
    ],
    "symbol": "AAPL"
}

You can get quarterly or annual data, and specify the number of quarters or years to return:

>>> aapl_cf = aapl.get_cash_flow(period='annual', last=2)
>>> print(json.dumps(aapl_cf, sort_keys=True, indent=4))
{
    "cashflow": [
        {
            "capitalExpenditures": -10548387365,
            "cashChange": 25028153575,
            "cashFlow": 71074668596,
            "cashFlowFinancing": -94932114603,
            "changesInInventories": -291703549,
            "changesInReceivables": 265402510,
            "currency": "USD",
            "depreciation": 12783029260,
            "dividendsPaid": -14346206432,
            "exchangeRateEffect": null,
            "fiscalDate": "2019-09-27",
            "investingActivityOther": -1109270269,
            "investments": 58502395335,
            "netBorrowings": -7868025705,
            "netIncome": 57051020492,
            "otherFinancingCashFlows": -3031452489,
            "reportDate": "2019-09-19",
            "totalInvestingCashFlows": 47952023359
        },
        {
            "capitalExpenditures": -13632715598,
            "cashChange": 5844075612,
            "cashFlow": 80737644970,
            "cashFlowFinancing": -89912917113,
            "changesInInventories": 830556162,
            "changesInReceivables": -5367160638,
            "currency": "USD",
            "depreciation": 11177076598,
            "dividendsPaid": -14268054186,
            "exchangeRateEffect": null,
            "fiscalDate": "2018-09-24",
            "investingActivityOther": -775705637,
            "investments": 32259623849,
            "netBorrowings": 436890215,
            "netIncome": 62431044712,
            "otherFinancingCashFlows": -2573213034,
            "reportDate": "2018-09-27",
            "totalInvestingCashFlows": 16703213665
        }
    ],
    "symbol": "AAPL"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jinx-1.1.1-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jinx-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: jinx-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for jinx-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e0c9a3ba5c7c532158c7b1168a287af805d6149bdc718f6f879587bd11fee32d
MD5 f150ad4acac52a6a7b5b155fcce4b40e
BLAKE2b-256 e679988eab191763c45e20f28f77596de01148bb505f7453365cc5f256a69344

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page