From 1a3fb84d76262e519c21eafd9fac4a978de448eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Tue, 2 Jul 2024 14:49:12 +0000 Subject: [PATCH 1/2] Add proposed lpool adjspd values --- scripts/calc-voladjspd.py | 35 +++++++ scripts/lpooladjspd-proposal-230702.txt | 129 ++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 scripts/calc-voladjspd.py create mode 100644 scripts/lpooladjspd-proposal-230702.txt diff --git a/scripts/calc-voladjspd.py b/scripts/calc-voladjspd.py new file mode 100644 index 0000000..1381393 --- /dev/null +++ b/scripts/calc-voladjspd.py @@ -0,0 +1,35 @@ +def calculate_new_volatility(current_volatility, option_size, pool_volatility_adjustment_speed, is_long): + relative_option_size = (option_size / pool_volatility_adjustment_speed) * 100 + if is_long: + new_volatility = current_volatility + relative_option_size + else: + new_volatility = current_volatility - relative_option_size + trade_volatility = (current_volatility + new_volatility) / 2 + return new_volatility, trade_volatility + +def simulate_trade(pool_size, initial_volatility, adjustment_speed, is_call): + current_volatility = initial_volatility + total_traded = 0 + step = pool_size / 10 # We'll simulate the trade in 10 steps + + print(f"{'Call' if is_call else 'Put'} Pool Simulation:") + print(f"Initial volatility: {current_volatility}") + print(f"Adjustment speed: {adjustment_speed}") + print(f"{'STRK' if is_call else 'USDC'} in pool: {pool_size}") + print("\nTrading simulation:") + + for i in range(10): + total_traded += step + new_volatility, _ = calculate_new_volatility(current_volatility, step, adjustment_speed, True) + current_volatility = new_volatility + print(f"Traded {total_traded:.2f}: New volatility = {current_volatility:.2f}") + + print(f"\nFinal volatility after trading all {pool_size} {'STRK' if is_call else 'USDC'}: {current_volatility:.2f}") + +# Simulate for call pool +simulate_trade(600000, 100, 400000, True) + +print("\n" + "="*50 + "\n") + +# Simulate for put pool +simulate_trade(100000, 100, 66666.67, False) diff --git a/scripts/lpooladjspd-proposal-230702.txt b/scripts/lpooladjspd-proposal-230702.txt new file mode 100644 index 0000000..20e7e67 --- /dev/null +++ b/scripts/lpooladjspd-proposal-230702.txt @@ -0,0 +1,129 @@ +STRK/USDC call +Call Pool Simulation: +Initial volatility: 100 +Adjustment speed: 400000 +call currency in pool: 600000 + +Trading simulation: +Traded 60000.00: New volatility = 115.00 +Traded 120000.00: New volatility = 130.00 +Traded 180000.00: New volatility = 145.00 +Traded 240000.00: New volatility = 160.00 +Traded 300000.00: New volatility = 175.00 +Traded 360000.00: New volatility = 190.00 +Traded 420000.00: New volatility = 205.00 +Traded 480000.00: New volatility = 220.00 +Traded 540000.00: New volatility = 235.00 +Traded 600000.00: New volatility = 250.00 + +Final volatility after trading all 600000 call: 250.00 + +================================================== + +STRK/USDC put +Put Pool Simulation: +Initial volatility: 100 +Adjustment speed: 66666.67 +put currency in pool: 100000 + +Trading simulation: +Traded 10000.00: New volatility = 115.00 +Traded 20000.00: New volatility = 130.00 +Traded 30000.00: New volatility = 145.00 +Traded 40000.00: New volatility = 160.00 +Traded 50000.00: New volatility = 175.00 +Traded 60000.00: New volatility = 190.00 +Traded 70000.00: New volatility = 205.00 +Traded 80000.00: New volatility = 220.00 +Traded 90000.00: New volatility = 235.00 +Traded 100000.00: New volatility = 250.00 + +Final volatility after trading all 100000 put: 250.00 + +================================================== + +ETH/USDC call +Call Pool Simulation: +Initial volatility: 60 +Adjustment speed: 20 +call currency in pool: 23 + +Trading simulation: +Traded 2.30: New volatility = 71.50 +Traded 4.60: New volatility = 83.00 +Traded 6.90: New volatility = 94.50 +Traded 9.20: New volatility = 106.00 +Traded 11.50: New volatility = 117.50 +Traded 13.80: New volatility = 129.00 +Traded 16.10: New volatility = 140.50 +Traded 18.40: New volatility = 152.00 +Traded 20.70: New volatility = 163.50 +Traded 23.00: New volatility = 175.00 + +Final volatility after trading all 23 call: 175.00 + +================================================== + +ETH/USDC put +Put Pool Simulation: +Initial volatility: 60 +Adjustment speed: 50000 +put currency in pool: 78000 + +Trading simulation: +Traded 7800.00: New volatility = 75.60 +Traded 15600.00: New volatility = 91.20 +Traded 23400.00: New volatility = 106.80 +Traded 31200.00: New volatility = 122.40 +Traded 39000.00: New volatility = 138.00 +Traded 46800.00: New volatility = 153.60 +Traded 54600.00: New volatility = 169.20 +Traded 62400.00: New volatility = 184.80 +Traded 70200.00: New volatility = 200.40 +Traded 78000.00: New volatility = 216.00 + +Final volatility after trading all 78000 put: 216.00 + +================================================== + +STRK/ETH call pool +Call Pool Simulation: +Initial volatility: 100 +Adjustment speed: 10 +call currency in pool: 10 + +Trading simulation: +Traded 1.00: New volatility = 110.00 +Traded 2.00: New volatility = 120.00 +Traded 3.00: New volatility = 130.00 +Traded 4.00: New volatility = 140.00 +Traded 5.00: New volatility = 150.00 +Traded 6.00: New volatility = 160.00 +Traded 7.00: New volatility = 170.00 +Traded 8.00: New volatility = 180.00 +Traded 9.00: New volatility = 190.00 +Traded 10.00: New volatility = 200.00 + +Final volatility after trading all 10 call: 200.00 + +================================================== + +STRK/ETH put pool +Put Pool Simulation: +Initial volatility: 100 +Adjustment speed: 180000 +put currency in pool: 243000 + +Trading simulation: +Traded 24300.00: New volatility = 113.50 +Traded 48600.00: New volatility = 127.00 +Traded 72900.00: New volatility = 140.50 +Traded 97200.00: New volatility = 154.00 +Traded 121500.00: New volatility = 167.50 +Traded 145800.00: New volatility = 181.00 +Traded 170100.00: New volatility = 194.50 +Traded 194400.00: New volatility = 208.00 +Traded 218700.00: New volatility = 221.50 +Traded 243000.00: New volatility = 235.00 + +Final volatility after trading all 243000 put: 235.00 From 241b551db4055a13579a35ff278f8aa7a5955727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Tue, 2 Jul 2024 14:49:53 +0000 Subject: [PATCH 2/2] Polish script --- scripts/calc-voladjspd.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/calc-voladjspd.py b/scripts/calc-voladjspd.py index 1381393..7c9a196 100644 --- a/scripts/calc-voladjspd.py +++ b/scripts/calc-voladjspd.py @@ -15,7 +15,7 @@ def simulate_trade(pool_size, initial_volatility, adjustment_speed, is_call): print(f"{'Call' if is_call else 'Put'} Pool Simulation:") print(f"Initial volatility: {current_volatility}") print(f"Adjustment speed: {adjustment_speed}") - print(f"{'STRK' if is_call else 'USDC'} in pool: {pool_size}") + print(f"{'call currency' if is_call else 'put currency'} in pool: {pool_size}") print("\nTrading simulation:") for i in range(10): @@ -24,12 +24,27 @@ def simulate_trade(pool_size, initial_volatility, adjustment_speed, is_call): current_volatility = new_volatility print(f"Traded {total_traded:.2f}: New volatility = {current_volatility:.2f}") - print(f"\nFinal volatility after trading all {pool_size} {'STRK' if is_call else 'USDC'}: {current_volatility:.2f}") + print(f"\nFinal volatility after trading all {pool_size} {'call' if is_call else 'put'}: {current_volatility:.2f}") -# Simulate for call pool +print('STRK/USDC call') simulate_trade(600000, 100, 400000, True) - print("\n" + "="*50 + "\n") -# Simulate for put pool +print('STRK/USDC put') simulate_trade(100000, 100, 66666.67, False) +print("\n" + "="*50 + "\n") + +print('ETH/USDC call') +simulate_trade(23, 60, 20, True) +print("\n" + "="*50 + "\n") + +print('ETH/USDC put') +simulate_trade(78000, 60, 50000, False) +print("\n" + "="*50 + "\n") + +print('STRK/ETH call pool') +simulate_trade(10, 100, 10, True) +print("\n" + "="*50 + "\n") + +print('STRK/ETH put pool') +simulate_trade(243000, 100, 180000, False)