import math
# Normal Distribution Functions (No need for scipy)
def N(x):
# Cumulative Normal Distribution
return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0
def N_prime(x):
# Normal PDF
return math.exp(-0.5 * x * x) / math.sqrt(2 * math.pi)
def black_scholes_calculator(S, K, T_days, IV_percent, r_percent, point_value=5):
T = T_days / 365.0
IV = IV_percent / 100.0
r = r_percent / 100.0
if T <= 0 or IV <= 0:
print("Time or IV zero!")
return
# d1 d2 - আসল অংক
d1 = (math.log(S / K) + (r + 0.5 * IV**2) * T) / (IV * math.sqrt(T))
d2 = d1 - IV * math.sqrt(T)
# Call Option Price
call_price_pts = S * N(d1) - K * math.exp(-r * T) * N(d2)
put_price_pts = K * math.exp(-r * T) * N(-d2) - S * N(-d1)
# Greeks
delta_call = N(d1)
delta_put = delta_call - 1
intrinsic_call = max(S - K, 0)
intrinsic_put = max(K - S, 0)
time_value_call = call_price_pts - intrinsic_call
time_value_put = put_price_pts - intrinsic_put
# Theta per day in points
theta_call_pts_day = -(S * N_prime(d1) * IV / (2 * math.sqrt(T)) + r * K * math.exp(-r * T) * N(d2)) / 365
theta_put_pts_day = -(S * N_prime(d1) * IV / (2 * math.sqrt(T)) - r * K * math.exp(-r * T) * N(-d2)) / 365
vega_pts = S * math.sqrt(T) * N_prime(d1) / 100 # per 1% IV
gamma = N_prime(d1) / (S * IV * math.sqrt(T))
# Expected Move (আপনি যেটা চান)
daily_move_dollar = S * IV / math.sqrt(365)
expected_7day_move = daily_move_dollar * math.sqrt(T_days)
print(f"\n========== CME BTC/ETH Option Calculator ==========")
print(f"Spot: {S} | Strike: {K} | Days: {T_days} | IV: {IV_percent}%")
print(f"--------------------------------------------------")
print(f"CALL Price: {call_price_pts:.1f} pts x ${point_value} = ${call_price_pts*point_value:,.2f}")
print(f" Intrinsic: {intrinsic_call:.1f} pts | TimeValue: {time_value_call:.1f} pts")
print(f" Delta: {delta_call:.3f} ({delta_call*100:.1f}% Chance ITM)")
print(f" Theta: {theta_call_pts_day:.2f} pts/day = ${theta_call_pts_day*point_value:.2f}/day LOSS for Buyer")
print(f" Vega: {vega_pts:.2f} pts per 1% IV = ${vega_pts*point_value:.2f}")
print(f"--------------------------------------------------")
print(f"PUT Price: {put_price_pts:.1f} pts = ${put_price_pts*point_value:,.2f}")
print(f" Delta: {delta_put:.3f}")
print(f"--------------------------------------------------")
print(f"EXPECTED MOVE (আপনার জন্য):")
print(f"Daily Expected Move: ${daily_move_dollar:.0f}")
print(f"{T_days}-Day Expected Move: ${expected_7day_move:.0f}")
print(f"Range: {S-expected_7day_move:.0f} to {S+expected_7day_move:.0f}")
print(f"Straddle Price (Call+Put): {(call_price_pts+put_price_pts)*point_value:.0f}$ = Expected Total Move")
print(f"==================================================\n")
# ===== এখানে আপনার Data বসান =====
# আপনার ছবির Data
S = 81535 # Spot Price
K = 81500 # Strike Price
T_days = 7 # Days to Expiry
IV_percent = 34.21 # IV from picture
r_percent = 4.5 # Dollar interest
black_scholes_calculator(S, K, T_days, IV_percent, r_percent)
# ETH এর জন্য Test করতে চাইলে:
# black_scholes_calculator(S=2459, K=2500, T_days=7, IV_percent=68, r_percent=4.5)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment