client

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCollateralizationForSubaccounts

func CheckCollateralizationForSubaccounts(
	ctx context.Context,
	client clobtypes.QueryClient,
	subaccountIds []satypes.SubaccountId,
) (
	results []clobtypes.AreSubaccountsLiquidatableResponse_Result,
	err error,
)

CheckCollateralizationForSubaccounts queries a gRPC server using `AreSubaccountsLiquidatable` and returns a list of collateralization statuses for the given list of subaccount ids.

func GetAllSubaccounts

func GetAllSubaccounts(
	ctx context.Context,
	client satypes.QueryClient,
	limit uint64,
) (
	subaccounts []satypes.Subaccount,
	err error,
)

GetAllSubaccounts queries a gRPC server and returns a list of subaccounts and their balances and open positions.

func GetLiquidatableSubaccountIds added in v0.2.4

func GetLiquidatableSubaccountIds(
	ctx context.Context,
	client clobtypes.QueryClient,
	liqFlags flags.LiquidationFlags,
	subaccounts []satypes.Subaccount,
) (
	liquidatableSubaccountIds []satypes.SubaccountId,
	err error,
)

GetLiquidatableSubaccountIds verifies collateralization statuses of subaccounts with at least one open position and returns a list of unique and potentially liquidatable subaccount ids.

func RunLiquidationDaemonTaskLoop

func RunLiquidationDaemonTaskLoop(
	ctx context.Context,
	liqFlags flags.LiquidationFlags,
	subaccountQueryClient satypes.QueryClient,
	clobQueryClient clobtypes.QueryClient,
	liquidationServiceClient api.LiquidationServiceClient,
) error

RunLiquidationDaemonTaskLoop contains the logic to communicate with various gRPC services to find the liquidatable subaccount ids.

func SendLiquidatableSubaccountIds

func SendLiquidatableSubaccountIds(
	ctx context.Context,
	client api.LiquidationServiceClient,
	subaccountIds []satypes.SubaccountId,
) error

SendLiquidatableSubaccountIds sends a list of unique and potentially liquidatable subaccount ids to a gRPC server via `LiquidateSubaccounts`.

func Start

func Start(
	ctx context.Context,
	flags flags.DaemonFlags,
	logger log.Logger,
	grpcClient lib.GrpcClient,
) error

Start begins a job that periodically: 1) Queries a gRPC server for all subaccounts including their open positions. 2) Checks collateralization statuses of subaccounts with at least one open position. 3) Sends a list of subaccount ids that potentially need to be liquidated to the application.

Types

This section is empty.

Jump to

Keyboard shortcuts

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