Skip to content

A Julia interface for retrieving data from the International Monetary Fund (IMF).

License

Notifications You must be signed in to change notification settings

stephenbnicar/IMFData.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMFData

A Julia interface for retrieving data from the International Monetary Fund (IMF).

Installation

    (v1.x) pkg> add IMFData

Usage

Get a list of datasets accessible from the API:

    get_imf_datasets()

Note: While this function returns a list of all available datasets, currently the module only supports data requests from the International Financial Statistics (IFS) dataset.

Get the list of parameters ("dimensions") for a dataset and their values:

    get_imf_datastructure(database_id::String)

Example:

    julia> ifs_structure = get_imf_datastructure("IFS")
    Dict{String,Any} with 2 entries:
      "Parameter Names"  => 5×2 DataFrames.DataFrame
      "Parameter Values" => Dict Any  Any with 5 entries

Retrieve data from the IFS dataset

    get_ifs_data(area, indicator, frequency, startyear, endyear)
  • area and indicator must be Strings or Arrays of Strings (to request multiple series with one call).
  • frequency is limited to annual ("A"), quarterly ("Q"), or monthly ("M").
  • startyear and endyear must be Ints.

The function returns an IfsSeries object; the data (if available) is in the series field.

Example:

    julia> us_gdp = get_ifs_data("US", "NGDP_SA_XDC", "Q", 2015, 2016)
    IMF Data Series
    Database: IFS
    Area: US
    Indicator: NGDP_SA_XDC
    Description:
    Frequency: Q
    Time Period: 2015 to 2016
    Data: 8 x 2 DataFrame

    julia> us_gdp.series
    8×2 DataFrames.DataFrame
    │ Row │ date       │ value     │
    ├─────┼────────────┼───────────┤
    │ 12015-03-011.78747e7 │
    │ 22015-06-011.80932e7 │
    │ 32015-09-011.82277e7 │
    │ 42015-12-011.82872e7 │
    │ 52016-03-011.83252e7 │
    │ 62016-06-011.8538e7  │
    │ 72016-09-011.87291e7 │
    │ 82016-12-011.89055e7

With multiple requests:

    julia> us_ca_gdp = get_ifs_data(["US","CA"], "NGDP_SA_XDC", "Q", 2015, 2016)
    2-element Array{IMFData.IMFSeries,1}:
     IMF Data Series
    Database: IFS
    Area: US
    Indicator: NGDP_SA_XDC
    Description:
    Frequency: Q
    Time Period: 2015 to 2016
    Data: 8 x 2 DataFrame

     IMF Data Series
    Database: IFS
    Area: CA
    Indicator: NGDP_SA_XDC
    Description:
    Frequency: Q
    Time Period: 2015 to 2016
    Data: 8 x 2 DataFrame

Disclaimer

IMFData.jl is not affiliated with, officially maintained, or otherwise supported by the International Monetary Fund.