Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.36 KB

README.md

File metadata and controls

55 lines (42 loc) · 1.36 KB

stock-options logo
Golang Stock Options Calculator

Build Status coverage GoReport license GoDoc

Install

# Go 1.16+
go install github.com/vbetsun/stock-options@latest

# Go version < 1.16
go get -u github.com/vbetsun/stock-options 

Usage

package main

import (
	"fmt"

	so "github.com/vbetsun/stock-options"
)

func main() {
	var strike, stock, premium float64 = 50, 70, 10
	bep, err := so.BreakEvenPoint(so.Call, strike, premium)
	if err != nil {
		// handle error
	}
	fmt.Printf("%.2f", bep)
	// Output: 60.00
	payoff, err := so.PayoffFromBuying(so.Call, strike, stock, premium)
	if err != nil {
		// handle error
	}
	fmt.Printf("%.2f", payoff)
	// Output: 10.00
}

License

Golang Stock Options Calculator is provided under the MIT License