From b3832ae58a5af973c18d7dbf263bd8fc336b6c52 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 19 Sep 2024 09:41:14 -0400 Subject: [PATCH] feat: add check forex markets to constants for checking (#743) --- cmd/constants/marketmaps/markets.go | 90 ++++++++++++++++++++++++ cmd/constants/marketmaps/markets_test.go | 1 + scripts/genesis.go | 6 ++ 3 files changed, 97 insertions(+) diff --git a/cmd/constants/marketmaps/markets.go b/cmd/constants/marketmaps/markets.go index fec2df8cb..869447275 100644 --- a/cmd/constants/marketmaps/markets.go +++ b/cmd/constants/marketmaps/markets.go @@ -9564,6 +9564,95 @@ var ( } } }` + + // ForexMarketMap is used to initialize the forex market map. This only includes + // forex markets quoted in usdt. + ForexMarketMap mmtypes.MarketMap + + // ForexMarketMapJSON is the JSON representation of ForexMarketMap. + ForexMarketMapJSON = ` +{ + "markets": { + "TRY/USDT": { + "ticker": { + "currency_pair": { + "Base": "TRY", + "Quote": "USDT" + }, + "decimals": 11, + "min_provider_count": 1, + "enabled": false, + "metadata_JSON": "{\"reference_price\":2935133548,\"liquidity\":1504939,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2810\"}]}" + }, + "provider_configs": [ + { + "name": "binance_ws", + "off_chain_ticker": "USDTTRY", + "invert": true, + "metadata_JSON": "" + }, + { + "name": "okx_ws", + "off_chain_ticker": "TRY-USDT", + "invert": false, + "metadata_JSON": "" + } + ] + }, + "EUR/USDT": { + "ticker": { + "currency_pair": { + "Base": "EUR", + "Quote": "USDT" + }, + "decimals": 9, + "min_provider_count": 1, + "enabled": false, + "metadata_JSON": "{\"reference_price\":1100800000,\"liquidity\":3843298,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2790\"}]}" + }, + "provider_configs": [ + { + "name": "binance_ws", + "off_chain_ticker": "EURUSDT", + "invert": false, + "metadata_JSON": "" + }, + { + "name": "okx_ws", + "off_chain_ticker": "EUR-USDT", + "invert": false, + "metadata_JSON": "" + } + ] + }, + "BRL/USDT": { + "ticker": { + "currency_pair": { + "Base": "BRL", + "Quote": "USDT" + }, + "decimals": 10, + "min_provider_count": 1, + "enabled": false, + "metadata_JSON": "{\"reference_price\":1760563380,\"liquidity\":2479974,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2783\"}]}" + }, + "provider_configs": [ + { + "name": "binance_ws", + "off_chain_ticker": "USDTBRL", + "invert": true, + "metadata_JSON": "" + }, + { + "name": "okx_ws", + "off_chain_ticker": "BRL-USDT", + "invert": false, + "metadata_JSON": "" + } + ] + } + } + }` ) func init() { @@ -9575,6 +9664,7 @@ func init() { unmarshalValidate("CoinGecko", CoinGeckoMarketMapJSON, &CoinGeckoMarketMap), unmarshalValidate("Osmosis", OsmosisMarketMapJSON, &OsmosisMarketMap), unmarshalValidate("Polymarket", PolymarketMarketMapJSON, &PolymarketMarketMap), + unmarshalValidate("Forex", ForexMarketMapJSON, &ForexMarketMap), ) if err != nil { panic(err) diff --git a/cmd/constants/marketmaps/markets_test.go b/cmd/constants/marketmaps/markets_test.go index a4cb9a242..d2c1189a0 100644 --- a/cmd/constants/marketmaps/markets_test.go +++ b/cmd/constants/marketmaps/markets_test.go @@ -17,6 +17,7 @@ func TestMarkets(t *testing.T) { marketmaps.CoinGeckoMarketMap.Markets, marketmaps.OsmosisMarketMap.Markets, marketmaps.PolymarketMarketMap.Markets, + marketmaps.ForexMarketMap.Markets, } for _, m := range markets { require.NotEmpty(t, m) diff --git a/scripts/genesis.go b/scripts/genesis.go index 7e984bd9d..18fc13d5a 100644 --- a/scripts/genesis.go +++ b/scripts/genesis.go @@ -23,6 +23,7 @@ var ( useCoinMarketCap = flag.Bool("use-coinmarketcap", false, "use coinmarketcap markets") useOsmosis = flag.Bool("use-osmosis", false, "use osmosis markets") usePolymarket = flag.Bool("use-polymarket", false, "use polymarket markets") + useForex = flag.Bool("use-forex", false, "use forex markets") tempFile = flag.String("temp-file", "markets.json", "temporary file to store the market map") ) @@ -99,6 +100,11 @@ func main() { marketMap = mergeMarketMaps(marketMap, marketmaps.PolymarketMarketMap) } + if *useForex { + fmt.Fprintf(flag.CommandLine.Output(), "Using forex markets\n") + marketMap = mergeMarketMaps(marketMap, marketmaps.ForexMarketMap) + } + if err := marketMap.ValidateBasic(); err != nil { fmt.Fprintf(flag.CommandLine.Output(), "failed to validate market map: %s\n", err) panic(err)