Documentation ¶
Index ¶
- Variables
- type APIEndpoint
- type ApproveRevokeSignerRequest
- type CancelOrderAndReplaceRequest
- type CancelOrderRequest
- type Environment
- type IEthClient
- type IHTTPClient
- type IWSConnection
- type Interval
- type KlineDataRequest
- type Limit
- type ListOrdersRequest
- type MarginAsset
- type NewOrderRequest
- type OrderBookRequest
- type OrderType
- type PrimaryType
- type Product
- type TimeInForce
- type WSMethod
- type WebsocketError
- type WebsocketRequest
- type WebsocketResponse
- type WithdrawRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var EIP712_TYPES = apitypes.Types{
"EIP712Domain": {
{
Name: "name",
Type: "string",
},
{
Name: "version",
Type: "string",
},
{
Name: "chainId",
Type: "uint256",
},
{
Name: "verifyingContract",
Type: "address",
},
},
"LoginMessage": {
{
Name: "account",
Type: "address",
},
{
Name: "message",
Type: "string",
},
{
Name: "timestamp",
Type: "uint64",
},
},
"Order": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "productId",
Type: "uint32",
},
{
Name: "isBuy",
Type: "bool",
},
{
Name: "orderType",
Type: "uint8",
},
{
Name: "timeInForce",
Type: "uint8",
},
{
Name: "expiration",
Type: "uint64",
},
{
Name: "price",
Type: "uint128",
},
{
Name: "quantity",
Type: "uint128",
},
{
Name: "nonce",
Type: "uint64",
},
},
"CancelOrders": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "productId",
Type: "uint32",
},
},
"CancelOrder": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "productId",
Type: "uint32",
},
{
Name: "orderId",
Type: "string",
},
},
"ApproveSigner": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "approvedSigner",
Type: "address",
},
{
Name: "isApproved",
Type: "bool",
},
{
Name: "nonce",
Type: "uint64",
},
},
"Deposit": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "asset",
Type: "address",
},
{
Name: "quantity",
Type: "uint256",
},
{
Name: "nonce",
Type: "uint64",
},
},
"Withdraw": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
{
Name: "asset",
Type: "address",
},
{
Name: "quantity",
Type: "uint128",
},
{
Name: "nonce",
Type: "uint64",
},
},
"SignedAuthentication": {
{
Name: "account",
Type: "address",
},
{
Name: "subAccountId",
Type: "uint8",
},
},
"Referral": {
{
Name: "account",
Type: "address",
},
{
Name: "code",
Type: "string",
},
},
}
Functions ¶
This section is empty.
Types ¶
type APIEndpoint ¶
type APIEndpoint string
type CancelOrderAndReplaceRequest ¶
type CancelOrderAndReplaceRequest struct { IdToCancel string // ID of the order to be replaced. NewOrder *NewOrderRequest // The new order details to be used in the replacement. }
type CancelOrderRequest ¶
type Environment ¶
type Environment string
type IEthClient ¶
type IEthClient interface { PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) SuggestGasPrice(ctx context.Context) (*big.Int, error) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) NetworkID(ctx context.Context) (*big.Int, error) SendTransaction(ctx context.Context, tx *types.Transaction) error TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) }
type IWSConnection ¶
type KlineDataRequest ¶
type KlineDataRequest struct { Product *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`. Interval Interval // The interval. Can be `constants.INTERVAL_M1`, `constants.INTERVAL_5M`, `constants.INTERVAL_15M`, `constants.INTERVAL_30M`, `constants.INTERVAL_1H`, `constants.INTERVAL_2H`, `constants.INTERVAL_4H`, `constants.INTERVAL_8H`, `constants.INTERVAL_1D`, `constants.INTERVAL_3D` or `constants.INTERVAL_1W`. StartTime int64 // Start timestamp in ms. EndTime int64 // End timestamp in ms. Limit int64 // Number of values to retrieve (max 1000). }
type ListOrdersRequest ¶
type ListOrdersRequest struct { Product *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`. Ids []string // IDs of specific orders you would like to retrieve. StartTime int64 // The start time. Ignored for REST api requests. EndTime int64 // The end time. Ignored for REST api requests. Limit int64 // The limit. Ignored for REST api requests. }
type MarginAsset ¶
type MarginAsset string
type NewOrderRequest ¶
type NewOrderRequest struct { Product *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`. IsBuy bool // Whether the account is buying or selling. OrderType OrderType // The order type. Can be `constants.ORDER_TYPE_LIMIT`, `constants.ORDER_TYPE_LIMIT_MAKER`, `constants.ORDER_TYPE_MARKET`, `constants.ORDER_TYPE_STOP_LOSS`, `constants.ORDER_TYPE_STOP_LOSS_LIMIT`, `constants.ORDER_TYPE_TAKE_PROFIT` or `constants.ORDER_TYPE_TAKE_PROFIT_LIMIT`. TimeInForce TimeInForce // Order time in force. Can be `constants.TIME_IN_FORCE_GTC`, `constants.TIME_IN_FORCE_FOK` or `constants.TIME_IN_FORCE_IOC`. Price string // Price in wei (e18). Quantity string // Quantity in wei (e18). Expiration int64 // UNIX timestamp (in ms) after which the order is no longer active. Nonce int64 // The nonce. Suggest using the current UNIX timestamp in milliseconds. }
type OrderBookRequest ¶
type OrderBookRequest struct { Product *Product // The product. Can be `constants.PRODUCT_ETH_PERP`, `constants.PRODUCT_BTC_PERP` or `constants.PRODUCT_ETH_PERP`. Granularity int64 // The number of decimals to remove from prices. Limit Limit // The number of bids and asks to retrieve. Can be `constants.FIVE`, `constants.TEN` or `constants.TWENTY`. }
type PrimaryType ¶
type PrimaryType string
type TimeInForce ¶
type TimeInForce int64
type WebsocketError ¶
type WebsocketRequest ¶
type WebsocketResponse ¶
type WebsocketResponse struct { JsonRPC string `json:"jsonrpc"` ID string `json:"id" binding:"required"` Success bool `json:"success" binding:"required"` Result interface{} `json:"result,omitempty"` Error *WebsocketError `json:"error,omitempty"` }
type WithdrawRequest ¶
Click to show internal directories.
Click to hide internal directories.