Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Library for accessing the Datamonster REST API

Project description

========================== Datamonster Python Library

This library eases the use of the Datamonster REST API from Python


Installing Datamonster library

.. code::

    pip install datamonster_api

Working with companies

.. code::

    from datamonster_api import DataMonster
    dm = DataMonster(<key_id>, <secret_key>)

    print(list(dm.get_companies(query='hd')))   # Prints all companies whose name or ticker matches 'hd'

    apple = dm.get_company_by_ticker('aapl')    # Creates a company object for apple

    print(apple.quarters[:5])                   # prints first 5 quarter end dates
    print(list(apple.datasources)[:5])          # prints the first 5 datasources that cover apple

Working with data sources

.. code::

    print(list(dm.get_datasources(query='1010')))   # Prints all data sources whose name or provider matches '1010'

    print(list(                                     # Prints all data sources whose name or provider matches '1010'
        dm.get_datasources(                         # AND also cover apple

    datasource = list(dm.get_datasources(query='1010 Debit Sales Index'))[0]

    print(list(datasource.companies)[:5])          # Prints the first 5 companies covered by `1010 Debit Sales Index`

Getting data

.. code::

    import datetime
    from datamonster_api import Aggregation

    apple = dm.get_company_by_ticker('aapl')
    datasource = next(apple.datasources)        # Gets a datasource object
    datasource.get_data(apple)                  # Gets all data for the datasource filtering on apple

    agg = Aggregation(period='fiscalQuarter', company=apple)

    datasource.get_data(                        # Gets all data for the given datasource filtered by apple, 
        apple,                                  # aggregated by apple's fiscal quarter, and starting on
        agg,                                    # January 1, 2017 (inclusive), 1, 1)

Project details

Download files

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

Files for datamonster-api, version 0.4.7
Filename, size File type Python version Upload date Hashes
Filename, size datamonster_api-0.4.7.tar.gz (11.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page