Can I use a fetching library like SWR when using ccxt in react?

48 views Asked by At

By using the fetching library, you can take advantage of many benefits such as isLoading, isError, caching, auto refreshing, mutatuion, and conditional fetching. When using ccxt, I wonder if these benefits can be maintained by using it with the fetching library.

const ccxtBitmex = new ccxt['bitmex']({
  proxyUrl: PROXY_URL,
  apiKey: bitmexApiKey,
  secret: bitmexSecret,
})

export const fetchBalance = async () => {
  return await ccxtBitmex.fetchBalance()
}

// Where is the opportunity to cut in?

If this is not possible, it would be difficult to find a reason to use the ccxt library in react. Maybe I should just access the exchange api without ccxt?

0

There are 0 answers