The code mask notation is a very concise way to select one or many time series at once.
It is not compatible with all the providers. In particular, only the providers from the following list accept code mask:
* BIS
* ECB
* Eurostat
* FED
* IMF
* IMF-WEO
* INSEE
* OECD
* WTO
Given 3 dimensions "frequency", "country" and "indicator", the user can select:
* one time series by giving its code: "M.FR.PCPIEC_IX"
* many series by enumerating dimensions codes: "M.FR+DE.PCPIEC_IX" is equivalent to ["M.FR.PCPIEC_IX", "M.DE.PCPIEC_IX"]
* many series by skipping a dimension, repeating "." in the code mask: "M..PCPIEC_IX" is equivalent to ["M.country1.PCPIEC_IX", "M.country2.PCPIEC_IX", ..., "M.countryN.PCPIEC_IX"]
Searching by dimension is a less concise way to select time series than using the code mask, but it's universal:
some fetchers are not compatible with the code mask notation. The following example fetches many series from the
["Doing Business" [DB]](https://db.nomics.world/WB/DB) dataset of the [World Bank](https://db.nomics.world/WB) provider, selecting for time series about France, Italy and Spain (`country` dimension),
and the indicator "Procedures required to start a business - Women (number)" (`indicator` dimension):
On the [cart page](https://db.nomics.world/cart) of the DBnomics website, click on "Copy API link" and copy-paste it as an argument of the fetch_series_by_api_link function.
Please note that when you update your cart, you have to copy this link again, because the link itself contains the IDs of the series in the cart.
The routines can interact with the [Time Series Editor](https://editor.nomics.world/) to transform time series by applying filters to them.
Available filters are listed on the [filters page](https://editor.nomics.world/filters).
The Time Series Editor is usable via a web interface ([example with AMECO/ZUTN/EA19.1.0.0.0.ZUTN](https://editor.nomics.world/series?source=dbnomics&series_id=AMECO/ZUTN/EA19.1.0.0.0.ZUTN))
but you can call it directly from MATLAB. The user is also able to chain many filters.
Here is an example of how to interpolate two annual time series with a monthly frequency, using a spline interpolation:
% provider_code [string] the code of the dataset provider.
% dataset_code [string] the code of the dataset.
% series_code [string] the code mask of the series. If provided, the provider_code and the dataset_code must specified.
% dimensions [char] dataset dimension codes. If provided it must be a string formatted like: '{"country":["ES","FR","IT"],"indicator":["IC.REG.COST.PC.FE.ZS.DRFN"]}'.
% series_ids [string] list of series IDs. It is string formatted like `provider_code/dataset_code/series_code`. If provided, the provider_code and the dataset_code shouldn't be specified.
% max_nb_series [integer] maximum number of series requested by the API. If not provided, a default value of 50 series will be used.
% api_base_url [string] the base URL used for API requests. If not provided, a default value of: 'https://api.db.nomics.world/v22/' will be used.
% dbnomics_filters [char] filters to apply on the requested series. If provided it must be a string formatted like: '[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]'.
%
% OUTPUTS
% df
%
% SPECIAL REQUIREMENTS
% When you (don't) use dimensions, you must specifiy provider_code and dataset_code.
% When you use series_code, you must specifiy provider_code and dataset_code.
% When you use series_ids, you must not specifiy provider_code nor dataset_code.
% Copyright (C) 2020 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% api_link [string] the URL used for the API request.
%
% OPTIONAL PARAMETERS
% dbnomics_filters [char] filters to apply on the requested series. If provided it must be a string formatted like: '[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]'.
% max_nb_series [integer] maximum number of series requested by the API. If not provided, a default value of 50 series will be used.
% editor_api_base_url [string] the editor URL used for API requests. If not provided, a default value of: 'https://editor.nomics.world/api/v1/' will be used.
%
% OUTPUTS
% df
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2020 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.