Skip to content
4 changes: 2 additions & 2 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
"openapi": "./ecosystem/rpc/ton-center-http-api-v-3.yaml"
}
]
}
},
"ecosystem/rpc/price"
]
},
{
Expand Down Expand Up @@ -304,7 +305,6 @@
"standard/tokens/jettons/how-to-get-supply-data",
"standard/tokens/jettons/mintless/overview",
"standard/tokens/jettons/mintless/how-to-deploy"

]
},
{
Expand Down
21 changes: 21 additions & 0 deletions ecosystem/rpc/price.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "Jetton prices API"
---

In this article we will discuss different ways to retrieve Jettons historical prices on Decentralized Exchanges, DEXes.

Each swap operation, either between native asset (Toncoin) and jetton or between two distinct jettons, has its price. This price is calculated by the internal DEX math algorithm, called AMM. Some services require information about previous swaps on the blockchain to use it in their internal business logic or to simply show statistics to users.

## Off-chain API

The most often use case for price API is to fetch jetton info on the web2 backend and use aggregated data inside the service. There are several historical jetton prices providers in TON:

- [dTon](https://docs.dton.io/about-pnl)
- [CoinGecko](https://www.coingecko.com/en/api/ton)
- [Dyor.io](https://dyor.io/tonapi)

You can find detailed information about API usage technical details in provider docs.

## On-chain API

Currently it is not possible to retrieve **historical** jetton prices on-chain - since TON contracts [are limited by storage](/guidebook/from-ethereum#limited-contract-storage) it is quite hard to implement such API fully on-chain. However it is possible to retrieve **current** prices via Request-Response pattern on some DEXes, refer to specific service documentation to learn more about it.