All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| ListMarginAccounts | Get /margin/accounts | Margin account list |
| ListMarginAccountBook | Get /margin/account_book | Query margin account balance change history |
| ListFundingAccounts | Get /margin/funding_accounts | Funding account list |
| GetAutoRepayStatus | Get /margin/auto_repay | Query user auto repayment settings |
| SetAutoRepay | Post /margin/auto_repay | Update user auto repayment settings |
| GetMarginTransferable | Get /margin/transferable | Get maximum transferable amount for isolated margin |
| GetUserMarginTier | Get /margin/user/loan_margin_tiers | Query user's own leverage lending tiers in current market |
| GetMarketMarginTier | Get /margin/loan_margin_tiers | Query current market leverage lending tiers |
| SetUserMarketLeverage | Post /margin/leverage/user_market_setting | Set user market leverage multiplier |
| ListMarginUserAccount | Get /margin/user/account | Query user's isolated margin account list |
| ListCrossMarginLoans | Get /margin/cross/loans | Query cross margin borrow history (deprecated) |
| ListCrossMarginRepayments | Get /margin/cross/repayments | Retrieve cross margin repayments. (deprecated) |
[]MarginAccount ListMarginAccounts(ctx, optional)
Margin account list
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListMarginAccountsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMarginAccountsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | optional.String | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.ListMarginAccounts(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MarginAccountBook ListMarginAccountBook(ctx, optional)
Query margin account balance change history
Currently only provides transfer history to and from margin accounts. Query time range cannot exceed 30 days
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListMarginAccountBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMarginAccountBookOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | optional.String | Query history for specified currency. If `currency` is specified, `currency_pair` must also be specified. | |
| currencyPair | optional.String | Specify margin account currency pair. Used in combination with `currency`. Ignored if `currency` is not specified | |
| type_ | optional.String | Query by specified account change type. If not specified, all change types will be included. | |
| from | optional.Int64 | Start timestamp for the query | |
| to | optional.Int64 | End timestamp for the query, defaults to current time if not specified | |
| page | optional.Int32 | Page number | [default to 1] |
| limit | optional.Int32 | Maximum number of records returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.ListMarginAccountBook(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FundingAccount ListFundingAccounts(ctx, optional)
Funding account list
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListFundingAccountsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFundingAccountsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | optional.String | Query by specified currency name |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.ListFundingAccounts(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AutoRepaySetting GetAutoRepayStatus(ctx, )
Query user auto repayment settings
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.GetAutoRepayStatus(ctx)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AutoRepaySetting SetAutoRepay(ctx, status)
Update user auto repayment settings
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| status | string | Whether to enable auto repayment: `on` - enabled, `off` - disabled |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
status := "on" // string - Whether to enable auto repayment: `on` - enabled, `off` - disabled
result, _, err := client.MarginApi.SetAutoRepay(ctx, status)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MarginTransferable GetMarginTransferable(ctx, currency, optional)
Get maximum transferable amount for isolated margin
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| currency | string | Query by specified currency name | |
| optional | GetMarginTransferableOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetMarginTransferableOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | optional.String | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
currency := "BTC" // string - Query by specified currency name
result, _, err := client.MarginApi.GetMarginTransferable(ctx, currency, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MarginLeverageTier GetUserMarginTier(ctx, currencyPair)
Query user's own leverage lending tiers in current market
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| currencyPair | string | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.MarginApi.GetUserMarginTier(ctx, currencyPair)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MarginLeverageTier GetMarketMarginTier(ctx, currencyPair)
Query current market leverage lending tiers
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| currencyPair | string | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.MarginApi.GetMarketMarginTier(ctx, currencyPair)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SetUserMarketLeverage(ctx, marginMarketLeverage)
Set user market leverage multiplier
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| marginMarketLeverage | MarginMarketLeverage |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
marginMarketLeverage := gateapi.MarginMarketLeverage{} // MarginMarketLeverage -
result, _, err := client.MarginApi.SetUserMarketLeverage(ctx, marginMarketLeverage)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}(empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MarginAccount ListMarginUserAccount(ctx, optional)
Query user's isolated margin account list
Supports querying risk ratio isolated accounts and margin ratio isolated accounts
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListMarginUserAccountOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMarginUserAccountOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | optional.String | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.ListMarginUserAccount(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]CrossMarginLoan ListCrossMarginLoans(ctx, status, optional)
Query cross margin borrow history (deprecated)
Sorted by creation time in descending order by default. Set reverse=false for ascending order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| status | int32 | Filter by status. Supported values are 2 and 3. (deprecated.) | |
| optional | ListCrossMarginLoansOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListCrossMarginLoansOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | optional.String | Query by specified currency, includes all currencies if not specified | |
| limit | optional.Int32 | Maximum number of records returned in a single list | [default to 100] |
| offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
| reverse | optional.Bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [default to true] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
status := 56 // int32 - Filter by status. Supported values are 2 and 3. (deprecated.)
result, _, err := client.MarginApi.ListCrossMarginLoans(ctx, status, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]CrossMarginRepayment ListCrossMarginRepayments(ctx, optional)
Retrieve cross margin repayments. (deprecated)
Sorted by creation time in descending order by default. Set reverse=false for ascending order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListCrossMarginRepaymentsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListCrossMarginRepaymentsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | optional.String | ||
| loanId | optional.String | ||
| limit | optional.Int32 | Maximum number of records returned in a single list | [default to 100] |
| offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
| reverse | optional.Bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [default to true] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.MarginApi.ListCrossMarginRepayments(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]