Off-chain API
The most common use case for the price API is to fetch Jetton info on the web2 backend and use aggregated data inside the service. There are several historical Jetton price providers in TON: You can find detailed information about API usage and technical details in the provider docs. There is no established solution for real-time jetton swap market data; however, one can explore CoinGecko websocket API.On-chain API
Currently, it is not possible to retrieve historical jetton prices on-chain - since TON contracts are limited by storage, it is quite hard to implement such an API fully on-chain. However, it is possible to retrieve current prices via the Request-Response pattern on some DEXes; refer to the specific service documentation to learn more about it.Since the TON execution model is asynchronous, the jetton price might change between the moment of the response from the price provider and the moment the contract processes the response. Consider this factor in smart contract logic.