Documentation ¶
Index ¶
- type RyskV2APIClient
- func (RyskV2Client *RyskV2APIClient) ApproveSigner(params *types.ApproveRevokeSignerRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ApproveUSDC(ctx context.Context, amount *big.Int) (*geth_types.Transaction, error)
- func (RyskV2Client *RyskV2APIClient) CancelAllOpenOrders(product *types.Product) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) CancelOrder(params *types.CancelOrderRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) CancelOrderAndReplace(params *types.CancelOrderAndReplaceRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) DepositUSDC(ctx context.Context, amount *big.Int) (*geth_types.Transaction, error)
- func (RyskV2Client *RyskV2APIClient) Get24hrPriceChangeStatistics(product *types.Product) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetKlineData(params *types.KlineDataRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetPerpetualPosition(product *types.Product) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetPerpetualPositionAllProducts() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetProduct(symbol string) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetProductById(id int64) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) GetSpotBalances() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListApprovedSigners() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListOpenOrders(product *types.Product) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListOpenOrdersAllProducts() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListOrders(params *types.ListOrdersRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListOrdersAllProducts(ids []string) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ListProducts() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) NewOrder(params *types.NewOrderRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) OrderBook(params *types.OrderBookRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) RevokeSigner(params *types.ApproveRevokeSignerRequest) (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) ServerTime() (*http.Response, error)
- func (RyskV2Client *RyskV2APIClient) WaitTransaction(ctx context.Context, transaction *geth_types.Transaction) (*geth_types.Receipt, error)
- func (RyskV2Client *RyskV2APIClient) Withdraw(params *types.WithdrawRequest) (*http.Response, error)
- type RyskV2APIClientConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RyskV2APIClient ¶
type RyskV2APIClient struct { SubAccountId int64 // Subaccount ID. HttpClient *http.Client // HTTP client for making requests. EthClient types.IEthClient // Ethereum client for interacting with the blockchain. // contains filtered or unexported fields }
RyskV2APIClient is the main client for interacting with the RyskV2 API.
func NewRyskV2APIClient ¶
func NewRyskV2APIClient(config *RyskV2APIClientConfiguration) (*RyskV2APIClient, error)
NewRyskV2APIClient creates a new RyskV2APIClient instance. Initializes the client with the provided configuration.
Parameters:
- config: A pointer to RyskV2APIClientConfiguration containing the configuration settings.
Returns:
- A pointer to RyskV2APIClient.
- An error if initialization fails.
func (*RyskV2APIClient) ApproveSigner ¶
func (RyskV2Client *RyskV2APIClient) ApproveSigner(params *types.ApproveRevokeSignerRequest) (*http.Response, error)
ApproveSigner approves a Signer for a SubAccount. This operation allows the specified Signer to sign transactions on behalf of the SubAccount.
Params:
- params: An instance of types.ApproveRevokeSignerRequest containing the necessary parameters for approving the signer.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ApproveUSDC ¶
func (RyskV2Client *RyskV2APIClient) ApproveUSDC(ctx context.Context, amount *big.Int) (*geth_types.Transaction, error)
ApproveUSDC approves Rysk V2 to spend USDC on your behalf.
Parameters:
- ctx: The context.Context for the Ethereum transaction.
- amount: The amount of USDC tokens to approve, specified as a *big.Int.
Returns:
- A pointer to a geth_types.Transaction representing the Ethereum transaction.
- An error if the Ethereum transaction fails or encounters an issue.
func (*RyskV2APIClient) CancelAllOpenOrders ¶
func (RyskV2Client *RyskV2APIClient) CancelAllOpenOrders(product *types.Product) (*http.Response, error)
CancelAllOpenOrders cancels all active orders on a specific product for the SubAccount.
Params:
- product: The product for which all active orders should be canceled.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) CancelOrder ¶
func (RyskV2Client *RyskV2APIClient) CancelOrder(params *types.CancelOrderRequest) (*http.Response, error)
CancelOrder cancels an active order on the SubAccount.
Params:
- params: An instance of types.CancelOrderRequest containing the necessary parameters to identify the order to cancel.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) CancelOrderAndReplace ¶
func (RyskV2Client *RyskV2APIClient) CancelOrderAndReplace(params *types.CancelOrderAndReplaceRequest) (*http.Response, error)
CancelOrderAndReplace cancels an order and creates a new order on the SubAccount.
Params:
- params: An instance of types.CancelOrderAndReplaceRequest containing the necessary parameters to identify the order to cancel and the new order parameters.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) DepositUSDC ¶
func (RyskV2Client *RyskV2APIClient) DepositUSDC(ctx context.Context, amount *big.Int) (*geth_types.Transaction, error)
DepositUSDC sends USDC to Rysk V2.
Parameters:
- ctx: The context.Context for the Ethereum transaction.
- amount: The amount of USDC tokens to deposit, specified as a *big.Int.
Returns:
- A pointer to a geth_types.Transaction representing the Ethereum transaction.
- An error if the Ethereum transaction fails or encounters an issue.
func (*RyskV2APIClient) Get24hrPriceChangeStatistics ¶
func (RyskV2Client *RyskV2APIClient) Get24hrPriceChangeStatistics(product *types.Product) (*http.Response, error)
Get24hrPriceChangeStatistics returns 24-hour rolling window price change statistics. These statistics do not reflect the UTC day, but rather a 24-hour rolling window for the previous 24 hours. If no `Product` is provided, ticker data for all assets will be returned.
Parameters:
- product: A pointer to a Product struct for which the statistics are being retrieved. If nil, ticker data for all assets will be returned.
Returns:
- A pointer to an http.Response containing the response from the server.
- An error if the request fails.
func (*RyskV2APIClient) GetKlineData ¶
func (RyskV2Client *RyskV2APIClient) GetKlineData(params *types.KlineDataRequest) (*http.Response, error)
GetKlineData retrieves Kline/Candlestick bars for a symbol based on the provided parameters.
Parameters:
- params: A pointer to a KlineDataRequest struct containing the parameters for the request, including symbol, interval (timeframe), startTime, and optional endTime.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) GetPerpetualPosition ¶
func (RyskV2Client *RyskV2APIClient) GetPerpetualPosition(product *types.Product) (*http.Response, error)
GetPerpetualPosition retrieves the perpetual position for a specific product and SubAccount.
Parameters:
- product: The product for which the perpetual position is requested.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) GetPerpetualPositionAllProducts ¶
func (RyskV2Client *RyskV2APIClient) GetPerpetualPositionAllProducts() (*http.Response, error)
GetPerpetualPositionAllProducts retrieves the perpetual position for all products for a SubAccount.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) GetProduct ¶
func (RyskV2Client *RyskV2APIClient) GetProduct(symbol string) (*http.Response, error)
GetProduct returns details for a specific product by its symbol.
Parameters:
- symbol: The symbol of the product for which details are being retrieved.
Returns:
- A pointer to an http.Response containing the response from the server with product details.
- An error if the request fails.
func (*RyskV2APIClient) GetProductById ¶
func (RyskV2Client *RyskV2APIClient) GetProductById(id int64) (*http.Response, error)
GetProductById retrieves details for a specific product by its unique identifier.
Parameters:
- id: The ID of the product.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) GetSpotBalances ¶
func (RyskV2Client *RyskV2APIClient) GetSpotBalances() (*http.Response, error)
GetSpotBalances retrieves spot balances for the SubAccount.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListApprovedSigners ¶
func (RyskV2Client *RyskV2APIClient) ListApprovedSigners() (*http.Response, error)
ListApprovedSigners retrieves a list of all approved signers for a specific `SubAccount`.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListOpenOrders ¶
ListOpenOrders retrieves all open orders on the `SubAccount` for a specific product.
Parameters:
- product: A pointer to a `types.Product` struct representing the product for which open orders are to be retrieved.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListOpenOrdersAllProducts ¶
func (RyskV2Client *RyskV2APIClient) ListOpenOrdersAllProducts() (*http.Response, error)
ListOpenOrdersAllProducts retrieves all open orders on the `SubAccount` for a all products.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListOrders ¶
func (RyskV2Client *RyskV2APIClient) ListOrders(params *types.ListOrdersRequest) (*http.Response, error)
ListOrders retrieves all orders on the `SubAccount` for a specific product.
Parameters:
- params: A pointer to a `types.ListOrdersRequest` struct containing parameters for listing orders.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListOrdersAllProducts ¶
func (RyskV2Client *RyskV2APIClient) ListOrdersAllProducts(ids []string) (*http.Response, error)
ListOrders retrieves all orders on the `SubAccount` for a specific product.
Parameters:
- params: A pointer to a `types.ListOrdersRequest` struct containing parameters for listing orders.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ListProducts ¶
func (RyskV2Client *RyskV2APIClient) ListProducts() (*http.Response, error)
ListProducts retrieves a list of products available for trading on the platform.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) NewOrder ¶
func (RyskV2Client *RyskV2APIClient) NewOrder(params *types.NewOrderRequest) (*http.Response, error)
NewOrder creates a new order on the SubAccount.
Params:
- params: An instance of types.NewOrderRequest containing the order parameters, including the order type (limit/market), quantity, side (buy/sell), price, and symbol.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) OrderBook ¶
func (RyskV2Client *RyskV2APIClient) OrderBook(params *types.OrderBookRequest) (*http.Response, error)
OrderBook retrieves the order book (bids and asks) for a specific market.
Parameters:
- params: A pointer to an OrderBookRequest struct containing the parameters for the request.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) RevokeSigner ¶
func (RyskV2Client *RyskV2APIClient) RevokeSigner(params *types.ApproveRevokeSignerRequest) (*http.Response, error)
RevokeSigner revokes a Signer for a SubAccount. This operation disables the specified Signer from signing transactions on behalf of the SubAccount.
Params:
- params: An instance of types.ApproveRevokeSignerRequest containing the necessary parameters for revoking the signer.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) ServerTime ¶
func (RyskV2Client *RyskV2APIClient) ServerTime() (*http.Response, error)
ServerTime retrieves the current server time from the API.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
func (*RyskV2APIClient) WaitTransaction ¶
func (RyskV2Client *RyskV2APIClient) WaitTransaction(ctx context.Context, transaction *geth_types.Transaction) (*geth_types.Receipt, error)
WaitTransaction waits for a transaction to be mined and returns its receipt.
Parameters:
- ctx: The context.Context for the Ethereum transaction.
- transaction: The Ethereum transaction (*geth_types.Transaction) to monitor.
Returns:
- A pointer to a geth_types.Receipt containing the transaction receipt once the transaction is mined.
- An error if the transaction fails to be mined or encounters an issue.
func (*RyskV2APIClient) Withdraw ¶
func (RyskV2Client *RyskV2APIClient) Withdraw(params *types.WithdrawRequest) (*http.Response, error)
Withdraw initiates a withdrawal of USDC from the Rysk V2 account.
Params:
- params: An instance of types.WithdrawRequest containing the withdrawal parameters, including the withdrawal amount and destination address.
Returns:
- A pointer to an http.Response containing the response from the API call.
- An error if the API call fails or if the response is not as expected.
type RyskV2APIClientConfiguration ¶
type RyskV2APIClientConfiguration struct { Env types.Environment // `constants.ENVIRONMENT_TESTNET` or `constants.ENVIRONMENT_MAINNET`. PrivateKey string // Private key as a string, e.g., `0x2638b4...` or `2638b4...`. RpcUrl string // RPC URL of the Ethereum client. SubAccountId uint8 // ID of the subaccount to use. }
RyskV2APIClientConfiguration holds the configuration for the RyskV2 API client.