OKX provides two types of spot cost prices: Asset Summary Spot Cost Price and Trading Account Spot Cost Price. Here’s how they differ:
- Asset Summary Spot Cost Price includes assets from the trading account, funding account, and Earn account, while the Trading Account Spot Cost Price only covers assets in the trading account.
- The Asset Summary uses the average cost method, whereas the trading account supports both average cost and accumulated cost methods (configurable in settings).
For specific formulas, refer to the examples under Trading Account Spot Cost Price below.
1. Asset Summary Spot Cost Price
Definition:
A weighted average of cost, price, and quantity across all accounts (trading, funding, Earn). Transfers between accounts do not affect this price.
Example:
If your asset summary shows 1 ETH with a cost price of $3,000—even after transferring ETH from the funding to trading account—the cost price remains $3,000.
2. Trading Account Spot Cost Price
2.1 Overview
| Metric | Average Cost Price | Accumulated Cost Price |
|---|---|---|
| Definition | Average purchase price | Net buy/sell price impact |
| Calculation | (Prior Avg Cost × Qty + Last Purchase Price × Qty) / Net Buy Qty | (Total Buy Value - Total Sell Value) / Net Buy Qty |
| P&L | (Last Price - Cost) × Net Qty | Net Qty × Last Price - Total Buy Value + Total Sell Value |
| P&L Ratio | (Last Price - Cost) / Cost | P&L / (Total Buy Value - Total Sell Value) |
| Use Case | Trading decisions | Selling strategy analysis |
👉 Compare cost methods side-by-side
2.2 Calculation Examples
Case 1:
Day 1: Buy 2 ETH @ $3,000; last price = $3,500.
- Average Cost: $3,000 | P&L = $1,000 (16.67%)
- Accumulated Cost: $3,000 | P&L = $1,000 (16.67%)
Case 2:
Day 2: Sell 1 ETH @ $3,500; last price = $4,000.
- Average Cost: $3,000 | P&L = $1,000 (33.3%)
- Accumulated Cost: $2,500 | P&L = $1,500 (60%)
Case 3:
Day 3: Buy 1 ETH @ $4,000; last price = $4,500.
- Average Cost: $3,500 | P&L = $2,000 (28.6%)
- Accumulated Cost: $3,250 | P&L = $2,500 (38.5%)
2.3 Important Notes
Data Scope: Effective from November 6, 2020. Includes:
- Spot trades
- Post-strategy bot transfers (e.g., spot grid)
- Exchanges (Convert, Simple Trade, One-click Repay)
- Transfers: Reset cost price. Edit manually via Trade > Positions & Assets > Cost Price.
- Exclusions: Stablecoins and local currencies aren’t calculated.
👉 Learn how to edit cost prices
2.4 Open API Data Fields
| Field | Average Cost (openAvgPx) | Accumulated Cost (accAvgPx) |
|---|---|---|
| Cost Price | openAvgPx | accAvgPx |
| P&L | spotUpl | totalPnl |
| P&L Ratio | spotUplRatio | totalPnlRatio |
| Net Qty | spotBal | spotBal |
FAQ
Q1: Which cost method is better for long-term holders?
A1: The average cost method simplifies tracking for buy-and-hold strategies.
Q2: Why does my accumulated cost price change after selling?
A2: It accounts for realized P&L from sales, adjusting your net position value.
Q3: Can I switch cost calculation methods mid-trading?
A3: Yes, but historical data won’t retroactively update—only new trades are affected.
Q4: How do transfers impact cost price?
A4: Transfers reset the cost price. You must manually re-enter it if needed.
Q5: Are fees included in cost price calculations?
A5: No, only trade prices are factored in.
Q6: Why exclude stablecoins?
A6: Their pegged value makes cost tracking irrelevant for P&L analysis.