Skip to content

Commit

Permalink
Fork Sync: Update from parent repository (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 14, 2024
2 parents a8861fb + 2d9c7b5 commit 3520f2f
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 16 deletions.
20 changes: 19 additions & 1 deletion oracle/provider/binance.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func NewBinanceProvider(
}

availablePairs, _ := provider.GetAvailablePairs()
provider.setPairs(pairs, availablePairs, nil)
provider.setPairs(pairs, availablePairs, currencyPairToBinanceSymbol)

go startPolling(provider, provider.endpoints.PollInterval, logger)
return provider, nil
Expand Down Expand Up @@ -140,3 +140,21 @@ func (p *BinanceProvider) GetAvailablePairs() (map[string]struct{}, error) {

return symbols, nil
}

func currencyPairToBinanceSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"MATIC": "POL",
}

base, found := mapping[pair.Base]
if !found {
base = pair.Base
}

quote, found := mapping[pair.Quote]
if !found {
quote = pair.Quote
}

return base + quote
}
5 changes: 3 additions & 2 deletions oracle/provider/bitfinex.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ func (p *BitfinexProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToBitfinexSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"LUNC": "LUNA",
"LUNA": "LUNA2",
"LUNC": "LUNA",
"LUNA": "LUNA2",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
3 changes: 2 additions & 1 deletion oracle/provider/bitget.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func (p *BitgetProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToBitgetSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"AXL": "WAXL",
"AXL": "WAXL",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
20 changes: 19 additions & 1 deletion oracle/provider/bybit.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewBybitProvider(
)

availablePairs, _ := provider.GetAvailablePairs()
provider.setPairs(pairs, availablePairs, nil)
provider.setPairs(pairs, availablePairs, currencyPairToBybitSymbol)

go startPolling(provider, provider.endpoints.PollInterval, logger)
return provider, nil
Expand Down Expand Up @@ -121,3 +121,21 @@ func (p *BybitProvider) GetAvailablePairs() (map[string]struct{}, error) {

return symbols, nil
}

func currencyPairToBybitSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"MATIC": "POL",
}

base, found := mapping[pair.Base]
if !found {
base = pair.Base
}

quote, found := mapping[pair.Quote]
if !found {
quote = pair.Quote
}

return base + quote
}
3 changes: 2 additions & 1 deletion oracle/provider/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (p *GateProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToGateSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"AXL": "WAXL",
"AXL": "WAXL",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
3 changes: 2 additions & 1 deletion oracle/provider/huobi.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func (p *HuobiProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToHuobiSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"AXL": "WAXL",
"AXL": "WAXL",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
9 changes: 5 additions & 4 deletions oracle/provider/kraken.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@ func currencyPairToKrakenSymbol(pair types.CurrencyPair) string {
"USDJPY": "ZUSDZJPY",
}
mapping := map[string]string{
"AXL": "WAXL",
"BTC": "XBT",
"LUNC": "LUNA",
"LUNA": "LUNA2",
"AXL": "WAXL",
"BTC": "XBT",
"LUNC": "LUNA",
"LUNA": "LUNA2",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
3 changes: 2 additions & 1 deletion oracle/provider/kucoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ func (p *KucoinProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToKucoinSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"AXL": "WAXL",
"AXL": "WAXL",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
16 changes: 15 additions & 1 deletion oracle/provider/lbank.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,19 @@ func (p *LbankProvider) GetAvailablePairs() (map[string]struct{}, error) {
}

func currencyPairToLbankSymbol(pair types.CurrencyPair) string {
return strings.ToLower(pair.Join("_"))
mapping := map[string]string{
"MATIC": "POL",
}

base, found := mapping[pair.Base]
if !found {
base = pair.Base
}

quote, found := mapping[pair.Quote]
if !found {
quote = pair.Quote
}

return strings.ToLower(base + "_" + quote)
}
3 changes: 2 additions & 1 deletion oracle/provider/mexc.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (p *MexcProvider) GetAvailablePairs() (map[string]struct{}, error) {

func currencyPairToMexcSymbol(pair types.CurrencyPair) string {
mapping := map[string]string{
"AXL": "WAXL",
"AXL": "WAXL",
"MATIC": "POL",
}

base, found := mapping[pair.Base]
Expand Down
16 changes: 15 additions & 1 deletion oracle/provider/okx.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,19 @@ func (p *OkxProvider) GetAvailablePairs() (map[string]struct{}, error) {
}

func currencyPairToOkxSymbol(pair types.CurrencyPair) string {
return pair.Join("-")
mapping := map[string]string{
"MATIC": "POL",
}

base, found := mapping[pair.Base]
if !found {
base = pair.Base
}

quote, found := mapping[pair.Quote]
if !found {
quote = pair.Quote
}

return base + "-" + quote
}
16 changes: 15 additions & 1 deletion oracle/provider/phemex.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,19 @@ func (p *PhemexProvider) GetAvailablePairs() (map[string]struct{}, error) {
}

func currencyPairToPhemexSymbol(pair types.CurrencyPair) string {
return "s" + pair.String()
mapping := map[string]string{
"MATIC": "POL",
}

base, found := mapping[pair.Base]
if !found {
base = pair.Base
}

quote, found := mapping[pair.Quote]
if !found {
quote = pair.Quote
}

return "s" + base + quote
}

0 comments on commit 3520f2f

Please sign in to comment.