From 3eddcfe0205a5e3cad16016917fb67e9a90ac6e9 Mon Sep 17 00:00:00 2001 From: emidev98 Date: Wed, 20 Dec 2023 18:17:04 +0200 Subject: [PATCH] feat: reduce coingecko denmos --- config/default_config.go | 139 +----------------- .../parser/internal/coingecko/coingecko.go | 123 +++------------- 2 files changed, 28 insertions(+), 234 deletions(-) diff --git a/config/default_config.go b/config/default_config.go index f8c618b..b1f1858 100644 --- a/config/default_config.go +++ b/config/default_config.go @@ -8,7 +8,7 @@ var DefaultPriceServerConfig = Config{ Providers: map[string]ProviderConfig{ "astroport": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: []string{ "ibc/08095CEDEA29977C9DD0CE9A48329FDA622C183359D5F90CF04CC4FF80CBE431-ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4", // stLuna - axlUSDC "ibc/08095CEDEA29977C9DD0CE9A48329FDA622C183359D5F90CF04CC4FF80CBE431-ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF", // stLuna - axlUSDT @@ -202,7 +202,7 @@ var DefaultPriceServerConfig = Config{ }, "bitstamp": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: []string{ "1incheur", "1inchusd", @@ -795,7 +795,6 @@ var DefaultPriceServerConfig = Config{ "BORA-USDT", "BRWL-USDT", "BSV-USDT", - "BTM-USDT", "BTT-USDT", "BZZ-USDT", "CAPO-USDT", @@ -807,14 +806,12 @@ var DefaultPriceServerConfig = Config{ "CFG-USDT", "CFX-USDT", "CGL-USDT", - "CHE-USDT", "CHZ-USDT", "CITY-USDT", "CLV-USDT", "COMP-USDT", "CONV-USDT", "CORE-USDT", - "COVER-USDT", "CQT-USDT", "CRO-USDT", "CRV-USDT", @@ -830,7 +827,6 @@ var DefaultPriceServerConfig = Config{ "DCR-USDT", "DEP-USDT", "DGB-USDT", - "DHT-USDT", "DIA-USDT", "DOGE-USDT", "DOME-USDT", @@ -855,7 +851,6 @@ var DefaultPriceServerConfig = Config{ "FLOW-USDT", "FLOKI-USDT", "FLR-USDT", - "FODL-USDT", "FORTH-USDT", "FRONT-USDT", "FSN-USDT", @@ -880,14 +875,12 @@ var DefaultPriceServerConfig = Config{ "GRT-USDT", "HBAR-USDT", "HC-USDT", - "HNT-USDT", "ICP-USDT", "ICX-USDT", "ID-USDT", "IGU-USDT", "ILV-USDT", "IMX-USDT", - "INT-USDT", "IOST-USDT", "IOTA-USDT", "IQ-USDT", @@ -937,7 +930,6 @@ var DefaultPriceServerConfig = Config{ "MOVEZ-USDT", "MRST-USDT", "MXC-USDT", - "MXT-USDT", "MYRIA-USDT", "NEAR-USDT", "NEO-USDT", @@ -960,15 +952,12 @@ var DefaultPriceServerConfig = Config{ "PCI-USDT", "PERP-USDT", "PHA-USDT", - "PICKLE-USDT", "PIT-USDT", - "PNK-USDT", "POLS-USDT", "POLYDOGE-USDT", "POR-USDT", "PRQ-USDT", "PSTAKE-USDT", - "QOM-USDT", "QTUM-USDT", "RACA-USDT", "RADAR-USDT", @@ -984,7 +973,6 @@ var DefaultPriceServerConfig = Config{ "RSR-USDT", "RSS3-USDT", "RVN-USDT", - "SAITAMA-USDT", "SAMO-USDT", "SAND-USDT", "SC-USDT", @@ -1080,24 +1068,19 @@ var DefaultPriceServerConfig = Config{ "ASTR-USDC", "ATOM-USDC", "AVAX-USDC", - "AXS-USDC", "BLUR-USDC", "BNB-USDC", "BSV-USDC", "CEL-USDC", - "CELO-USDC", "CHZ-USDC", "COMP-USDC", - "CORE-USDC", "CRO-USDC", "CRV-USDC", "CSPR-USDC", - "DASH-USDC", "DOGE-USDC", "DOT-USDC", "DYDX-USDC", "EGLD-USDC", - "ENS-USDC", "EOS-USDC", "ETC-USDC", "ETHW-USDC", @@ -1106,13 +1089,9 @@ var DefaultPriceServerConfig = Config{ "FLR-USDC", "FTM-USDC", "GALA-USDC", - "GMT-USDC", - "GMX-USDC", "GRT-USDC", "HBAR-USDC", "ICP-USDC", - "IMX-USDC", - "IOST-USDC", "JST-USDC", "KLAY-USDC", "KNC-USDC", @@ -1129,17 +1108,14 @@ var DefaultPriceServerConfig = Config{ "MKR-USDC", "NEAR-USDC", "OKT-USDC", - "OMG-USDC", "RDNT-USDC", "RPL-USDC", "SAND-USDC", "SHIB-USDC", "SNX-USDC", - "SSV-USDC", "STORJ-USDC", "STX-USDC", "SUSHI-USDC", - "THETA-USDC", "TON-USDC", "TRX-USDC", "UNI-USDC", @@ -1147,8 +1123,6 @@ var DefaultPriceServerConfig = Config{ "WAVES-USDC", "XLM-USDC", "XMR-USDC", - "XTZ-USDC", - "YFI-USDC", "YFII-USDC", "YGG-USDC", "ZEC-USDC", @@ -1164,26 +1138,19 @@ var DefaultPriceServerConfig = Config{ "FIL-BTC", "AAVE-BTC", "ADA-BTC", - "ALGO-BTC", - "ANT-BTC", - "APE-BTC", "ATOM-BTC", "AVAX-BTC", "BSV-BTC", "CHZ-BTC", - "COMP-BTC", "CRO-BTC", "CRV-BTC", "DASH-BTC", "DOGE-BTC", "DOT-BTC", - "DYDX-BTC", "EOS-BTC", "ETC-BTC", "GRT-BTC", "HBAR-BTC", - "INT-BTC", - "KNC-BTC", "LINK-BTC", "MANA-BTC", "MATIC-BTC", @@ -1207,27 +1174,16 @@ var DefaultPriceServerConfig = Config{ "XRP-ETH", "SOL-ETH", "FIL-ETH", - "AAVE-ETH", "ADA-ETH", "ATOM-ETH", "BETH-ETH", - "CRV-ETH", "DOGE-ETH", - "DOT-ETH", "EOS-ETH", "LINK-ETH", - "MKR-ETH", - "NEAR-ETH", "OKT-ETH", "STETH-ETH", - "SUSHI-ETH", "TRX-ETH", - "UNI-ETH", - "XLM-ETH", "XMR-ETH", - "LTC-OKB", - "XRP-OKB", - "OKDOT1-DOT", "OKDOT2-DOT", "BTC-EURT", "ETH-EURT", @@ -1235,7 +1191,7 @@ var DefaultPriceServerConfig = Config{ }, "coingecko": { Interval: 6, - Timeout: 5, + Timeout: 10, Symbols: []string{ "bitcoin", "ethereum", @@ -1244,91 +1200,10 @@ var DefaultPriceServerConfig = Config{ "usd-coin", "binance-usd", "dai", - "ripple", - "dogecoin", - "cardano", - "matic-network", - "polkadot", - "litecoin", - "staked-ether", "okb", - "shiba-inu", "solana", - "tron", - "uniswap", - "avalanche-2", - "chainlink", - "ethereum-classic", - "the-open-network", - "monero", - "stellar", - "algorand", - "quant-network", - "filecoin", - "near", - "vechain", - "flow", - "apecoin", - "internet-computer", - "elrond-erd-2", - "chiliz", - "eos", - "chain-2", - "tezos", - "lido-dao", - "the-sandbox", - "theta-token", - "aave", - "axie-infinity", - "decentraland", - "iota", - "maker", - "pancakeswap-token", - "aptos", - "ecash", - "zcash", - "klay-token", - "gatechain-token", - "neo", - "arweave", - "dash", - "fantom", - "the-graph", - "havven", - "mina-protocol", - "curve-dao-token", - "nexo", - "radix", - "gmx", - "basic-attention-token", - "zilliqa", - "ethereum-name-service", - "1inch", - "helium", - "xdce-crowd-sale", - "frax-share", - "blockstack", - "convex-finance", - "enjincoin", - "immutable-x", - "loopring", - "decred", - "defichain", - "theta-fuel", - "amp-token", - "compound-governance-token", - "nxm", - "dydx", "cosmos", "terra-luna-2", - "crypto-com-chain", - "osmosis", - "thorchain", - "evmos", - "kava", - "oec-token", - "ankr", - "kadena", "terra-luna", "terrausd", "injective-protocol", @@ -1560,7 +1435,7 @@ var DefaultPriceServerConfig = Config{ }, "bittrex": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: []string{ "1INCH-USDT", "AAVE-USD", @@ -2019,17 +1894,17 @@ var DefaultPriceServerConfig = Config{ }, "exchangerate": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: FiatCoins, }, "frankfurter": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: FiatCoins, }, "fer": { Interval: 30, - Timeout: 5, + Timeout: 10, Symbols: FiatCoins, }, }, diff --git a/internal/parser/internal/coingecko/coingecko.go b/internal/parser/internal/coingecko/coingecko.go index 8fd9d56..68a2faf 100644 --- a/internal/parser/internal/coingecko/coingecko.go +++ b/internal/parser/internal/coingecko/coingecko.go @@ -7,108 +7,27 @@ import ( // symbol to base coin mapping var COIN_GECKO_MAPPING = map[string]string{ - "bitcoin": "BTC", - "ethereum": "ETH", - "binancecoin": "BNB", - "tether": "USDT", - "usd-coin": "USDC", - "binance-usd": "BUSD", - "dai": "DAI", - "ripple": "XRP", - "dogecoin": "DOGE", - "cardano": "ADA", - "matic-network": "MATIC", - "polkadot": "DOT", - "litecoin": "LTC", - "staked-ether": "STETH", - "okb": "OKB", - "shiba-inu": "SHIB", - "solana": "SOL", - "tron": "TRX", - "uniswap": "UNI", - "avalanche-2": "AVAX", - "chainlink": "LINK", - "ethereum-classic": "ETC", - "the-open-network": "TON", - "monero": "XMR", - "stellar": "XLM", - "algorand": "ALGO", - "quant-network": "QNT", - "filecoin": "FIL", - "near": "NEAR", - "vechain": "VET", - "flow": "FLOW", - "apecoin": "APE", - "internet-computer": "ICP", - "elrond-erd-2": "EGLD", - "chiliz": "CHZ", - "eos": "EOS", - "chain-2": "XCN", - "tezos": "XTZ", - "lido-dao": "LDO", - "the-sandbox": "SAND", - "theta-token": "THETA", - "aave": "AAVE", - "axie-infinity": "AXS", - "decentraland": "MANA", - "iota": "MIOTA", - "maker": "MKR", - "pancakeswap-token": "CAKE", - "aptos": "APT", - "ecash": "XEC", - "zcash": "ZEC", - "klay-token": "KLAY", - "gatechain-token": "GT", - "neo": "NEO", - "arweave": "AR", - "dash": "DASH", - "fantom": "FTM", - "the-graph": "GRT", - "havven": "SNX", - "mina-protocol": "MINA", - "curve-dao-token": "CRV", - "nexo": "NEXO", - "radix": "XRD", - "gmx": "GMX", - "basic-attention-token": "BAT", - "zilliqa": "ZIL", - "ethereum-name-service": "ENS", - "1inch": "1INCH", - "helium": "HNT", - "xdce-crowd-sale": "XDC", - "frax-share": "FXS", - "blockstack": "STX", - "convex-finance": "CVX", - "enjincoin": "ENJ", - "immutable-x": "IMX", - "loopring": "LRC", - "decred": "DCR", - "defichain": "DFI", - "theta-fuel": "TFUEL", - "amp-token": "AMP", - "compound-governance-token": "COMP", - "nxm": "NXM", - "dydx": "DYDX", - "cosmos": "ATOM", - "terra-luna-2": "LUNA", - "crypto-com-chain": "CRO", - "osmosis": "OSMO", - "thorchain": "RUNE", - "evmos": "EVMOS", - "kava": "KAVA", - "oec-token": "OKT", - "ankr": "ANKR", - "kadena": "KDA", - "terra-luna": "LUNC", - "terrausd": "USTC", - "injective-protocol": "INJ", - "secret": "SCRT", - "juno-network": "JUNO", - "stargaze": "STARS", - "akash-network": "AKT", - "white-whale": "WHALE", // White Whale chain - "switcheo": "SWTH", // Carbon chain - "stride-staked-luna": "STLUNA", // Stride chain + "bitcoin": "BTC", + "ethereum": "ETH", + "binancecoin": "BNB", + "tether": "USDT", + "usd-coin": "USDC", + "binance-usd": "BUSD", + "dai": "DAI", + "okb": "OKB", + "solana": "SOL", + "cosmos": "ATOM", + "terra-luna-2": "LUNA", + "terra-luna": "LUNC", + "terrausd": "USTC", + "injective-protocol": "INJ", + "secret": "SCRT", + "juno-network": "JUNO", + "stargaze": "STARS", + "akash-network": "AKT", + "white-whale": "WHALE", // White Whale chain + "switcheo": "SWTH", // Carbon chain + "stride-staked-luna": "STLUNA", // Stride chain } func ParseSymbol(symbol string) (string, string, error) {