Class CoinGeckoFeed
java.lang.Object
com.codename1.crypto.market.CoinGeckoFeed
- All Implemented Interfaces:
PriceFeed
Prices from CoinGecko's simple/price API. Tickers map to CoinGecko's coin ids; the common
ones are built in and mapTicker(String, String) adds others. The quote currency is any CoinGecko
vs_currency (usd, eur, btc, ...).
The public API works without a key at a low rate limit. Pass a demo key, or a Pro key with
pro set, for production; the backend should hold that key, not the application.
-
Constructor Summary
ConstructorsConstructorDescriptionCoinGeckoFeed(RpcTransport transport) A feed on the keyless public API.CoinGeckoFeed(RpcTransport transport, String apiKey, boolean pro) A feed with an API key;proselects the Pro endpoint and header, otherwise the key is a demo key. -
Method Summary
-
Constructor Details
-
CoinGeckoFeed
A feed on the keyless public API. -
CoinGeckoFeed
A feed with an API key;proselects the Pro endpoint and header, otherwise the key is a demo key.
-
-
Method Details
-
mapTicker
Maps a ticker to a CoinGecko coin id, replacing a built-in one. -
getQuote
Description copied from interface:PriceFeedThe price of
baseinquote, by ticker (BTC,ETH,USD,EUR); case does not matter.Throws
IOException: when the source cannot be reached or does not know the pair
- Specified by:
getQuotein interfacePriceFeed- Throws:
IOException
-