Structure of the file with export of trade currency rates

To organize the file structure, the JSON data format is used.

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 that using in applications. The list should consist of pairs currency number: currency code. 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, ...). It should all look something like this:

As you can see from the example above, currencies are specified in currencies, three currencies are specified there: dollars, rubles and bitcoins.

Next, we proceed to specify the currency pairs. They are specified in a special way, which as shown in the following example.

As you can already see, all currency pairs are specified in the following sequence: trade -> sale currency number -> for -> purchase currency number.

Only such a sequence, no other should be.

Now, for each currency pair, specify the list of orders. Each order is specified in the following form: [rate, amount] (without a space).

The 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. The rate is taken from X, and if it is in the form 1 = X then, with a minus sign.

Amount is the amount of currency available for purchase/sale at this rate.

The number of decimal places in the rate should be no more than 6, with rounding down. The number of decimal places in the sums of cryptocurrencies should be no more than 8, and for all others not more than 2.

The example below shows the following orders to buy/sell currency:

How to make rate a multiple?

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