floe|

Playground

Price calls and puts with the Go Black-Scholes package.

main.go
package main

import (
  "fmt"

  floe "github.com/FullStackCraft/floe-go"
  "github.com/FullStackCraft/floe-go/blackscholes"
)

func main() {
  params := floe.BlackScholesParams{
    Spot:         100,
    Strike:       105,
    TimeToExpiry: 0.25,
    RiskFreeRate: 0.05,
    Volatility:   0.20,
    OptionType:   floe.Call,
  }

  callPrice := blackscholes.BlackScholes(params)
  putPrice := blackscholes.BlackScholes(floe.BlackScholesParams{
    Spot:         params.Spot,
    Strike:       params.Strike,
    TimeToExpiry: params.TimeToExpiry,
    RiskFreeRate: params.RiskFreeRate,
    Volatility:   params.Volatility,
    OptionType:   floe.Put,
  })

  fmt.Printf("Call: %.2f\n", callPrice)
  fmt.Printf("Put: %.2f\n", putPrice)
}

Tips

  • • These snippets are designed for server-side Go workflows
  • • Import from github.com/FullStackCraft/floe-go and package submodules
  • • Check the documentation for package-level API details
  • • Pass explicit timestamps (for example time.Now().UnixMilli()) where required