Documentation ¶
Index ¶
- type IPerpsv3
- type Perpsv3
- func (p *Perpsv3) Close()
- func (p *Perpsv3) Config() *config.PerpsvConfig
- func (p *Perpsv3) FormatAccount(id *big.Int) (*models.Account, error)
- func (p *Perpsv3) FormatAccounts() ([]*models.Account, error)
- func (p *Perpsv3) FormatAccountsLimit(limit uint64) ([]*models.Account, error)
- func (p *Perpsv3) GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error)
- func (p *Perpsv3) ListenLiquidations() (*events.LiquidationSubscription, error)
- func (p *Perpsv3) ListenMarketUpdates() (*events.MarketUpdateSubscription, error)
- func (p *Perpsv3) ListenOrders() (*events.OrderSubscription, error)
- func (p *Perpsv3) ListenTrades() (*events.TradeSubscription, error)
- func (p *Perpsv3) RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error)
- func (p *Perpsv3) RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error)
- func (p *Perpsv3) RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error)
- func (p *Perpsv3) RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)
- func (p *Perpsv3) RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPerpsv3 ¶
type IPerpsv3 interface { // RetrieveTrades is used to get logs from the "OrderSettled" event perps market contract within given block range // - use 0 for fromBlock to use default value of a first contract block // - use nil for toBlock to use default value of a last blockchain block RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error) // RetrieveOrders is used to get logs from the "OrderCommitted" event perps market contract within given block range // - use 0 for fromBlock to use default value of a first contract block // - use nil for toBlock to use default value of a last blockchain block RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error) // RetrieveMarketUpdates is used to get logs from the "MarketUpdated" event perps market contract within given block // range // - use 0 for fromBlock to use default value of a first contract block // - use nil for toBlock to use default value of a last blockchain block RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error) // RetrieveLiquidations is used to get logs from the "PositionLiquidated" event perps market contract within given block // range // - use 0 for fromBlock to use default value of a first contract block // - use nil for toBlock to use default value of a last blockchain block RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error) // RetrieveLiquidationsLimit is used to get all "PositionLiquidated" events and their additional data from the contract // with given block search limit. For most public RPC providers the value for limit is 20 000 blocks RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error) // ListenTrades is used to subscribe on the contract "OrderSettled" event. The goroutine will return events on the // TradesChan chanel and errors on the ErrChan chanel. // To close the subscription use events.TradeSubscription `Close` function ListenTrades() (*events.TradeSubscription, error) // ListenOrders is used to subscribe on the contract "OrderCommitted" event. The goroutine will return events on the // OrdersChan chanel and errors on the ErrChan chanel. // To close the subscription use events.OrderSubscription `Close` function ListenOrders() (*events.OrderSubscription, error) // ListenMarketUpdates is used to subscribe on the contract "MarketUpdated" event. The goroutine will return events // on the MarketUpdateChan chanel and errors on the ErrChan chanel. // To close the subscription use events.MarketUpdateSubscription `Close` function ListenMarketUpdates() (*events.MarketUpdateSubscription, error) // ListenLiquidations is used to subscribe on the contract "PositionLiquidated" event. The goroutine will return events // on the LiquidationsChan chanel and errors on the ErrChan chanel. // To close the subscription use events.LiquidationSubscription `Close` function ListenLiquidations() (*events.LiquidationSubscription, error) // GetPosition is used to get position data struct from latest block with given params // Function can return contract error if market ID is invalid GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error) // FormatAccount is used to get account, and it's additional data from the contract by given account id FormatAccount(id *big.Int) (*models.Account, error) // FormatAccounts is used to get all accounts and their additional data from the contract FormatAccounts() ([]*models.Account, error) // FormatAccountsLimit is used to get all accounts and their additional data from the contract with given block search // limit. For most public RPC providers the value for limit is 20 000 blocks FormatAccountsLimit(limit uint64) ([]*models.Account, error) // Config is used to get current lib config Config() *config.PerpsvConfig // Close used to stop the lib work Close() }
IPerpsv3 is an interface for perpsv3 lib
type Perpsv3 ¶
type Perpsv3 struct {
// contains filtered or unexported fields
}
Perpsv3 is a main perpsv3 lib object, it is implementing IPerpsv3 interface
func (*Perpsv3) Config ¶ added in v0.0.2
func (p *Perpsv3) Config() *config.PerpsvConfig
func (*Perpsv3) FormatAccount ¶ added in v0.1.2
func (*Perpsv3) FormatAccounts ¶ added in v0.1.2
func (*Perpsv3) FormatAccountsLimit ¶ added in v0.1.2
func (*Perpsv3) GetPosition ¶ added in v0.0.2
func (*Perpsv3) ListenLiquidations ¶ added in v0.1.3
func (p *Perpsv3) ListenLiquidations() (*events.LiquidationSubscription, error)
func (*Perpsv3) ListenMarketUpdates ¶ added in v0.1.1
func (p *Perpsv3) ListenMarketUpdates() (*events.MarketUpdateSubscription, error)
func (*Perpsv3) ListenOrders ¶ added in v0.1.0
func (p *Perpsv3) ListenOrders() (*events.OrderSubscription, error)
func (*Perpsv3) ListenTrades ¶
func (p *Perpsv3) ListenTrades() (*events.TradeSubscription, error)
func (*Perpsv3) RetrieveLiquidations ¶ added in v0.1.3
func (*Perpsv3) RetrieveLiquidationsLimit ¶ added in v0.1.3
func (p *Perpsv3) RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error)
func (*Perpsv3) RetrieveMarketUpdates ¶ added in v0.1.1
func (*Perpsv3) RetrieveOrders ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.