XRPL-Labs / XRPL-Persist-Price-Oracle

Persist XRP-USD price(s) on the XRPL ('oracle')
5 stars 2 forks source link

Support for Multiple Currencies #1

Closed tequdev closed 2 years ago

tequdev commented 2 years ago

Currently, only USD is supported. Can we add support for other currencies such as JPY?

example

const Providers = {
  class: {
    usd: {Cryptowatch, Bitstamp, Kraken, Bitfinex, Hitbtc, Binance},
    jpy: {Bitbank, GMOCoin, DeCurret, HuobiJapan}
  },
  instances: {}
}
export default (async (currency='usd') => {  
  Object.assign(Providers.instances, Object.keys(Providers.class[currency]).reduce((a, providerKey) => {
    Object.assign(a, {
      [providerKey]: new Providers.class[currency][providerKey]
    })
    return a
  }, {}))

when taking this action, https://github.com/XRPL-Labs/XRPL-Persist-Price-Oracle/blob/4d155106e000ebcc5fd32ec0961a9d68dd3dd0e5/src/index.js#L21 will be

  const data = await aggregator(currency)

What do you think about this?

tequdev commented 2 years ago

Sorry, wrong repository.