Configuration of the Get NBP Exchange Rates Service
The National Bank of Poland publishes a Web API which enables users to download data on previous and current exchange rates. In [!INCLUDE Business_Central_md, you can easily define settings that allow you to use the API to download and update exchange rates.
Defining the Basic Settings of the Service
To define the settings for downloading and updating NBP exchange rates and run the service:
Choose the icon, enter Currency Exchange Rate Services, and then select a related link.
On the Curr. Exch. Rate Services page, create a new exchange rate service.
On the Currency Exch. Rate Service page that opens, on the General FastTab, fill in the following fields:
- Code - Specify the code name for the currency exchange service.
- Description - Specify a descriptive name for the data exchange service.
- On the Service FastTab, in the Service URL field, enter the URL address for the web API.
Note
In the case of the API provided by NBP, in the Service URL field enter: http://api.nbp.pl/api/exchangerates/tables/A?format=xml
- On the Field Mapping FastTab, map the fields listed below by entering values in the Source column.
Parent Node for Currency Code -
/ArrayOfExchangeRatesTable/ExchangeRatesTable/Rates/Rate
Currency Code -
/ArrayOfExchangeRatesTable/ExchangeRatesTable/Rates/Rate/Code
Effective Date -
/ArrayOfExchangeRatesTable/ExchangeRatesTable/EffectiveDate
Exchange Rate - Leave the Source field blank and enter 1 in the Default Value field.
Relational Exch. Rate Amount -
/ArrayOfExchangeRatesTable/ExchangeRatesTable/Rates/Rate/Mid
Exch. Rate Table No. -
/ArrayOfExchangeRatesTable/ExchangeRatesTable/No
Transformation Rule for a Time Difference
Since the exchange rate table published by the NBP is valid starting from the date following the date specified in the table in the Effective Date field, it is necessary to prepare a transformation rule that supports the processing of a time difference. To create and define a transformation rule:
In the line that contains the Starting Date caption, expand the Transformation Rule field and select New.
On the Transformation Rules page, fill all the fields required as follows:
- Code - Enter ONE DAY FORWARD.
Note
If another code is entered in the Code field, the transformation is not completed successfully.
- Description - Enter Change date to day ahead.
- Transformation Type - Select Custom.
Note
To test the transformation, enter the date in the YYYY-MM-DD format in the Test Text field and choose the Update button.
- Choose the OK button to close the page.
Note
The Assisted Setup page has been extended with the Set up NBP exchange rates service feature. This feature enables the user to add the exchange rate service with predefined URL addresses of the service provided by the National Bank of Poland. The required formula: ONE DAY FORWARD, will be also added automatically. 4
Enabling the Service
To enable the currency exchange rate download service with the settings defined:
- On the General FastTab on the Currency Exch. Rate Service page, select the Enabled field. This way, the application will create a job queue entry in which the currency exchange rates from the defined source will be downloaded on a daily basis.
Note
The relational adjustment exchange rate is used only when adjusting exchange rates for balance sheet valuation, most often once a year (or once a month). If the current exchange rate is used with a one-day shift (to use the previous day exchange rate), there is no possibility to automatically complete the course for correction.
Additional Setup Options
Several setup options are available to enable you to customize the functionality to your needs.
Currency Exchange Rate for Amounts Not Equal to 1
Some companies set the currency exchange rate for the amount of 100. To set the currency exchange rate for different exchange rate amounts:
Define the basic settings described in the Defining the Basic Settings of the Service section, but do not enable the service.
On the Field Mapping FastTab, in the line containing the Exchange Rate caption in the Default value field, set the appropriate value.
On the Field Mapping FastTab, select Data Exchange Definitions on the ribbon.
On Data Exchange Definition page that opens, on the Line Definitions FastTab, select Field Mapping on the ribbon.
On the Field Mapping page, on the Field Mapping FastTab, in the line containing the Exchange Rate caption, fill in the Multiplier field (by default, the field is not visible on the page) for the relational currency exchange rate by entering the same value you entered in step 2.
Enable the data exchange service.
Retrieving Historical Data
The currency exchange API makes it easy to retrieve past currency exchange rates.
To retrieve historical data on NBP exchange rates:
Disable the currency exchange rate service on the Currency Exch. Rate Service page and set the service's URL to http://api.nbp.pl/api/exchangerates/tables/A/startDate/endDate?format=xml.
Specify the period by defining startDate and endDate in the YYYY-MM-DD format. The period cannot exceed 93 days.
After setting the URL address, enable the service.
Use the Update Exchange Rates action on the Currencies page to update the exchange rates for specific dates and then restore the original service URL.