-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v4.1.0
- Loading branch information
Showing
55 changed files
with
5,746 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default } from './Loader'; | ||
export { default, MiniLoader } from './Loader'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
import useStatsData from 'hooks/useStatsData'; | ||
|
||
export const StatsContext = React.createContext<ReturnType<typeof useStatsData> | undefined>( | ||
undefined | ||
); | ||
|
||
export const useStatsContext = () => { | ||
const statsContext = React.useContext(StatsContext); | ||
|
||
if (!statsContext) throw new Error('Stats context not defined yet.'); | ||
|
||
return statsContext; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useMemo } from 'react'; | ||
import { useRecoilState, useRecoilValue } from 'recoil'; | ||
|
||
import useGetFuturesMarkets from 'queries/futures/useGetFuturesMarkets'; | ||
import { useGetFuturesTradersStats } from 'queries/futures/useGetFuturesTradersStats'; | ||
import { useGetStatsVolumes } from 'queries/futures/useGetStatsVolumes'; | ||
import { futuresMarketsState } from 'store/futures'; | ||
import { selectedTimeframeState } from 'store/stats'; | ||
|
||
export type StatsTimeframe = '1M' | '1Y' | 'MAX'; | ||
|
||
const useStatsData = () => { | ||
const [selectedTimeframe, setSelectedTimeframe] = useRecoilState(selectedTimeframeState); | ||
const futuresMarkets = useRecoilValue(futuresMarketsState); | ||
|
||
// run queries | ||
useGetFuturesMarkets(); | ||
const { data: volumeData, isLoading: volumeIsLoading } = useGetStatsVolumes(); | ||
const { data: tradersData, isLoading: tradersIsLoading } = useGetFuturesTradersStats(); | ||
|
||
const openInterestData = useMemo(() => { | ||
return futuresMarkets.map(({ asset, marketSize, price }) => { | ||
return { | ||
asset, | ||
openInterest: marketSize.mul(price).toNumber(), | ||
}; | ||
}); | ||
}, [futuresMarkets]); | ||
|
||
return { | ||
volumeData, | ||
volumeIsLoading, | ||
tradersData, | ||
tradersIsLoading, | ||
openInterestData, | ||
selectedTimeframe, | ||
setSelectedTimeframe, | ||
}; | ||
}; | ||
|
||
export default useStatsData; |
Oops, something went wrong.
efef16f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
kwenta – ./
kwenta-kwenta.vercel.app
kwenta-git-main-kwenta.vercel.app
kwenta.io