Setting up Cryptowatch
Extensibility and Community
API

Assets & Markets Price Calculations

Cryptowatch's method for calculating asset and market prices.

Price of a Market

Cryptowatch collects data for all executed trades of listed markets. The latest market price derives from the price of the last executed trade of the specific market in the aforementioned exchange.

Price of an Asset

Cryptowatch calculates the latest price of an asset, using a sliding window of 24h to calculate the Volume Weighted Last Price for all related direct markets, excluding some blacklisted exchanges.

Example:

The following trades of BTC markets are available for the last 24H window:

Executed Trades in last 24H for the market Exchange A : BTCUSD

Trade

Price

Volume

(latest) T3

11,000

10

T2

10,950

2

T1

11,010

1

Volume SUM: 13 BTC

Executed Trades in last 24H for the market Exchange B : BTCUSD

Trade

Price

Volume

(latest) T3

11,100

3

T2

11,050

20

T1

11,000

5

Volume SUM: 28 BTC

Executed Trades in last 24H for the market Exchange C : BTCUSD

Trade

Price

Volume

(latest) T2

11,200

5

T1

11,030

3

Volume SUM: 8 BTC

Calculation of BTC Price, quoted in USD:

In case a direct instrument for a requested asset and quote pair doesn't exist, then the price is calculated combining multiple markets (crosses) with a specific pivoting logic.

The pivoting logic can be simplified as finding the price of both the asset and quote in USD, then dividing the price of the asset in USD by the price of the quote in USD. In this case, USD is used as the main middle asset.

The logic of getting the actual USD price of either asset involves checking if the asset/USD pair and the price is available. If it doesn’t exist we are using a number of different middle assets including: BTC, ETH, USDT or other stablecoin assets.

Let’s use the following example for the LTC/NIO price, where we assume the LTC/NIO pair does not exist:

Pair

Price

LTC/USD

50

NIO/BTC

0.00022

BTC/USDT

10500

USDT/USD

1

Since LTC/NIO does not exist, we attempt to use the pairs LTC/USD, and NIO/USD.

However, the NIO/USD doesn’t exist in the list above, so the price will be derived like so:

With both prices available of LTC/USD and NIO/USD, we can calculate the price of LTC/NIO as follows:

LTC/NIO=LTC/USDUSD/NIOLTC/NIO=LTC/USDNIO/USDLTC/NIO=5023.1LTC/NIO=2.1645NIOLTC/NIO = LTC/USD * USD/NIO\\ LTC/NIO = LTC/USD ➗ NIO/USD\\ LTC/NIO = 50 ➗ 23.1\\ LTC/NIO = 2.1645 NIO