Buy and Sell cryptocurrency near you
14109 cities and 249 countries including United States
Sign Up for free

P2P price equations

It is very important for many traders to conduct trades according to the current exchange rate. This guide explains how to use complex price equations to control the exchange rate in your ads better.

What is the equation for setting the exchange rate?

The equation of exchange rate allows you to automatically update the rate, according to the fluctuations of prices on various exchanges. At P2PCOINEX.COM, we automatically receive information from market data sources, and update the price of your ad immediately after new information is received. To create your own exchange Price equation, select your market data sources and combine or modify them with the help of operators.

The default price equation used for ads uses a special market data source called btc_in_usd and a simple multiplication operator to consider a profit beyond the market price.

Source of market data btc_in_usd gives an average price from several different trustworthy exchanges. This means that even if one or several exchanges start to produce erroneous information, the source of the price will still offer an accurate average price.

Exchange rates in the ad are updated on average once every five minutes. If the service is overloaded, or if the API is slow, this process may take more time. The final price calculated by the equation corresponds to 1 unit selected for the exchange of the base currency of the P2P platform, for convenience in the ad.

If the result of the calculation of the equation is several values ​​or the absence of a value, such an equation is invalid and does not apply. Sources of market data do not always have information about the price, if, for example, in a particular market the amount of trades is small or trades are absent. If the equation is invalid or cannot be fully resolved, the ad automatically becomes inactive.

Create your own equation

Step 1. Choosing a source of pricing

The first and most important part of your equation is the choice of one or several sources of the market price. You should carefully approach the choice of the exchange, the data of which will be the base for your pricing. A list of all available market sources is listed at the end of this guide. A simple equation uses only one source of market data. The following market source takes data on the average daily price from Bitcoin Exchange: bitfinexusd_avg

This formula itself is an effective equation.

Step 2: Use the operators to change your equation.

Operators are various mathematical functions that you can use to adjust and change the price equation according to your needs. Supported operators are listed in the table below.

Operator Equation example Value example Description
+ 1 + 1 2 Add two values
- 2 - 1 1 Subtract the value to the right from the value on the left
* 3 * 4 12 Multiply two values
/ 5 / 2 2.5 Divide the value on the left by the value on the right
min min(10, 20) 10 The operation of determining the minimum finds the smallest of two values written in brackets. The min operator can be used to find the smallest of several values, for example, min(10, 30, 40, 5) = 5
max max(20, 100) 100 The operation of determining the maximum finds the greater of the two values written in brackets. The max operator can be used to determine the largest of several values, for example, max(10, 15, 20, 3) = 20
^ 4 ^ 2 16 Exponent - the value on the left, raised to the power indicated on the right
sin, cos, tan sin(pi/2) 1 Trigonometric operators. Use radians to enter data. To create accurate values in radians, use the constant pi
abs abs(-10) 10 Absolute value. Transforms negative values into positive ones, and positive values remain positive
trunc trunc(6.7)
trunc(-6.7)
6
-6
All decimals after the decimal point are discarded without rounding
ceil ceil(5.9)
ceil(-5.9)
6
-5
The “ceiling” function selects the smallest number that is greater or equal to the value
floor floor(5.9)
floor(-5.9)
5
-6
The "floor" function selects the largest number that is less or equal to the value
round round(5.9)
round(-5.4)
6
-5
Round to the nearest whole number, which drops the digits after the decimal point
sgn sgn(-5)
sgn(5)
-1
1
Gives a value sign. Possible values are 1, 0, -1

The simplest equation wexusd_avg with a value set in the field "profit" (for example 10%) provides a profit over the market price and corresponds to the equation wexusd_avg*1.1, written in the field of the price equation. If you buy bitcoin offered on several exchanges, let’s suppose you do it on WEX, Bitfinex and Bitstamp, you probably want its price to be based on a higher quote to make the deal profitable. To do this, you must use the max () operator. It determines the largest of the given values. In order to take profit into account, it is necessary to multiply the whole operator max () by 1.1.

max(wexusd_avg, bitfinexusd_avg)*1.1

This equation first receives data on prices from three exchanges: WEX, Bitfinex, Bitstamp, and determines the largest value of the price from these exchanges and finally multiplies this price by 1.1, resulting in the final price, which will be indicated in the ad.

If you use a source in which prices are quoted in a currency other than yours, then the last step is to convert to the appropriate currency. To do this, you can convert the price from US dollars to another currency using the data source USD_in_ [currency]. For example, if I make a deal in euros, I need to convert the equation given in the example for "Step 2" from US dollars to euros, multiplying the entire equation by USD_in_EUR. The final equation is as follows:

max(wexusd_avg, bitfinexusd_avg)*1.1*USD_in_EUR.

You can experiment with your own equations by using the field below. To find out the price, select the currency in which you trade, and enter any equation.

We get six different price indices for most sources: high price, low price, demand price, offer price, closing price and average price. These tables show the current price obtained from each source of market data, as well as the price type.

Low The lowest price of the completed trade in the last 24 hours
Average The average price of completed trades in the last 24 hours
High The highest price of the completed trade for the last 24 hours
Demand The demand price is the highest price that the buyer is willing to pay
Offer The offer price is the lowest price that the seller is willing to accept
Closing Price of the latest completed trade
Sources market price BTC
Source Name high low bid ask close avg
bitfinexusdBTC/USD5355.756852555306.353175317.2
bitfinexethBTC/ETH30.803431.275431.005831.004931.0049
bistampusdBTC/USD5329.095229.595301.235304.665301.23
bistampeurBTC/EUR4740.714661.084719.254722.654722.72
krakenusdBTC/USD532552005306.9530753075272.6243
coinbaseusdBTC/USD4006.574005.540114012.44005.994006.308
krakeneurBTC/EUR4743.44651.24726.14726.94726.14707.2939
coinbaseeurBTC/EUR3504.133499.113504.123504.133501.153502.6357
gdaxusdBTC/USD53055305.015305.01
gdaxeurBTC/EUR47204724.044720
gdaxethETH/BTC30.998130.988530.9789
geminiusdBTC/USD5305.725306.125305
rockusdBTC/USD149901390014990.01157901499014051.118
lakeusdBTC/USD5905.355786.155874.95884.765876.735847.5933
bitkonanusdBTC/USD5300526052555365.2553005296.9965
hitbtcusdBTC/USD7939.937804.427906.6279107915.487866.8791
btcalphausdBTC/USD53405221.011000000.0025306.3355278.033
btccusdBTC/USD6839.567006651.136899.7667006826.8182
cexusdBTC/USD5361.95270.153445346.25344.25328.735
coinsbankusdBTC/USD5336.015129.9253205364.215320.225278.0997
allcoinusdBTC/USD165501650016500173501650016525.4316
getbtcusdBTC/USD3909.933793.813841.553876.583793.813814.0193
okcoinusdBTC/USD5323.865218.075307.925308.585308.265276.4217
indacoinusdBTC/USD75007499.994500750075007499.9965
wexusdBTC/USD8179.9997900.017900.0118179.9997900.017915.7575
zyadoeurBTC/EUR3135.673123.753130.13130.993130.993130.3996
bitmarketeurBTC/EUR4701.62324701.62324630.98914725.71384701.62324701.6232
btcdeeurBTC/EUR5999.414660474047464700.694729.4324
hitbtceurBTC/EUR4499.994499.992501.314499.994499.994499.99
rockeurBTC/EUR4737.224667.014728.064736.524737.224699.0522
cexeurBTC/EUR4742.24659.24711.54733.14731.34706.0892
coinsbankeurBTC/EUR5131.264665.654680.764775.524732.384703.9408
cexrubBTC/RUB340934.1310000.2332712.1336588.4340934.1326677.1586
coinsbankrubBTC/RUB73.961970.74150.01340.013873.722573.5669
foxbitbrlBTC/BRL2538024664.0424666.0325199.9924664.0425133.0497
itbiteurBTC/EUR3110.93110.93114.653118.93110.93110.9
bitstampusdBTC/USD5329.095212.85308.365308.865309.375275.6054
Sources market price altcoins
Source Name high low bid ask close avg
krakenltcLTC/USD7875.6976.6576.6676.79
geminiethETH/USD171.07171.23171.32
USD exchange rates
Source Rate Currency
USD_in_RUB63.926195RUB
USD_in_AUD1.398364AUD
USD_in_BRL3.92342BRL
USD_in_CAD1.336506CAD
USD_in_CNY6.703497CNY
USD_in_GBP0.768942GBP
USD_in_HUF283.876143HUF
USD_in_IDR14066.834998IDR
USD_in_ILS3.587603ILS
USD_in_INR69.481036INR
USD_in_JPY111.935433JPY
USD_in_MXN18.821659MXN
USD_in_MYR4.137373MYR
USD_in_NZD1.495293NZD
USD_in_PHP51.672428PHP
USD_in_PLN3.79631PLN
USD_in_THB31.818438THB
USD_in_TRY5.806275TRY
USD_in_ZAR14.07245ZAR
USD_in_EUR0.88824EUR
BTC_in_USD5327.801888USD
ETH_in_USD171.299185USD
USD_in_AMD481.48AMD
USD_in_ARS41.79ARS
USD_in_AZN1.6995AZN
USD_in_CLP661.81CLP
USD_in_EGP17.12EGP
USD_in_GEL2.6835GEL
USD_in_KES101KES
USD_in_KZT376.8KZT
USD_in_MAD9.601MAD
USD_in_NGN357NGN
USD_in_PKR141.3PKR
USD_in_TND3.0023TND
USD_in_TWD30.82066TWD
USD_in_UAH26.668UAH
USD_in_VEF248209VEF
USD_in_VND23114.193666VND
USD_in_DZD118.997DZD
USD_in_HKD7.844679HKD
USD_in_ALL110.06ALL
USD_in_AOA317.839AOA
USD_in_BSD1BSD
USD_in_BBD2BBD
USD_in_BGN1.738505BGN
USD_in_BHD0.377BHD
USD_in_BWP10.577BWP
USD_in_BYN2.09BYN
USD_in_GHS5.1433GHS
USD_in_GTQ7.628GTQ
USD_in_SGD1.355327SGD
USD_in_XCD2.7XCD
USD_in_AED3.6727AED
USD_in_COP3145COP
USD_in_DKK6.627197DKK
USD_in_DOP50.41DOP
USD_in_GNF9126GNF
USD_in_HNL24.373HNL
USD_in_IQD1190IQD
USD_in_IRR42000IRR
USD_in_ISK120.463195ISK
USD_in_JOD0.7075JOD
USD_in_KHR4033.7KHR
USD_in_KWD0.3041KWD
USD_in_PGK3.3759PGK
USD_in_QAR3.639QAR
USD_in_TTD6.7447TTD
USD_in_ZMW12.24ZMW
USD_in_LAK8591.4LAK
USD_in_LBP1503.5LBP
USD_in_LKR174.49LKR
USD_in_MKD54.44MKD
USD_in_FJD2.1125FJD
USD_in_MDL17.7MDL
USD_in_MMK1524MMK
USD_in_NAD14.109NAD
USD_in_NOK8.509289NOK
USD_in_OMR0.3848OMR
USD_in_PAB1PAB
USD_in_PEN3.290823PEN
USD_in_PYG6196PYG
USD_in_RON4.229759RON
USD_in_RSD104.7497RSD
USD_in_SAR3.749807SAR
USD_in_SCR13.68SCR
USD_in_TJS9.4392TJS
USD_in_TZS2298TZS
USD_in_UYU34.244UYU
USD_in_UZS8400UZS
USD_in_XAF582.67XAF
USD_in_XOF582.67XOF
USD_in_XPF105.8XPF
USD_in_CHF1.01296CHF
USD_in_CZK22.796334CZK
USD_in_ETB28.5813ETB
USD_in_HRK6.604003HRK
USD_in_JMD129.32JMD
USD_in_KRW1136.392862KRW
USD_in_SEK9.297204SEK