All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
ListMarginCurrencyPairs | Get /margin/currency_pairs | List all supported currency pairs supported in margin trading |
GetMarginCurrencyPair | Get /margin/currency_pairs/{currency_pair} | Query one single margin currency pair |
ListFundingBook | Get /margin/funding_book | Order book of lending loans |
ListMarginAccounts | Get /margin/accounts | Margin account list |
ListMarginAccountBook | Get /margin/account_book | List margin account balance change history |
ListFundingAccounts | Get /margin/funding_accounts | Funding account list |
ListLoans | Get /margin/loans | List all loans |
CreateLoan | Post /margin/loans | Lend or borrow |
MergeLoans | Post /margin/merged_loans | Merge multiple lending loans |
GetLoan | Get /margin/loans/{loan_id} | Retrieve one single loan detail |
CancelLoan | Delete /margin/loans/{loan_id} | Cancel lending loan |
UpdateLoan | Patch /margin/loans/{loan_id} | Modify a loan |
ListLoanRepayments | Get /margin/loans/{loan_id}/repayment | List loan repayment records |
RepayLoan | Post /margin/loans/{loan_id}/repayment | Repay a loan |
ListLoanRecords | Get /margin/loan_records | List repayment records of a specific loan |
GetLoanRecord | Get /margin/loan_records/{loan_record_id} | Get one single loan record |
UpdateLoanRecord | Patch /margin/loan_records/{loan_record_id} | Modify a loan record |
GetAutoRepayStatus | Get /margin/auto_repay | Retrieve user auto repayment setting |
SetAutoRepay | Post /margin/auto_repay | Update user's auto repayment setting |
GetMarginTransferable | Get /margin/transferable | Get the max transferable amount for a specific margin currency |
GetMarginBorrowable | Get /margin/borrowable | Get the max borrowable amount for a specific margin currency |
ListCrossMarginCurrencies | Get /margin/cross/currencies | Currencies supported by cross margin. |
GetCrossMarginCurrency | Get /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin |
GetCrossMarginAccount | Get /margin/cross/accounts | Retrieve cross margin account |
ListCrossMarginAccountBook | Get /margin/cross/account_book | Retrieve cross margin account change history |
ListCrossMarginLoans | Get /margin/cross/loans | List cross margin borrow history |
CreateCrossMarginLoan | Post /margin/cross/loans | Create a cross margin borrow loan |
GetCrossMarginLoan | Get /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail |
ListCrossMarginRepayments | Get /margin/cross/repayments | Retrieve cross margin repayments |
RepayCrossMarginLoan | Post /margin/cross/repayments | Repay cross margin loan |
GetCrossMarginTransferable | Get /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency |
GetCrossMarginBorrowable | Get /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency |
[]MarginCurrencyPair ListMarginCurrencyPairs(ctx, )
List all supported currency pairs supported in margin trading
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.MarginApi.ListMarginCurrencyPairs(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]
MarginCurrencyPair GetMarginCurrencyPair(ctx, currencyPair)
Query one single margin currency pair
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Margin currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Margin currency pair
result, _, err := client.MarginApi.GetMarginCurrencyPair(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]
[]FundingBookItem ListFundingBook(ctx, currency)
Order book of lending loans
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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()
currency := "BTC" // string - Retrieve data of the specified currency
result, _, err := client.MarginApi.ListFundingBook(ctx, currency)
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]
[]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/v6"
)
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)
List margin account balance change history
Only transferals from and to margin account are provided for now. Time range allows 30 days at most
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 | List records related to specified currency only. If specified, `currency_pair` is also required. | |
currencyPair | optional.String | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | |
from | optional.Int64 | Time range beginning, default to 7 days before current time | |
to | optional.Int64 | Time range ending, default to current time | |
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 | Retrieve data of the specified currency |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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]
[]Loan ListLoans(ctx, status, side, optional)
List all loans
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
status | string | Loan status | |
side | string | Lend or borrow | |
optional | ListLoansOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListLoansOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currency | optional.String | Retrieve data of the specified currency | |
currencyPair | optional.String | Currency pair | |
sortBy | optional.String | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | |
reverseSort | optional.Bool | Whether to sort in descending order. Default to `true` | |
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 := "open" // string - Loan status
side := "lend" // string - Lend or borrow
result, _, err := client.MarginApi.ListLoans(ctx, status, side, 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]
Loan CreateLoan(ctx, loan)
Lend or borrow
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loan | Loan |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loan := gateapi.Loan{} // Loan -
result, _, err := client.MarginApi.CreateLoan(ctx, loan)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Loan MergeLoans(ctx, currency, ids)
Merge multiple lending loans
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency | |
ids | string | A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve data of the specified currency
ids := "123,234,345" // string - A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request
result, _, err := client.MarginApi.MergeLoans(ctx, currency, ids)
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]
Loan GetLoan(ctx, loanId, side)
Retrieve one single loan detail
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID | |
side | string | Lend or borrow |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
side := "lend" // string - Lend or borrow
result, _, err := client.MarginApi.GetLoan(ctx, loanId, side)
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]
Loan CancelLoan(ctx, loanId, currency)
Cancel lending loan
Only lent loans can be cancelled
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID | |
currency | string | Retrieve data of the specified currency |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
currency := "BTC" // string - Retrieve data of the specified currency
result, _, err := client.MarginApi.CancelLoan(ctx, loanId, currency)
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]
Loan UpdateLoan(ctx, loanId, loanPatch)
Modify a loan
Only auto_renew
modification is supported currently
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID | |
loanPatch | LoanPatch |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
loanPatch := gateapi.LoanPatch{} // LoanPatch -
result, _, err := client.MarginApi.UpdateLoan(ctx, loanId, loanPatch)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Repayment ListLoanRepayments(ctx, loanId)
List loan repayment records
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
result, _, err := client.MarginApi.ListLoanRepayments(ctx, loanId)
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]
Loan RepayLoan(ctx, loanId, repayRequest)
Repay a loan
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID | |
repayRequest | RepayRequest |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
repayRequest := gateapi.RepayRequest{} // RepayRequest -
result, _, err := client.MarginApi.RepayLoan(ctx, loanId, repayRequest)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]LoanRecord ListLoanRecords(ctx, loanId, optional)
List repayment records of a specific loan
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Loan ID | |
optional | ListLoanRecordsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListLoanRecordsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
status | optional.String | Loan record status | |
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Loan ID
result, _, err := client.MarginApi.ListLoanRecords(ctx, loanId, 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]
LoanRecord GetLoanRecord(ctx, loanRecordId, loanId)
Get one single loan record
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanRecordId | string | Loan record ID | |
loanId | string | Loan ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanRecordId := "12345" // string - Loan record ID
loanId := "12345" // string - Loan ID
result, _, err := client.MarginApi.GetLoanRecord(ctx, loanRecordId, loanId)
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]
LoanRecord UpdateLoanRecord(ctx, loanRecordId, loanPatch)
Modify a loan record
Only auto_renew
modification is supported currently
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanRecordId | string | Loan record ID | |
loanPatch | LoanPatch |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanRecordId := "12345" // string - Loan record ID
loanPatch := gateapi.LoanPatch{} // LoanPatch -
result, _, err := client.MarginApi.UpdateLoanRecord(ctx, loanRecordId, loanPatch)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AutoRepaySetting GetAutoRepayStatus(ctx, )
Retrieve user auto repayment setting
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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's auto repayment setting
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
status | string | New auto repayment status. `on` - enabled, `off` - disabled |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - New auto repayment status. `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 the max transferable amount for a specific margin currency
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency | |
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/v6"
)
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 - Retrieve data of the specified currency
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]
MarginBorrowable GetMarginBorrowable(ctx, currency, optional)
Get the max borrowable amount for a specific margin currency
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency | |
optional | GetMarginBorrowableOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetMarginBorrowableOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currencyPair | optional.String | Currency pair |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve data of the specified currency
result, _, err := client.MarginApi.GetMarginBorrowable(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]
[]CrossMarginCurrency ListCrossMarginCurrencies(ctx, )
Currencies supported by cross margin.
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.MarginApi.ListCrossMarginCurrencies(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]
CrossMarginCurrency GetCrossMarginCurrency(ctx, currency)
Retrieve detail of one single currency supported by cross margin
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Currency name |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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()
currency := "BTC" // string - Currency name
result, _, err := client.MarginApi.GetCrossMarginCurrency(ctx, currency)
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]
CrossMarginAccount GetCrossMarginAccount(ctx, )
Retrieve cross margin account
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.GetCrossMarginAccount(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]
[]CrossMarginAccountBook ListCrossMarginAccountBook(ctx, optional)
Retrieve cross margin account change history
Record time range cannot exceed 30 days
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | ListCrossMarginAccountBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListCrossMarginAccountBookOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currency | optional.String | Filter by currency | |
from | optional.Int64 | Time range beginning, default to 7 days before current time | |
to | optional.Int64 | Time range ending, default to current time | |
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
type_ | optional.String | Only retrieve changes of the specified type. All types will be returned if not specified. |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.ListCrossMarginAccountBook(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)
List cross margin borrow history
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
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. | |
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 | Filter by currency | |
limit | optional.Int32 | Maximum number of records to be 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/v6"
)
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.
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]
CrossMarginLoan CreateCrossMarginLoan(ctx, crossMarginLoan)
Create a cross margin borrow loan
Borrow amount cannot be less than currency minimum borrow amount
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
crossMarginLoan | CrossMarginLoan |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
crossMarginLoan := gateapi.CrossMarginLoan{} // CrossMarginLoan -
result, _, err := client.MarginApi.CreateCrossMarginLoan(ctx, crossMarginLoan)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginLoan GetCrossMarginLoan(ctx, loanId)
Retrieve single borrow loan detail
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
loanId | string | Borrow loan ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
loanId := "12345" // string - Borrow loan ID
result, _, err := client.MarginApi.GetCrossMarginLoan(ctx, loanId)
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
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
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 to be 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/v6"
)
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]
[]CrossMarginLoan RepayCrossMarginLoan(ctx, crossMarginRepayRequest)
Repay cross margin loan
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
crossMarginRepayRequest | CrossMarginRepayRequest |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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",
}
)
crossMarginRepayRequest := gateapi.CrossMarginRepayRequest{} // CrossMarginRepayRequest -
result, _, err := client.MarginApi.RepayCrossMarginLoan(ctx, crossMarginRepayRequest)
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: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginTransferable GetCrossMarginTransferable(ctx, currency)
Get the max transferable amount for a specific cross margin currency
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve data of the specified currency
result, _, err := client.MarginApi.GetCrossMarginTransferable(ctx, currency)
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]
CrossMarginBorrowable GetCrossMarginBorrowable(ctx, currency)
Get the max borrowable amount for a specific cross margin currency
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currency | string | Retrieve data of the specified currency |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve data of the specified currency
result, _, err := client.MarginApi.GetCrossMarginBorrowable(ctx, currency)
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]