Skip to content

Commit

Permalink
Polish script
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed Jul 2, 2024
1 parent 1a3fb84 commit 241b551
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions scripts/calc-voladjspd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)

0 comments on commit 241b551

Please sign in to comment.