USD Conversion

All prices on DMEX are in US Dollars. However, the profits are paid in the collateral currency chosen by the user. Therefore the profits made in USD must be converted to the collateral currency when a position is settled.

To make this work properly, the conversion rate between USD and the collateral currency (eg. ETH/USD) is set up during the order creation.

For example, if you want to open a position using ETH as collateral currency, inside the Futures Contract the multiplier parameter will be set:

Multiplier=1/ETHUSD100000000Multiplier = 1/ETHUSD * 100 000 000

When closing the position, the profits made in USD will be converted to ETH by multiplying the profit with the multiplier.

Let's say that ETH was worth 125$ when you opened the position. This means that the multiplier = 1/125*100 000 000 = 800 000. If for example you make a 100$ profit on this position, you will be credited 100$ * 800 000 / 100 000 000 = 0.8 ETH.

We use the 100000000 (or 1e8) in the formula because of the particularities of Ethereum smart contract design. Ethereum smart contracts don't support floating numbers, so all formulas are multiplied by a standard number (1e8 or 1e18) before performing divisions. Otherwise the division that results in a fraction would be truncated to the integer value by the Ethereum Virtual Machine.

Last updated

Was this helpful?