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) GetAvailableMargin(accountId *big.Int) (*big.Int, error)
- func (p *Perpsv3) GetFoundingRate(marketId *big.Int) (*big.Int, error)
- func (p *Perpsv3) GetMarketIDs() ([]*big.Int, error)
- func (p *Perpsv3) GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error)
- func (p *Perpsv3) GetMarketSummary(marketID *big.Int) (*models.MarketSummary, 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) ListenMarketUpdatesBig() (*events.MarketUpdateSubscriptionBig, 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) RetrieveMarketUpdatesBig(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdateBig, error)
- func (p *Perpsv3) RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, error)
- func (p *Perpsv3) RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)
- func (p *Perpsv3) RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)
- func (p *Perpsv3) RetrieveOrdersLimit(limit uint64) ([]*models.Order, error)
- func (p *Perpsv3) RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)
- func (p *Perpsv3) RetrieveTradesLimit(limit 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) // RetrieveTradesLimit is used to get all "OrderSettled" events and their additional data from the contract // with given block search limit. If given limit is 0 function will set default value to 20 000 blocks RetrieveTradesLimit(limit 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) // RetrieveOrdersLimit is used to get all "OrderCommitted" events and their additional data from the contract // with given block search limit. If given limit is 0 function will set default value to 20 000 blocks RetrieveOrdersLimit(limit 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) // RetrieveMarketUpdatesBig 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 // It will return a MarketUpdateBig model with big.Int values RetrieveMarketUpdatesBig(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdateBig, error) // RetrieveMarketUpdatesLimit is used to get all "MarketUpdated" events and their additional data from the contract // with given block search limit. If given limit is 0 function will set default value to 20 000 blocks RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error) // RetrieveMarketUpdatesBigLimit is used to get all "MarketUpdated" events and their additional data from the contract // with given block search limit. If given limit is 0 function will set default value to 20 000 blocks // It will return a MarketUpdateBig model with big.Int values RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, 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) // ListenMarketUpdatesBig 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 ListenMarketUpdatesBig() (*events.MarketUpdateSubscriptionBig, 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) // GetMarketMetadata is used to get market metadata by given market ID. Given market id cannot be nil and should exist // in the smart contract GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error) // GetMarketSummary is used to get market summary by given market ID. Given market id cannot be nil GetMarketSummary(marketID *big.Int) (*models.MarketSummary, error) // GetMarketIDs is used to get market IDs from the smart contract GetMarketIDs() ([]*big.Int, error) // GetFoundingRate is used to get current market founding rate by given market ID GetFoundingRate(marketId *big.Int) (*big.Int, error) // GetAvailableMargin is used to get available margin for given account ID GetAvailableMargin(accountId *big.Int) (*big.Int, 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) GetAvailableMargin ¶ added in v0.1.15
func (*Perpsv3) GetFoundingRate ¶ added in v0.1.12
func (*Perpsv3) GetMarketMetadata ¶ added in v0.1.6
func (*Perpsv3) GetMarketSummary ¶ added in v0.1.7
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) ListenMarketUpdatesBig ¶ added in v0.1.9
func (p *Perpsv3) ListenMarketUpdatesBig() (*events.MarketUpdateSubscriptionBig, 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) RetrieveMarketUpdatesBig ¶ added in v0.1.8
func (*Perpsv3) RetrieveMarketUpdatesBigLimit ¶ added in v0.1.8
func (p *Perpsv3) RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, error)
func (*Perpsv3) RetrieveMarketUpdatesLimit ¶ added in v0.1.4
func (p *Perpsv3) RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)
func (*Perpsv3) RetrieveOrders ¶ added in v0.1.0
func (*Perpsv3) RetrieveOrdersLimit ¶ added in v0.1.4
func (*Perpsv3) RetrieveTrades ¶
Click to show internal directories.
Click to hide internal directories.