Skip to main content

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

Project description

jinx the Json INvestor eXchange package is a python SDK for getting financial data from IEX (the Investor Exchange) as JSON objects using the IEX Cloud API.

For more documentation, please see http://jinx.readthedocs.io.

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

If you're not sure about the file name format, learn more about wheel file names.

jinx-1.1.2-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: jinx-1.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d01e753e7dde1c0086808606edde597179fc0081ba52558ee7d72d017a976151
MD5 7c993501a766536be68c0e25ce88891a
BLAKE2b-256 3e3d83cdaf8816c10f292c6642ac82356aad03e9481fec6ca2dd1b826eae5145

See more details on using hashes here.

Supported by

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