Skip to content

Commit

Permalink
add binance
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Oct 16, 2024
1 parent 404ce72 commit 515976b
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
// by the pricefeed daemon. This number was chosen to supply the minimum number of prices required to
// compute an index price for a market, given exchange unavailability due to exchange geo-fencing,
// downtime, etc.
MinimumRequiredExchangesPerMarket = 4
MinimumRequiredExchangesPerMarket = 5
)

// GenerateExchangeConfigJson generates human-readable exchange config json for each market based on the contents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"exchanges": [
{
"exchangeName": "Binance",
"ticker": "POLUSDT",
"adjustByMarket": "USDT-USD"
},
{
"exchangeName": "Bybit",
"ticker": "POLUSDT",
Expand Down
15 changes: 11 additions & 4 deletions protocol/scripts/genesis/sample_pregenesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,14 @@
},
"POL/USD": {
"provider_configs": [
{
"binance_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "POLUSDT"
},
{
"name": "bybit_ws",
"normalize_by_pair": {
Expand Down Expand Up @@ -2309,10 +2317,9 @@
"Base": "POL",
"Quote": "USD"
},
"decimals": "10",
"min_provider_count": "3",
"enabled": true,
"metadata_JSON": ""
"decimals": 10,
"min_provider_count": 3,
"enabled": true
}
},
"SEI/USD": {
Expand Down
26 changes: 12 additions & 14 deletions protocol/testing/containertest/preupgrade_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1438,39 +1438,37 @@
"metadata_JSON": ""
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "POLUSDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
}
},
{
"name": "bybit_ws",
"off_chain_ticker": "POLUSDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"invert": false,
"metadata_JSON": ""
}
},
{
"name": "coinbase_ws",
"off_chain_ticker": "POL-USD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
"off_chain_ticker": "POL-USD"
},
{
"name": "crypto_dot_com_ws",
"off_chain_ticker": "POL_USD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
"off_chain_ticker": "POL_USD"
},
{
"name": "okx_ws",
"off_chain_ticker": "POL-USDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"invert": false,
"metadata_JSON": ""
}
}
]
},
Expand Down
1 change: 1 addition & 0 deletions protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ function edit_genesis() {
dasel put -t int -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.ticker.min_provider_count' -v '3'
dasel put -t bool -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.ticker.enabled' -v 'true'

dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.provider_configs.[]' -v '{"name": "binance_ws", "off_chain_ticker": "POLUSDT", "normalize_by_pair": {"Base": "USDT", "Quote": "USD"}}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.provider_configs.[]' -v '{"name": "bybit_ws", "off_chain_ticker": "POLUSDT", "normalize_by_pair": {"Base": "USDT", "Quote": "USD"}}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.provider_configs.[]' -v '{"name": "coinbase_ws", "off_chain_ticker": "POL-USD"}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.POL/USD.provider_configs.[]' -v '{"name": "crypto_dot_com_ws", "off_chain_ticker": "POL_USD"}'
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/mainnet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@
"exponent": -10,
"min_exchanges": 3,
"min_price_change_ppm": 2500,
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}"
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}"
},
{
"pair": "CRV-USD",
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/testnet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -6130,7 +6130,7 @@
"pair": "LINK-USD"
},
{
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}",
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}",
"exponent": -10,
"id": 3,
"min_exchanges": 3,
Expand Down
31 changes: 14 additions & 17 deletions protocol/testutil/constants/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2805,43 +2805,40 @@ const GenesisState = `{
},
"decimals": "10",
"min_provider_count": "3",
"enabled": true,
"metadata_JSON": ""
"enabled": true
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "POLUSDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
}
},
{
"name": "bybit_ws",
"off_chain_ticker": "POLUSDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"invert": false,
"metadata_JSON": ""
}
},
{
"name": "coinbase_ws",
"off_chain_ticker": "POL-USD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
"off_chain_ticker": "POL-USD"
},
{
"name": "crypto_dot_com_ws",
"off_chain_ticker": "POL_USD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
"off_chain_ticker": "POL_USD"
},
{
"name": "okx_ws",
"off_chain_ticker": "POL-USDT",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"invert": false,
"metadata_JSON": ""
}
}
]
},
Expand Down Expand Up @@ -3993,7 +3990,7 @@ const GenesisState = `{
"pair": "LINK-USD"
},
{
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}",
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"POLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"POL-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"POL_USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"POL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}",
"exponent": -10,
"id": 3,
"min_exchanges": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ var (
Ticker: "LINKUSDT",
AdjustByMarket: newMarketIdWithValue(MARKET_USDT_USD),
},
MARKET_POL_USD: {
Ticker: "POLUSDT",
AdjustByMarket: newMarketIdWithValue(MARKET_USDT_USD),
},
MARKET_CRV_USD: {
Ticker: "CRVUSDT",
AdjustByMarket: newMarketIdWithValue(MARKET_USDT_USD),
Expand Down

0 comments on commit 515976b

Please sign in to comment.