risk

package
v1.60.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateMarginCost

func CalculateMarginCost(price, quantity, leverage fixedpoint.Value) fixedpoint.Value

CalculateMarginCost calculate the margin cost of the given notional position by price * quantity

func CalculateMaxPosition

func CalculateMaxPosition(price, availableMargin, leverage fixedpoint.Value) fixedpoint.Value

CalculateMaxPosition calculates the maximum notional value of the position and return the max quantity you can use.

func CalculateMinRequiredLeverage

func CalculateMinRequiredLeverage(price, quantity, availableMargin fixedpoint.Value) fixedpoint.Value

CalculateMinRequiredLeverage calculates the leverage of the given position (price and quantity)

func CalculateOpenLoss

func CalculateOpenLoss(numContract, markPrice, orderPrice fixedpoint.Value, side types.SideType) fixedpoint.Value

How to Calculate Cost Required to Open a Position in Perpetual Futures Contracts

See <https://www.binance.com/en/support/faq/87fa7ee33b574f7084d42bd2ce2e463b>

For Long Position: = Number of Contract * Absolute Value {min[0, direction of order x (mark price - order price)]}

For short position: = Number of Contract * Absolute Value {min[0, direction of order x (mark price - order price)]}

func CalculatePositionCost

func CalculatePositionCost(markPrice, orderPrice, quantity, leverage fixedpoint.Value, side types.SideType) fixedpoint.Value

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL