Skip to content

Commit

Permalink
update fee data source from config to metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkunz committed Sep 18, 2024
1 parent 219f6a2 commit 4e429f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TS_PUBLIC_TYPESENSE_API_URL=https://typesense.tradingstrategy.ai
TS_PUBLIC_TYPESENSE_API_KEY=npdPPJNELDhdr7v6IS9rQUpFG2VvdyAL
TS_PUBLIC_DISCORD_URL=https://discord.gg/5M88m9nM8H
TS_PUBLIC_WALLET_CONNECT_PROJECT_ID=9ee7efad98897eb60ba023db6aa72355
TS_PUBLIC_STRATEGIES='[{"id":"enzyme-polygon-eth-btc-rsi","name":"ETH-BTC price surge","url":"https://enzyme-polygon-eth-btc-rsi.tradingstrategy.ai/","frontpage":true,"hiddenPositions":[4]},{"id":"enzyme-ethereum-btc-eth-stoch-rsi","name":"Stochastic ETH/BTC long","url":"https://enzyme-ethereum-btc-eth-stoch-rsi.tradingstrategy.ai","fees":{"trading_strategy_protocol_fee":0.02,"strategy_developer_fee":0.1},"frontpage":true},{"id":"enzyme-polygon-eth-rolling-ratio","name":"ETH/BTC rolling ratio","url":"https://enzyme-polygon-eth-rolling-ratio.tradingstrategy.ai/","fees":{"trading_strategy_protocol_fee":0.02,"strategy_developer_fee":0.05},"frontpage":true},{"id":"enzyme-polygon-matic-eth-usdc","name":"ETH-MATIC-USDC momentum","url":"https://enzyme-polygon-matic-eth-usdc.tradingstrategy.ai","frontpage":true},{"id":"enzyme-polygon-eth-btc-usdc","name":"ETH-BTC-USDC momentum","url":"https://enzyme-polygon-eth-btc-usdc.tradingstrategy.ai","new_version_id":"enzyme-polygon-eth-btc-rsi","frontpage":true},{"id":"enzyme-polygon-matic-usdc","name":"MATIC breakout","url":"https://enzyme-polygon-matic-usdc.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-breakout","name":"ETH breakout","url":"https://enzyme-polygon-eth-breakout.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-usdc","name":"ETH Breakout bounce","url":"https://enzyme-polygon-eth-usdc.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-usdc-sls","name":"ETH Balance snap","url":"https://enzyme-polygon-eth-usdc-sls.tradingstrategy.ai"},{"id":"polygon-eth-spot-short","name":"ETH mean reversion bounce","url":"https://polygon-eth-spot-short.tradingstrategy.ai"},{"id":"arbitrum-btc-breakout","name":"BTC Barrier Breach","url":"https://arbitrum-btc-breakout.tradingstrategy.ai"}]'
TS_PUBLIC_STRATEGIES='[{"id":"enzyme-polygon-eth-btc-rsi","name":"ETH-BTC price surge","url":"https://enzyme-polygon-eth-btc-rsi.tradingstrategy.ai/","frontpage":true,"hiddenPositions":[4]},{"id":"enzyme-ethereum-btc-eth-stoch-rsi","name":"Stochastic ETH/BTC long","url":"https://enzyme-ethereum-btc-eth-stoch-rsi.tradingstrategy.ai","frontpage":true},{"id":"enzyme-polygon-eth-rolling-ratio","name":"ETH/BTC rolling ratio","url":"https://enzyme-polygon-eth-rolling-ratio.tradingstrategy.ai/","frontpage":true},{"id":"enzyme-polygon-matic-eth-usdc","name":"ETH-MATIC-USDC momentum","url":"https://enzyme-polygon-matic-eth-usdc.tradingstrategy.ai","frontpage":true},{"id":"enzyme-polygon-eth-btc-usdc","name":"ETH-BTC-USDC momentum","url":"https://enzyme-polygon-eth-btc-usdc.tradingstrategy.ai","new_version_id":"enzyme-polygon-eth-btc-rsi","frontpage":true},{"id":"enzyme-polygon-matic-usdc","name":"MATIC breakout","url":"https://enzyme-polygon-matic-usdc.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-breakout","name":"ETH breakout","url":"https://enzyme-polygon-eth-breakout.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-usdc","name":"ETH Breakout bounce","url":"https://enzyme-polygon-eth-usdc.tradingstrategy.ai"},{"id":"enzyme-polygon-eth-usdc-sls","name":"ETH Balance snap","url":"https://enzyme-polygon-eth-usdc-sls.tradingstrategy.ai"},{"id":"polygon-eth-spot-short","name":"ETH mean reversion bounce","url":"https://polygon-eth-spot-short.tradingstrategy.ai"},{"id":"arbitrum-btc-breakout","name":"BTC Barrier Breach","url":"https://arbitrum-btc-breakout.tradingstrategy.ai"}]'
TS_PUBLIC_GEO_BLOCK='{"strategies:view":["CU","IR","KP","RU","SY"],"strategies:deposit":["CU","IR","KP","RU","SY","US","UK"]}'
# Uncomment to test chain maintenance error
# TS_PUBLIC_CHAINS_UNDER_MAINTENANCE='{ "binance": "BNB Chain" }'
Expand Down
11 changes: 1 addition & 10 deletions src/lib/trade-executor/strategy/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { strategyConfig } from '$lib/config';
import { z } from 'zod';
import { percent, primaryKey } from '../state/utility-types';

export const strategyFeesSchema = z.object({
management_fee: percent.default(0),
trading_strategy_protocol_fee: percent.default(0),
strategy_developer_fee: percent.default(0),
enzyme_protocol_fee: percent.default(0.0025)
});
export type StrategyFees = z.infer<typeof strategyFeesSchema>;
import { primaryKey } from '../state/utility-types';

export const strategyConfigurationSchema = z.object({
id: z.string(),
name: z.string(),
url: z.string().url(),
fees: strategyFeesSchema.default({}),
new_version_id: z.string().nullish(),
frontpage: z.boolean().nullish(),
hiddenPositions: primaryKey.array().default([])
Expand Down
10 changes: 9 additions & 1 deletion src/lib/trade-executor/strategy/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export const strategySummaryStatisticsSchema = z.object({
});
export type StrategySummaryStatistics = z.infer<typeof strategySummaryStatisticsSchema>;

export const strategyFeesSchema = z.object({
management_fee: percent.default(0),
trading_strategy_protocol_fee: percent.default(0),
strategy_developer_fee: percent.default(0)
});
export type StrategyFees = z.infer<typeof strategyFeesSchema>;

export const strategySummarySchema = z.object({
name: z.string(),
short_description: z.string().nullish(),
Expand All @@ -106,6 +113,7 @@ export const strategySummarySchema = z.object({
crashed_at: unixTimestampToDate.nullish(),
badges: z.string().array(),
tags: z.string().array(),
sort_priority: z.number().default(0)
sort_priority: z.number().default(0),
fees: strategyFeesSchema.default({})
});
export type StrategySummary = z.infer<typeof strategySummarySchema>;
3 changes: 2 additions & 1 deletion src/routes/strategies/[strategy]/fees/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
const hasEnzymeVault = strategy.on_chain_data.asset_management_mode === 'enzyme';
const enzymeFeeUrl = 'https://docs.enzyme.finance/what-is-enzyme/faq#fees-performance-and-accounting';
const enzymeProtocolFee = 0.0025;
</script>

<svelte:head>
Expand Down Expand Up @@ -95,7 +96,7 @@
</p>
</div>
</Tooltip>
<span>{formatPercent(fees.enzyme_protocol_fee, 2)}</span>
<span>{formatPercent(enzymeProtocolFee, 2)}</span>
</div>
{/if}
</div>
Expand Down

0 comments on commit 4e429f7

Please sign in to comment.