cdp

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDP

type CDP struct {
	ID      int64
	BytesID [32]byte
	DaiDebt *big.Float
	PethCol *big.Float
	EthCol  *big.Float
}

CDP represents a CDP

func (*CDP) EqualizeCDP

func (cdp *CDP) EqualizeCDP(ethPrice, targetRatio, pethRatio *big.Float) (newCDP *CDP, err error)

EqualizeCDP returns a new CDP equalized at targetRatio for a given price

func (*CDP) GetChangePrices

func (cdp *CDP) GetChangePrices(ethPrice, minRatio, maxRatio, pethRatio *big.Float) (minPrice, maxPrice *big.Float)

GetChangePrices returns the prices (up and down) where this CDP must be equalized

func (*CDP) GetDaiToDraw

func (cdp *CDP) GetDaiToDraw(ethPrice, pethRatio, target *big.Float) *big.Float

GetDaiToDraw returns the number of DAI to draw to go to the target ratio

func (*CDP) GetEthToFree

func (cdp *CDP) GetEthToFree(ethPrice, target *big.Float) *big.Float

GetEthToFree returns the number of eth to free to go to the target ratio

func (*CDP) GetMaxDaiToDraw

func (cdp *CDP) GetMaxDaiToDraw(ethPrice *big.Float, pethRatio *big.Float) *big.Float

GetMaxDaiToDraw returns the maximum number of DAI to draw

func (*CDP) GetMaxEthToFree

func (cdp *CDP) GetMaxEthToFree(ethPrice *big.Float) *big.Float

GetMaxEthToFree returns the maximum number of eth to free

func (*CDP) GetMaxPethToFree

func (cdp *CDP) GetMaxPethToFree(ethPrice *big.Float, pethRatio *big.Float) *big.Float

GetMaxPethToFree returns the maximum number of peth to free

func (*CDP) GetPethToFree

func (cdp *CDP) GetPethToFree(ethPrice, pethRatio, target *big.Float) *big.Float

GetPethToFree returns the number of peth to free to go to the target ratio

func (*CDP) GetRatio

func (cdp *CDP) GetRatio(ethPrice *big.Float, pethRatio *big.Float) *big.Float

GetRatio returns the collateralization ratio of the CDP at the actual price and Peth / Eth ratio

func (*CDP) GetStatus

func (cdp *CDP) GetStatus(ethPrice, pethRatio, target *big.Float) (status *Status, err error)

GetStatus returns the status of the CDP for this price

func (*CDP) Log

func (cdp *CDP) Log(ethPrice, pethRatio, target *big.Float)

Log print infos on the CDP in the logs

type Float

type Float big.Float

Float is for json purposes

func (*Float) MarshalJSON

func (f *Float) MarshalJSON() ([]byte, error)

MarshalJSON transforms the Float in JSON number

func (*Float) String

func (f *Float) String() string

type Status

type Status struct {
	ID      int64
	DaiDebt *Float
	EthCol  *Float
	Price   *Float
	Ratio   *Float
	DaiNet  *Float
	EthNet  *Float
}

Status represents the status of a CDP at a given price

func (*Status) String

func (s *Status) String() string

Jump to

Keyboard shortcuts

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