Skip to content
/ imfpy Public

An API Client for retrieving and processing IMF Direction of Trade Statistics data. https://imfpy.readthedocs.io/en/latest/

License

Notifications You must be signed in to change notification settings

ltk2118/imfpy

Repository files navigation

imfpy

A package for interacting with the IMF's JSON RESTful API with Python!! In this preliminary phase, the package is a tool for understanding, retrieving and exploring Direction of Trade Statistics (DoTS) data.

This API client is intended to be useful for economic policymakers, researchers, government officials and more. The package enables the efficient retrieval of trade statistics from any country or country group over the span for which the IMF has data. Functions are designed to be easy-to-understand and adaptive to multiple query types.

Moving forward, I will add more functionality to each module, so that users may retrieve and analyse data from other IMF databases.

Installation

!pip install imfpy

Depends on:

  • python 3.7 and above
  • pandas 1.1.3 and above
  • requests 2.19.0 and above
  • matplotlib 3.2.2. and above

Usage

The package contains three modules:

searches contains many helper functions that assist the user in searching through available IMF databases, dimensions, metadata and variables.

retrievals contains functions that retrieve data from important databases.

For example, retrievals.dots pulls data from the DoTS database including imports, exports, two-way trade and trade balances for IMF countries and country-groups. The function handles flexible queries and formats the returned data to the user's specifications.

#Example: retrieve Greece annual trade data
>>> from imfpy.retrievals import dots
>>> dots("GR", ["US", "AU", "DE"], 2000, 2005)

tools contains functions that conduct rudimentary analysis and visualization on the data returned by retrievals functions. For example, the dotsplot function transforms the result of dots() into time series plots.

#Example: plot Australia trade data
>>> from imfpy.tools import dotsplot
>>> d = dots('AU',['US','CN'], 2000, 2020, freq='A', form="long")
>>> dotsplot(d, subset=['Trade Balance', 'Twoway Trade'])

Links

Documentation

Distribution

Testing

Extras

Contributing

Interested in contributing? Want to use this package? Please get in touch! Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

imfpy was created by Liam Tay Kearney. It is licensed under the terms of the MIT license.

Credits

imfpy was created with cookiecutter and the py-pkgs-cookiecutter template.

About

An API Client for retrieving and processing IMF Direction of Trade Statistics data. https://imfpy.readthedocs.io/en/latest/

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages