Skip to content

Commit

Permalink
some minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jepidoptera committed Jul 12, 2023
1 parent 0db222f commit 4d4ac6a
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions hydradx/notebooks/Omnipool/LP_fees_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@
},
"source": [
"<H3>Effects of trade volume.</H3>\n",
"Trade volume generates fees, which are the primary way of offsetting IL. We'll assume prices do no change, so there is no impermanent loss. Trade volume goes from 0% to 2% of TVL per day. (So far we have observed ~1% on average.) We also assume 0.3% total fees. We fully simulate one month and then extrapolate the results to one year. This should still be fairly accurate, because of the linear nature of the correlation between time and profit, but it does introduce a small amount of uncertainty."
"Trade volume generates fees, which are the primary way of offsetting IL. We'll assume prices do no change, so there is no impermanent loss. Trade volume goes from 0% to 5% of TVL per day. (So far we have observed ~1% on average.) We also assume 0.3% total fees. We fully simulate one month and then extrapolate the results to one year. This should still be fairly accurate, because of the linear nature of the correlation between time and profit, but it does introduce a small amount of uncertainty."
]
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 1,
"id": "deb2bd1c-f250-40ea-a5da-1c0e8d54ab7d",
"metadata": {
"ExecuteTime": {
"end_time": "2023-05-24T15:01:05.284668003Z",
"start_time": "2023-05-24T15:00:51.325657113Z"
},
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand All @@ -59,10 +56,10 @@
"price_list = processing.import_binance_prices(['BTC', 'ETH', 'DOT'], start_date='Jan 1 2023', days = 30)\n",
"\n",
"assets = {\n",
" 'HDX': {'usd price': 0.05, 'weight': 0.10},\n",
" 'HDX': {'usd price': 0.05, 'weight': 0.05},\n",
" 'USD': {'usd price': 1, 'weight': 0.20},\n",
" 'BTC': {'usd price': price_list[0]['BTC'], 'weight': 0.10},\n",
" 'ETH': {'usd price': price_list[0]['ETH'], 'weight': 0.40},\n",
" 'ETH': {'usd price': price_list[0]['ETH'], 'weight': 0.50},\n",
" 'DOT': {'usd price': 1, 'weight': 0.17},\n",
" 'TKN': {'usd price': 1, 'weight': 0.03}\n",
"}\n",
Expand Down Expand Up @@ -113,16 +110,14 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 2,
"id": "b3f08712-922b-465f-b04b-5f3057a78ab5",
"metadata": {
"ExecuteTime": {
"end_time": "2023-05-24T15:14:34.207704241Z",
"start_time": "2023-05-24T15:01:10.779629649Z"
},
"collapsed": true,
"jupyter": {
"outputs_hidden": true,
"source_hidden": true
},
"tags": []
Expand All @@ -133,23 +128,23 @@
"output_type": "stream",
"text": [
"Starting simulation...\n",
"Execution time: 40.043 seconds.\n",
"Execution time: 38.873 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.0, 'USD': 0.0, 'BTC': 0.0, 'ETH': 0.0, 'DOT': 0.0, 'TKN': 0.0}\n",
"Starting simulation...\n",
"Execution time: 77.637 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.010000012495835639, 'USD': 0.010000012502803262, 'BTC': 0.010000012502803355, 'ETH': 0.010000012502801739, 'DOT': 0.010000012502803362, 'TKN': 0.010000011029834038}\n",
"Execution time: 88.07 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.010000012495836826, 'USD': 0.010000012502803262, 'BTC': 0.010000012502803355, 'ETH': 0.010000012502801739, 'DOT': 0.010000012502803362, 'TKN': 0.010000011029834038}\n",
"Starting simulation...\n",
"Execution time: 77.688 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.02000002490812559, 'USD': 0.02000002493598734, 'BTC': 0.02000002493598931, 'ETH': 0.020000024935990127, 'DOT': 0.020000024935989045, 'TKN': 0.020000021990042104}\n",
"Execution time: 88.528 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.02000002490813006, 'USD': 0.02000002493598734, 'BTC': 0.02000002493598931, 'ETH': 0.020000024935990127, 'DOT': 0.020000024935989045, 'TKN': 0.020000021990042104}\n",
"Starting simulation...\n",
"Execution time: 76.665 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.03000003723686692, 'USD': 0.030000037299553438, 'BTC': 0.030000037299554354, 'ETH': 0.030000037299554885, 'DOT': 0.030000037299555186, 'TKN': 0.030000032880643755}\n",
"Execution time: 87.708 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.030000037236865996, 'USD': 0.030000037299553438, 'BTC': 0.030000037299554354, 'ETH': 0.030000037299554885, 'DOT': 0.030000037299555186, 'TKN': 0.030000032880643755}\n",
"Starting simulation...\n",
"Execution time: 79.722 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.040000049482056425, 'USD': 0.040000049593503596, 'BTC': 0.040000049593505595, 'ETH': 0.04000004959350389, 'DOT': 0.040000049593502444, 'TKN': 0.04000004370160887}\n",
"Execution time: 89.159 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.040000049482057536, 'USD': 0.040000049593503596, 'BTC': 0.040000049593505595, 'ETH': 0.04000004959350389, 'DOT': 0.040000049593502444, 'TKN': 0.04000004370160887}\n",
"Starting simulation...\n",
"Execution time: 91.13 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.05000006164369823, 'USD': 0.05000006181782769, 'BTC': 0.050000061817830586, 'ETH': 0.0500000618178282, 'DOT': 0.05000006181782925, 'TKN': 0.05000005445297287}\n"
"Execution time: 87.901 seconds.\n",
"Trade volume per day as a fraction of TVL: {'HDX': 0.05000006164369554, 'USD': 0.05000006181782769, 'BTC': 0.050000061817830586, 'ETH': 0.0500000618178282, 'DOT': 0.05000006181782925, 'TKN': 0.05000005445297287}\n"
]
}
],
Expand Down Expand Up @@ -181,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 3,
"id": "b5d6dadf-f4e3-4498-b99c-93b726fca2c1",
"metadata": {
"ExecuteTime": {
Expand All @@ -197,10 +192,10 @@
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x1d4d2852c40>"
"<matplotlib.legend.Legend at 0x1d4d7aadb50>"
]
},
"execution_count": 33,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -253,7 +248,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 4,
"id": "40b300ed-24b1-410e-be52-d64477ab2e2d",
"metadata": {
"jupyter": {
Expand All @@ -265,10 +260,10 @@
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x1d4d3d85820>]"
"[<matplotlib.lines.Line2D at 0x1d4f167e100>]"
]
},
"execution_count": 34,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -311,7 +306,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 5,
"id": "812d1113-a211-4dc0-8fff-8779e3cb10bc",
"metadata": {},
"outputs": [
Expand All @@ -321,7 +316,7 @@
"['TKN']"
]
},
"execution_count": 36,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 4d4ac6a

Please sign in to comment.