feat: risk
This commit is contained in:
@@ -317,6 +317,25 @@ export const usePnlHistory = () =>
|
||||
queryFn: () => api.get('/portfolio/pnl-history').then(r => r.data),
|
||||
})
|
||||
|
||||
// P&L-vs-underlying-price payoff diagram for one position (services.portfolio_pricing.
|
||||
// compute_payoff) — at-expiry (pure intrinsic) + today (current vol held fixed) curves.
|
||||
export const usePositionPayoff = (posId: string, enabled: boolean) =>
|
||||
useQuery({
|
||||
queryKey: ['portfolio-payoff', posId],
|
||||
queryFn: () => api.get(`/portfolio/positions/${posId}/payoff`).then(r => r.data),
|
||||
enabled,
|
||||
})
|
||||
|
||||
// Reprices every open position under a handful of named macro scenarios (Risk-Off,
|
||||
// Risk-On, inflation persistante, dollar fort, baisse des matières premières) to surface
|
||||
// when several differently-named positions are really the same underlying bet.
|
||||
export const usePortfolioScenarioExposure = () =>
|
||||
useQuery({
|
||||
queryKey: ['portfolio-scenario-exposure'],
|
||||
queryFn: () => api.get('/portfolio/scenario-exposure').then(r => r.data),
|
||||
staleTime: 5 * 60_000,
|
||||
})
|
||||
|
||||
export const useAddPosition = () => {
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user