Skip to content

Commit

Permalink
production: Bring back positions.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeanBoyCousin committed May 16, 2024
1 parent fedf55a commit 3c1fe19
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 94 deletions.
2 changes: 1 addition & 1 deletion packages/front-end/.env.arbitrum
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ REACT_APP_CHAIN_ID=42161
REACT_APP_ENV="production"
REACT_APP_NETWORK="arbitrum"
REACT_APP_SCAN_URL="https://arbiscan.io"
REACT_APP_SUBGRAPH_URL="https://api.0xgraph.xyz/subgraphs/name/rysk/arbitrum-one"
REACT_APP_SUBGRAPH_URL="https://api.goldsky.com/api/public/project_clhf7zaco0n9j490ce421agn4/subgraphs/arbitrum-one/production/gn"
109 changes: 36 additions & 73 deletions packages/front-end/src/components/optionsTrading/UserStats/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import { useUserStats } from "./hooks/useUserStats";
export const UserStats = () => {
const {
state: {
options: { data, loading },
options: { loading },
userStats: {
activePnL,
activePositions,
activePositionsFilters: { fees },
delta,
historicalPnL,
loading: statsLoading,
},
Expand All @@ -29,79 +28,43 @@ export const UserStats = () => {

return (
<AnimatePresence mode="wait">
{Object.values(data).length ? (
<motion.section
className="grid grid-cols-4 col-start-1 col-end-17 gap-8 mt-8"
key="user-stats"
{...FadeInUpDelayed(0.3)}
<motion.section
className="grid grid-cols-4 col-start-1 col-end-17 gap-8 mt-8"
key="user-stats"
{...FadeInUpDelayed(0.3)}
>
<Card
explainer="All active user positions. Please check the dashboard area for historical positions."
hasData={Boolean(activePositions.length)}
loading={loading || statsLoading}
span={["col-span-4", "col-span-4"]}
title="Active Positions"
>
<Card
explainer="All active user positions. Please check the dashboard area for historical positions."
hasData={Boolean(activePositions.length)}
loading={loading || statsLoading}
span={["col-span-4", "col-span-4"]}
title="Active Positions"
>
<Table />
<Filters />
</Card>
<Table />
<Filters />
</Card>

<Card
explainer="Total P/L for all active positions."
hasData={Boolean(activePnL)}
loading={loading || statsLoading}
title="P/L (active)"
>
<p className="text-lg xl:text-2xl mb-2">
{<RyskCountUp prefix="$" value={activePnL[feeIndex]} />}
</p>
</Card>
<Card
explainer="Total P/L for all open and closed positions."
hasData={Boolean(historicalPnL)}
loading={loading || statsLoading}
title="P/L (historical)"
>
<p className="text-lg xl:text-2xl mb-2">
<RyskCountUp prefix="$" value={historicalPnL[feeIndex]} />
</p>
</Card>
<Card
explainer="Total delta for all open positions."
hasData={
Boolean(delta) || (Boolean(activePositions.length) && delta === 0)
}
loading={loading || statsLoading}
title="Delta"
>
<p className="text-lg xl:text-2xl mb-2">
<RyskCountUp prefix="Δ" value={delta} />
</p>
</Card>
<Card
disabled
explainer="Total gamma for all open positions."
hasData={false}
loading={loading || statsLoading}
title="Gamma"
>
<p className="text-lg xl:text-2xl mb-2">
<RyskCountUp prefix="Γ" value={0} />
</p>
</Card>
<Card
disabled
explainer="Total theta for all open positions."
hasData={false}
loading={loading || statsLoading}
title="Theta"
>
<p className="text-lg xl:text-2xl mb-2">
<RyskCountUp prefix="θ" value={0} />
</p>
</Card>
</motion.section>
) : null}
<Card
explainer="Total P/L for all active positions."
hasData={Boolean(activePnL)}
loading={loading || statsLoading}
title="P/L (active)"
>
<p className="text-lg xl:text-2xl mb-2">
{<RyskCountUp prefix="$" value={activePnL[feeIndex]} />}
</p>
</Card>
<Card
explainer="Total P/L for all open and closed positions."
hasData={Boolean(historicalPnL)}
loading={loading || statsLoading}
title="P/L (historical)"
>
<p className="text-lg xl:text-2xl mb-2">
<RyskCountUp prefix="$" value={historicalPnL[feeIndex]} />
</p>
</Card>
</motion.section>
</AnimatePresence>
);
};
21 changes: 1 addition & 20 deletions packages/front-end/src/components/optionsTrading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,5 @@ export const OptionsTradingContent = () => {
}
}, [modalType]);

return (
<>
<section className="col-start-1 col-end-17">
<AssetPriceInfo />

<LayoutGroup>
<div className="relative border-2 border-black rounded-lg overflow-hidden">
<ExpiryDatePicker />
<Filters />
<Strategies />
<Chain />
</div>
</LayoutGroup>

<AnimatePresence mode="wait">{visibleModal}</AnimatePresence>
</section>

<UserStats />
</>
);
return <UserStats />;
};

0 comments on commit 3c1fe19

Please sign in to comment.