Skip to content

Commit

Permalink
Merge pull request #131 from akiraonstarknet/add-fee
Browse files Browse the repository at this point in the history
add performance fee for delta neutral strats
  • Loading branch information
akiraonstarknet authored Sep 13, 2024
2 parents 6cdc3d7 + 3b3f7db commit c87626b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
15 changes: 9 additions & 6 deletions src/app/strategy/[strategyId]/_components/Strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
TabPanels,
Tabs,
Text,
Tooltip,
VStack,
Wrap,
WrapItem,
Expand Down Expand Up @@ -159,12 +160,14 @@ const Strategy = ({ params }: StrategyParams) => {
<StatLabel textAlign={{ base: 'left', md: 'right' }}>
APY
</StatLabel>
<StatNumber
color="cyan"
textAlign={{ base: 'left', md: 'right' }}
>
{(strategy.netYield * 100).toFixed(2)}%
</StatNumber>
<Tooltip label="Effective APY after removing fees. We charge a 10% performance fee on the rewards generated.">
<StatNumber
color="cyan"
textAlign={{ base: 'left', md: 'right' }}
>
{(strategy.netYield * 100).toFixed(2)}%
</StatNumber>
</Tooltip>
<StatHelpText textAlign={{ base: 'left', md: 'right' }}>
{strategy.leverage.toFixed(2)}x boosted
</StatHelpText>
Expand Down
9 changes: 0 additions & 9 deletions src/components/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,6 @@ export default function Deposit(props: DepositProps) {
/>
</Center>

<Text
textAlign="center"
color="disabled_bg"
fontSize="12px"
marginTop="20px"
>
No additional fees by STRKFarm
</Text>

<Box width="100%" marginTop={'15px'}>
<Flex justifyContent="space-between">
<Text fontSize={'12px'} color="color2" fontWeight={'bold'}>
Expand Down
1 change: 1 addition & 0 deletions src/strategies/IStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class IStrategyProps {
actions: StrategyAction[] = [];
netYield: number = 0;
leverage: number = 0;
fee_factor = 0; // in absolute terms, not %
status = StrategyStatus.UNINTIALISED;

readonly rewardTokens: { logo: string }[];
Expand Down
14 changes: 13 additions & 1 deletion src/strategies/delta_neutral_mm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class DeltaNeutralMM extends IStrategy {
readonly strategyAddress: string;
// Factor of Amount to be deposited/borrowed at each step relative to the previous step
readonly stepAmountFactors: number[];
fee_factor = 0.1; // 10% fee

constructor(
token: TokenInfo,
Expand Down Expand Up @@ -149,10 +150,21 @@ export class DeltaNeutralMM extends IStrategy {
const _amount = (
Number(amount) * this.stepAmountFactors[actions.length]
).toFixed(2);
const pool = { ...eligiblePools[0] };
const isDeposit = actions.length == 0 || actions.length == 2;
const effectiveAPR = pool.aprSplits.reduce((a, b) => {
if (b.apr == 'Err') return a;
if (!isDeposit) return a + Number(b.apr);
if (b.title.includes('STRK rewards')) {
return a + Number(b.apr) * (1 - this.fee_factor);
}
return a + Number(b.apr);
}, 0);
pool.apr = isDeposit ? effectiveAPR : pool.borrow.apr;
return [
...actions,
{
pool: eligiblePools[0],
pool,
amount: _amount,
isDeposit: actions.length == 0 || actions.length == 2,
},
Expand Down

0 comments on commit c87626b

Please sign in to comment.