web icon indicating copy to clipboard operation
web copied to clipboard

implement chart for historical pool data

Open 0xean opened this issue 1 year ago • 2 comments

AC

  • see thoryield for reference
  • data from midgard is available already
  • finish implementing chart (volume and liquidity line charts for time frames displayed 1W, 1M, All)

0xean avatar Jan 16 '24 20:01 0xean

  swapsData: (poolAssetId: string, interval: Interval, count: number) => ({
    queryKey: ['midgardSwapsData', poolAssetId, interval, count],
    staleTime: 60_000,
    queryFn: async () => {
      const { data } = await axios.get<MidgardSwapHistoryResponse>(
        `${midgardUrl}/history/swaps?pool=${poolAssetId}&interval=${interval}&count=${count}`,
      )
      return data
    },
  }),
  tvl: (interval: Interval, count: number) => ({
    queryKey: ['tvl', interval, count],
    staleTime: 60_000,
    queryFn: async () => {
      const { data } = await axios.get<MidgardTvlHistoryResponse>(
        `${midgardUrl}/history/tvl?interval=${interval}&count=${count}`,
      )
      return data
    },
  }),

0xean avatar Apr 01 '24 22:04 0xean

.../shapeshift/web/src/react-queries/queries/midgard.ts

0xean avatar Apr 01 '24 22:04 0xean