Basic structure of a file format with export of currency exchange rates

It all starts with such structure:

Spaces and indents in the examples are used solely for the convenience of their perception.


Then you need to specify a list of currencies. It should consist of pairs currency number: signature. The currency number cannot be 0, and must consist of digits from 0 to 9, and/or letters from a to z. As a currency number, you can use its number from the database or the sequency number of its appearance in the file (for example: 1, 2, ..., 9, a, ..., z, 10, ..., 1a, ...).

Only currencies that are involved in exchanges should be specified.

The example below shows how the list of such currencies will look: Perfect Money USD, Alfa-Bank RUB and Bitcoin.


The next step will be specifing of exchanges. The following exchanges are shown in the example below:

As you can see from the example, all exchanges are specified strictly in the following sequence: exchange -> incoming currency number -> to -> outgoing currency number.

Only such a sequence, no other should be.


Each rate must be a multiple of 1, that is, either 1 = X or X = 1, while X must be a number greater than or equal to 1. How to make the rate a multiple of 1 is described here.

There are two forms of specifing a rate in a file, short and extended. The short form of the rate should be used if, in addition to the exchange rate, no required specified other information. In all other cases, you need to use the extended form.

The rate is specified in the file according to the information in the table.

Rate Short form Extended form
Х = 1 Х {"xr": X}
1 = Х {"xr": -X}
1 = 1 1 {"xr": 1}

The number of decimal places in the rate should be no more than 6. Rounding down.

All of the above can be seen in the following example with such exchange rates:

The extended form of the rate in the example is specified only to demonstrate both forms, as it should actually be seen in the example for reserves.

How to make rate a multiple?

Take the smaller of two numbers and divide each number of the rate into it. For instance:


Finally, we specify the reserves of currencies, they, like currencies, are also indicated as a list. It should consist of pairs currency number: reserve. As the currency number, you need to specify the number under which the currency is indicated in the list of currencies. As a reserve, you need to specify the amount of currency that is available for exchange.

Zero or negative reserves not specified. The lack of a reserve in itself means that it is not there, it is 0.

The number of decimal places for cryptocurrencies should be no more than 8, and for all others no more than 2.

Sometimes, it becomes necessary to specify an individual reserve for a particular exchange, in this case, it must be specified in amount, in the information for this exchange, as in the example below.

In the example below, the following reserves are specified: 945.54 Perfect Money USD, 12500 Alfa-Bank RUB and 0.67231509 Bitcoin, as well as 300 Perfect Money USD, for a specific exchange of Alfa-Bank RUB to Perfect Money USD.

What to do next?

This page described the basic structure of the file with the export of currency exchange rates, but very often, you need to add more information by exchanges to the file. You need to refer to the menu in the right column to find out what additional information by exchanges can still be specified.