This page is for information purposes only. Certain services and features may not be available in your jurisdiction.

Introduction of Spot

Published on Jun 17, 2022Updated on Sep 24, 20243 min read

1. Spot Trading

Spot trading is the exchange of a cryptocurrency for another cryptocurrency. With the ETH/BTC pair, ETH is the base currency and BTC is the quote currency, which means BTC is needed to buy ETH. OKX spot trading currently has four subsections that allow users to trade using USDT, USDC, Stablecoins, and other Crypto as the quote currency.

2. Spot Cost Price

OKX will launch the Spot Cost Price feature on August 29, 2024, including two calculation methods: Average Cost Price and Cumulative Cost Price.

2.1 Cost price overview

Average Cost Price

Cumulative Cost Price

Definition

Average cost price is the average price at which you buy spot

Cumulative cost price is the cumulative price at which you buy and sell spot

Cost Price

(Average cost price before last buy × Amount + Price of last buy × Amount) / Net buying amount

(Cumulative buying value – Cumulative selling value) / Net buying amount

PnL

(Last price – Cost price) × Net buying amount

Net buying amount × Last price – Cumulative buying value + Cumulative selling value

PnL Ratio

(Last price – Cost price) / Cost price

PnL / (Cumulative buying value – Cumulative selling value)

Recommended Use Case

Primarily used to assist in trading decisions, determining when to buy and sell

Primarily used to assist in trading decisions, determining when to sell

2.2 Calculation Examples

You can understand the corresponding calculation formulas through the following examples:

Scenario 1: Assume you did not hold any ETH before. On Day 1, you purchase 2 ETH at a price of 3000, and the last price is 3500.

Average cost price

  • Average cost price = (0 + 3000 * 2) / 2 = 3000

  • PnL = (3500-3000)*2 = 1000

  • PnL Ratio = (3500 - 3000)/3000 * 100% = 16.67%


Cumulative Cost Price

  • Cumulative Cost Price = (3000 * 2 - 0)/2 = 3000

  • PnL = 3500 * 2 - 3000 * 2 + 0 = 1000

  • PnL Ratio = 1000 / (3000 * 2 - 0) * 100% = 16.67%


Scenario 2: On Day 2, you sell 1 ETH at a price of 3500, and the last price is now 4000.

Average cost price

  • Average cost price = 3000

  • PnL = (4000-3000)*1 = 1000

  • PnL Ratio = (4000 - 3000)/3000 * 100% = 33.3%


Cumulative Cost Price

  • Cumulative Cost Price = (2*3000 - 1*3500)/1 = 2500

  • PnL = 4000*1 - 2*3000 + 1*3500 = 1500

  • PnL Ratio = 1500 / (2*3000 - 1*3500) * 100% = 60%


Scenario 3:On Day 3, you buy 1 more ETH at a price of 4000, and the last price is now 4500.

Average cost price

  • Average cost price = ( 3000*1 + 4000*1 ) / 2 = 3500

  • PnL = (4500 - 3500) * 2 = 2000

  • PnL Ratio = (4500 - 3500)/3500 * 100% = 28.6%


Cumulative Cost Price

  • Cumulative Cost Price = ( 3000*2 + 4000*1 - 3500*1 ) / 2 = 3250

  • PnL = 2*4500 - (2*3000+1*4000) + 1*3500 = 2500

  • PnL Ratio = 2500 / (2*3000+1*4000 - 1*3500 ) * 100% = 38.5%

2.3 Important Notes

  • The spot cost price will begin from the launch date, excluding assets held prior and not yet sold.

  • A feature for adjusting cost prices, allowing the inclusion of previously excluded amounts in calculations, will be introduced in the future.

  • Only spot buy/sell and quantities transferred to the trading account through trading bots will be included in the calculation.

  • Stablecoins and fiat currencies are not included in the cost price calculation.

2.4 Open API data fields

Average Cost Price

Cumulative Cost Price

Cost Price

openAvgPx

accAvgPx

PnL

spotUpl

totalPnl

PnL Ratio

spotUplRatio

totalPnlRatio

Net buying amount

spotBal

spotBal