defiscrapers

package
v1.4.1-rc-88 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AAVEMarket

type AAVEMarket struct {
	Data struct {
		Reserves []Reserve `json:"reserves"`
	} `json:"data"`
}

type AAVEProtocol

type AAVEProtocol struct {
	// contains filtered or unexported fields
}

func NewAAVE

func NewAAVE(scraper *DefiScraper, protocol dia.DefiProtocol) *AAVEProtocol

func (*AAVEProtocol) UpdateRate

func (proto *AAVEProtocol) UpdateRate() error

func (*AAVEProtocol) UpdateState

func (proto *AAVEProtocol) UpdateState() error

type AAVEv2Protocol added in v1.2.0

type AAVEv2Protocol struct {
	// contains filtered or unexported fields
}

func NewAAVEv2 added in v1.2.0

func NewAAVEv2(scraper *DefiScraper, protocol dia.DefiProtocol) *AAVEv2Protocol

func (*AAVEv2Protocol) UpdateRate added in v1.2.0

func (proto *AAVEv2Protocol) UpdateRate() error

func (*AAVEv2Protocol) UpdateState added in v1.2.0

func (proto *AAVEv2Protocol) UpdateState() error

type BZXProtocol

type BZXProtocol struct {
	// contains filtered or unexported fields
}

func NewBZX

func NewBZX(scraper *DefiScraper, protocol dia.DefiProtocol) *BZXProtocol

func (*BZXProtocol) UpdateRate

func (proto *BZXProtocol) UpdateRate() error

func (*BZXProtocol) UpdateState

func (proto *BZXProtocol) UpdateState() error

type BZXRate

type BZXRate struct {
	SupplyRate       *big.Int
	BorrowRate       *big.Int
	TotalSupply      *big.Int
	TotalSupplyAsset *big.Int
	TotalBorrowAsset *big.Int
	Decimals         uint8
	Symbol           string
}

type BitfinexProtocol

type BitfinexProtocol struct {
	WsConnections []*BitfinexWSSConnection
	// contains filtered or unexported fields
}

func NewBitfinex

func NewBitfinex(scraper *DefiScraper, protocol dia.DefiProtocol) *BitfinexProtocol

func (*BitfinexProtocol) UpdateRate

func (proto *BitfinexProtocol) UpdateRate() error

func (*BitfinexProtocol) UpdateState

func (proto *BitfinexProtocol) UpdateState() error

type BitfinexTickerIndex

type BitfinexTickerIndex uint
const (
	FRR BitfinexTickerIndex = iota
	BID
	BID_PERIOD
	BID_SIZE
	ASK
	ASK_PERIOD
	ASK_SIZE
	DAILY_CHANGE
	DAILY_CHANGE_RELATIVE
	LAST_PRICE
	VOLUME
	HIGH
	LOW
	FRR_AMOUNT_AVAILABLE
)

Bitfinex response message indices

type BitfinexWSSConnection

type BitfinexWSSConnection struct {
	// contains filtered or unexported fields
}

type Collateral

type Collateral struct {
	// contains filtered or unexported fields
}

type CompoundProtocol

type CompoundProtocol struct {
	// contains filtered or unexported fields
}

func NewCompound

func NewCompound(scraper *DefiScraper, protocol dia.DefiProtocol) *CompoundProtocol

func NewCreamFinance

func NewCreamFinance(scraper *DefiScraper, protocol dia.DefiProtocol) *CompoundProtocol

func (*CompoundProtocol) UpdateRate

func (proto *CompoundProtocol) UpdateRate() error

func (*CompoundProtocol) UpdateState

func (proto *CompoundProtocol) UpdateState() error

type CompoundRate

type CompoundRate struct {
	SupplyRate    float64
	BorrowRate    float64
	TotalSupply   *big.Int
	TotalBorrow   *big.Int
	TotalReserves *big.Int
	Cash          *big.Int
	Decimal       int
	Symbol        string
}

type DDEXMarket

type DDEXMarket struct {
	Status   int         `json:"status"`
	Desc     string      `json:"desc"`
	Template string      `json:"template"`
	Params   interface{} `json:"params"`
	Data     struct {
		LendingPoolStats []LendingPool `json:"lendingPoolStats"`
	} `json:"data"`
}

type DDEXProtocol

type DDEXProtocol struct {
	// contains filtered or unexported fields
}

func NewDDEX

func NewDDEX(scraper *DefiScraper, protocol dia.DefiProtocol) *DDEXProtocol

func (*DDEXProtocol) UpdateRate

func (proto *DDEXProtocol) UpdateRate() error

func (*DDEXProtocol) UpdateState

func (proto *DDEXProtocol) UpdateState() error

type DDai

type DDai struct {
	ID                  string `json:"id"`
	LastUpdateTimestamp int    `json:"lastUpdateTimestamp"`
	LiquidityRate       string `json:"liquidityRate"`
	Name                string `json:"name"`
	Price               struct {
		ID string `json:"id"`
	} `json:"price"`
	StableBorrowRate   string `json:"stableBorrowRate"`
	VariableBorrowRate string `json:"variableBorrowRate"`
	TotalSupply        string `json:"totalSupply"`
}

type DHARMAMArket

type DHARMAMArket struct {
	Data struct {
		DDai []DDai `json:"dDai"`
	} `json:"data"`
}

type DYDXMarket

type DYDXMarket struct {
	ID                        int         `json:"id"`
	Name                      string      `json:"name"`
	Symbol                    string      `json:"symbol"`
	SupplyIndex               string      `json:"supplyIndex"`
	BorrowIndex               string      `json:"borrowIndex"`
	SupplyInterestRateSeconds string      `json:"supplyInterestRateSeconds"`
	BorrowInterestRateSeconds string      `json:"borrowInterestRateSeconds"`
	TotalSupplyPar            string      `json:"totalSupplyPar"`
	TotalBorrowPar            string      `json:"totalBorrowPar"`
	LastIndexUpdateSeconds    string      `json:"lastIndexUpdateSeconds"`
	OraclePrice               string      `json:"oraclePrice"`
	CollateralRatio           string      `json:"collateralRatio"`
	MarginPremium             string      `json:"marginPremium"`
	SpreadPremium             string      `json:"spreadPremium"`
	CurrencyUUID              string      `json:"currencyUuid"`
	CreatedAt                 time.Time   `json:"createdAt"`
	UpdatedAt                 time.Time   `json:"updatedAt"`
	DeletedAt                 interface{} `json:"deletedAt"`
	Currency                  struct {
		UUID            string    `json:"uuid"`
		Symbol          string    `json:"symbol"`
		ContractAddress string    `json:"contractAddress"`
		Decimals        int       `json:"decimals"`
		CreatedAt       time.Time `json:"createdAt"`
		UpdatedAt       time.Time `json:"updatedAt"`
	} `json:"currency"`
	TotalSupplyAPR string `json:"totalSupplyAPR"`
	TotalBorrowAPR string `json:"totalBorrowAPR"`
	TotalSupplyAPY string `json:"totalSupplyAPY"`
	TotalBorrowAPY string `json:"totalBorrowAPY"`
	TotalSupplyWei string `json:"totalSupplyWei"`
	TotalBorrowWei string `json:"totalBorrowWei"`
}

type DYDXProtocol

type DYDXProtocol struct {
	// contains filtered or unexported fields
}

func NewDYDX

func NewDYDX(scraper *DefiScraper, protocol dia.DefiProtocol) *DYDXProtocol

func (*DYDXProtocol) UpdateRate

func (proto *DYDXProtocol) UpdateRate() error

func (*DYDXProtocol) UpdateState

func (proto *DYDXProtocol) UpdateState() error

type DeFIHelper

type DeFIHelper interface {
	UpdateRate() error
	UpdateState() error
}

type DefiScraper

type DefiScraper struct {
	// contains filtered or unexported fields
}

func SpawnDefiScraper

func SpawnDefiScraper(datastore models.Datastore, rateType string) *DefiScraper

SpawnDefiScraper returns a new DefiScraper initialized with default values. The instance is asynchronously scraping as soon as it is created.

func (*DefiScraper) Close

func (s *DefiScraper) Close() error

Close closes any existing API connections

func (*DefiScraper) RateChannel

func (s *DefiScraper) RateChannel() chan *dia.DefiRate

Channel returns a channel that can be used to receive rate information

func (*DefiScraper) StateChannel

func (s *DefiScraper) StateChannel() chan *dia.DefiProtocolState

func (*DefiScraper) UpdateRates

func (s *DefiScraper) UpdateRates(defiType string) error

UpdateRates calls the appropriate function corresponding to the rate type.

func (*DefiScraper) UpdateState

func (s *DefiScraper) UpdateState(defiType string) error

type DharmaProtocol

type DharmaProtocol struct {
	// contains filtered or unexported fields
}

func NewDHARMA

func NewDHARMA(scraper *DefiScraper, protocol dia.DefiProtocol) *DharmaProtocol

func (*DharmaProtocol) UpdateRate

func (proto *DharmaProtocol) UpdateRate() error

func (*DharmaProtocol) UpdateState

func (proto *DharmaProtocol) UpdateState() error

type ForTubeProtocol

type ForTubeProtocol struct {
	// contains filtered or unexported fields
}

func NewForTube

func NewForTube(scraper *DefiScraper, protocol dia.DefiProtocol) *ForTubeProtocol

func (*ForTubeProtocol) UpdateRate

func (proto *ForTubeProtocol) UpdateRate() error

func (*ForTubeProtocol) UpdateState

func (proto *ForTubeProtocol) UpdateState() error

type ForTubeRate

type ForTubeRate struct {
	SupplyRate float64
	BorrowRate float64
	Cash       *big.Int
	Decimal    uint8
	Symbol     string
}

type LendingPool

type LendingPool struct {
	ID                             int       `json:"id"`
	BlockNumber                    int       `json:"blockNumber"`
	DateTime                       time.Time `json:"dateTime"`
	AssetAddress                   string    `json:"assetAddress"`
	Symbol                         string    `json:"symbol"`
	BorrowRate                     string    `json:"borrowRate"`
	SupplyRate                     string    `json:"supplyRate"`
	TotalBorrowAmount              string    `json:"totalBorrowAmount"`
	TotalSupplyAmount              string    `json:"totalSupplyAmount"`
	UtilizationRate                string    `json:"utilizationRate"`
	Kind                           string    `json:"kind"`
	CreatedAt                      time.Time `json:"createdAt"`
	UpdatedAt                      time.Time `json:"updatedAt"`
	SevenDayAnnualizedRateOfReturn string    `json:"7dayAnnualizedRateOfReturn"`
	InsuranceAmount                string    `json:"InsuranceAmount"`
	LoansOriginatedAmount          string    `json:"loansOriginatedAmount"`
	SupplyAddedAmount              string    `json:"supplyAddedAmount"`
	OraclePrice                    string    `json:"oraclePrice"`
}

type MakerdaoProtocol

type MakerdaoProtocol struct {
	// contains filtered or unexported fields
}

func NewMakerdao

func NewMakerdao(scraper *DefiScraper, protocol dia.DefiProtocol) *MakerdaoProtocol

func (*MakerdaoProtocol) UpdateRate

func (proto *MakerdaoProtocol) UpdateRate() error

func (*MakerdaoProtocol) UpdateState

func (proto *MakerdaoProtocol) UpdateState() error

type NuoProtocol

type NuoProtocol struct {
	// contains filtered or unexported fields
}

func NewNuo

func NewNuo(scraper *DefiScraper, protocol dia.DefiProtocol) *NuoProtocol

func (*NuoProtocol) UpdateRate

func (proto *NuoProtocol) UpdateRate() error

func (*NuoProtocol) UpdateState

func (proto *NuoProtocol) UpdateState() error

type NuoRate

type NuoRate struct {
	Currency struct {
		ID               int    `json:"id"`
		Name             string `json:"name"`
		ShortName        string `json:"short_name"`
		ImageURL         string `json:"image_url"`
		BaseAddress      string `json:"base_address"`
		MaxTradeLeverage int    `json:"max_trade_leverage"`
		TradeBuffer      int    `json:"trade_buffer"`
		DecimalCount     int    `json:"decimal_count"`
	} `json:"currency"`
	TotalBalance               float64 `json:"total_balance"`
	TotalBalancePrimary        float64 `json:"total_balance_primary"`
	ActualBalance              float64 `json:"actual_balance"`
	ActualBalancePrimary       float64 `json:"actual_balance_primary"`
	ActiveReserveCount         string  `json:"active_reserve_count"`
	Last365DReturn             float64 `json:"last_365d_return"`
	Last30DReturnValue         float64 `json:"last_30d_return_value"`
	Last30DReturnValuePrimary  float64 `json:"last_30d_return_value_primary"`
	PotentialReturn            float64 `json:"potential_return"`
	PotentialReturnPrimary     float64 `json:"potential_return_primary"`
	LendRate                   float64 `json:"lend_rate"`
	ActiveLoanAmountSum        float64 `json:"active_loan_amount_sum"`
	ActiveLoanAmountSumPrimary float64 `json:"active_loan_amount_sum_primary"`
	BorrowRate                 float64 `json:"borrow_rate"`
}

type NuoResponse

type NuoResponse struct {
	Status string `json:"status"`
	Data   struct {
		Reserves []NuoRate `json:"reserves"`
	} `json:"data"`
}

type Portfolio

type Portfolio struct {
	ID                  string `json:"id"`
	LastUpdateTimestamp int    `json:"lastUpdateTimestamp"`
	LiquidityRate       string `json:"liquidityRate"`
	Name                string `json:"name"`
	Price               struct {
		ID string `json:"id"`
	} `json:"price"`
	StableBorrowRate   string `json:"stableBorrowRate"`
	VariableBorrowRate string `json:"variableBorrowRate"`
	TotalLiquidity     string `json:"totalLiquidity"`
}

type RAYPortfolio

type RAYPortfolio struct {
	Data struct {
		Portfolios []Portfolio `json:"portfolios"`
	} `json:"data"`
}

type RAYProtocol

type RAYProtocol struct {
	// contains filtered or unexported fields
}

func NewRAY

func NewRAY(scraper *DefiScraper, protocol dia.DefiProtocol) *RAYProtocol

func (*RAYProtocol) UpdateRate

func (proto *RAYProtocol) UpdateRate() error

func (*RAYProtocol) UpdateState

func (proto *RAYProtocol) UpdateState() error

type Reserve

type Reserve struct {
	ID                  string `json:"id"`
	LastUpdateTimestamp int    `json:"lastUpdateTimestamp"`
	LiquidityRate       string `json:"liquidityRate"`
	Symbol              string `json:"symbol"`
	AToken              struct {
		UnderlyingAssetDecimals int `json:"underlyingAssetDecimals"`
	}
	Price struct {
		ID         string `json:"id"`
		PriceInEth string `json:"priceInEth"`
	} `json:"price"`
	StableBorrowRate   string `json:"stableBorrowRate"`
	VariableBorrowRate string `json:"variableBorrowRate"`
	TotalLiquidity     string `json:"totalLiquidity"`
	Decimals           int    `json:"decimals"`
}

Directories

Path Synopsis
makerdao

Jump to

Keyboard shortcuts

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