All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| ListUniCurrencyPairs | Get /margin/uni/currency_pairs | List lending markets |
| GetUniCurrencyPair | Get /margin/uni/currency_pairs/{currency_pair} | Get lending market details |
| GetMarginUniEstimateRate | Get /margin/uni/estimate_rate | Estimate interest rate for isolated margin currencies |
| ListUniLoans | Get /margin/uni/loans | Query loans |
| CreateUniLoan | Post /margin/uni/loans | Borrow or repay |
| ListUniLoanRecords | Get /margin/uni/loan_records | Query loan records |
| ListUniLoanInterestRecords | Get /margin/uni/interest_records | Query interest deduction records |
| GetUniBorrowable | Get /margin/uni/borrowable | Query maximum borrowable amount by currency |
[]UniCurrencyPair ListUniCurrencyPairs(ctx, )
List lending markets
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()
result, _, err := client.MarginUniApi.ListUniCurrencyPairs(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)
}
}No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UniCurrencyPair GetUniCurrencyPair(ctx, currencyPair)
Get lending market details
| 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 := "AE_USDT" // string - Currency pair
result, _, err := client.MarginUniApi.GetUniCurrencyPair(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]
map[string]string GetMarginUniEstimateRate(ctx, currencies)
Estimate interest rate for isolated margin currencies
Interest rates change hourly based on lending depth, so completely accurate rates cannot be provided.
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| currencies | []string | Array of currency names to query, maximum 10 |
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",
}
)
currencies := []string{"[\"BTC\",\"GT\"]"} // []string - Array of currency names to query, maximum 10
result, _, err := client.MarginUniApi.GetMarginUniEstimateRate(ctx, currencies)
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)
}
}map[string]string
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]UniLoan ListUniLoans(ctx, optional)
Query loans
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListUniLoansOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListUniLoansOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | optional.String | Currency pair | |
| currency | optional.String | Query by specified currency name | |
| page | optional.Int32 | Page number | [default to 1] |
| limit | optional.Int32 | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [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.MarginUniApi.ListUniLoans(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]
CreateUniLoan(ctx, createUniLoan)
Borrow or repay
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| createUniLoan | CreateUniLoan |
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",
}
)
createUniLoan := gateapi.CreateUniLoan{} // CreateUniLoan -
result, _, err := client.MarginUniApi.CreateUniLoan(ctx, createUniLoan)
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]
[]UniLoanRecord ListUniLoanRecords(ctx, optional)
Query loan records
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListUniLoanRecordsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListUniLoanRecordsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| type_ | optional.String | Type: `borrow` - borrow, `repay` - repay | |
| currency | optional.String | Query by specified currency name | |
| currencyPair | optional.String | Currency pair | |
| page | optional.Int32 | Page number | [default to 1] |
| limit | optional.Int32 | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [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.MarginUniApi.ListUniLoanRecords(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]
[]UniLoanInterestRecord ListUniLoanInterestRecords(ctx, optional)
Query interest deduction records
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListUniLoanInterestRecordsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListUniLoanInterestRecordsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | optional.String | Currency pair | |
| currency | optional.String | Query by specified currency name | |
| page | optional.Int32 | Page number | [default to 1] |
| limit | optional.Int32 | Maximum number of records returned in a single list | [default to 100] |
| from | optional.Int64 | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) | |
| to | optional.Int64 | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp |
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.MarginUniApi.ListUniLoanInterestRecords(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]
MaxUniBorrowable GetUniBorrowable(ctx, currency, currencyPair)
Query maximum borrowable amount by currency
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| currency | string | Query by specified currency name | |
| 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",
}
)
currency := "BTC" // string - Query by specified currency name
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.MarginUniApi.GetUniBorrowable(ctx, currency, 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]