Price calls and puts with floe's Black-Scholes implementation.
main.py
from floe import BlackScholesParams, black_scholes
common = BlackScholesParams(
spot=100.0,
strike=105.0,
time_to_expiry=0.25,
risk_free_rate=0.05,
volatility=0.20,
option_type="call",
)
call_price = black_scholes(common)
put_price = black_scholes(
BlackScholesParams(
spot=common.spot,
strike=common.strike,
time_to_expiry=common.time_to_expiry,
risk_free_rate=common.risk_free_rate,
volatility=common.volatility,
option_type="put",
)
)
print(f"Call: {call_price:.2f}")
print(f"Put: {put_price:.2f}")Tips
- • These snippets are designed for server-side Python workflows
- • Install with
pip install floe-pyand import fromfloe - • Check the documentationfor API details and signatures
- • Pass explicit millisecond timestamps to time-sensitive APIs where required