Skip to content

Commit

Permalink
feat: add check forex markets to constants for checking (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Sep 19, 2024
1 parent 53b22d1 commit b3832ae
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
90 changes: 90 additions & 0 deletions cmd/constants/marketmaps/markets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cmd/constants/marketmaps/markets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions scripts/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b3832ae

Please sign in to comment.