ProjectOpenSea / opensea-js

TypeScript SDK for the OpenSea marketplace
https://docs.opensea.io/reference
MIT License
2.28k stars 957 forks source link

How to get listing price in Eth when item price is in USDC? #1173

Closed farairo closed 1 year ago

farairo commented 1 year ago

I am trying to get item listing prices using seaport.api.get with endpoint /v2/orders/ethereum/seaport/listings some of the items are listed in USDC and other currencies. How to get usdc or other currency equivalent value in eth? I know that stream api does send eth equivalent for other currencies but not sure how to get that using normal api. Any help will be really appreciated

thenerdassassin commented 1 year ago

The OpenSea API does not have an API for currency conversion. Here are some alternatives you could investigate:

  1. Coinbase: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-users#exchange-rates
  2. Etherscan: https://docs.etherscan.io/api-endpoints/stats-1#get-ether-last-price
  3. CoinGecko: https://www.coingecko.com/en/api/documentation

I can't vouch for the accuracy of any of these but there are more options out there if these do not work for you.

farairo commented 1 year ago

@thenerdassassin Thanks for the info. It's disappointing that the OpenSea API doesn't provide currency conversion data like the stream API does. So are other developers also uisng different API services, as you mentioned above to get currency conversion data and is it reliable?