Skip to content

Latest commit

 

History

History
741 lines (536 loc) · 21.8 KB

File metadata and controls

741 lines (536 loc) · 21.8 KB

CollateralLoanApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
ListCollateralLoanOrders Get /loan/collateral/orders Query collateral loan order list
CreateCollateralLoan Post /loan/collateral/orders Place collateral loan order
GetCollateralLoanOrderDetail Get /loan/collateral/orders/{order_id} Query single order details
RepayCollateralLoan Post /loan/collateral/repay Collateral loan repayment
ListRepayRecords Get /loan/collateral/repay_records Query collateral loan repayment records
ListCollateralRecords Get /loan/collateral/collaterals Query collateral adjustment records
OperateCollateral Post /loan/collateral/collaterals Increase or redeem collateral
GetUserTotalAmount Get /loan/collateral/total_amount Query user's total borrowing and collateral amount
GetUserLtvInfo Get /loan/collateral/ltv Query user's collateralization ratio and remaining borrowable currencies
ListCollateralCurrencies Get /loan/collateral/currencies Query supported borrowing and collateral currencies

ListCollateralLoanOrders

[]CollateralOrder ListCollateralLoanOrders(ctx, optional)

Query collateral loan order list

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional ListCollateralLoanOrdersOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListCollateralLoanOrdersOpts struct

Name Type Description Notes
page optional.Int32 Page number [default to 1]
limit optional.Int32 Maximum number of records returned in a single list [default to 100]
collateralCurrency optional.String Collateral currency
borrowCurrency optional.String Borrowed currency

Example

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.CollateralLoanApi.ListCollateralLoanOrders(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)
    }
}

Return type

[]CollateralOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateCollateralLoan

OrderResp CreateCollateralLoan(ctx, createCollateralOrder)

Place collateral loan order

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
createCollateralOrder CreateCollateralOrder

Example

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",
                             }
                            )
    createCollateralOrder := gateapi.CreateCollateralOrder{} // CreateCollateralOrder - 
    
    result, _, err := client.CollateralLoanApi.CreateCollateralLoan(ctx, createCollateralOrder)
    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)
    }
}

Return type

OrderResp

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetCollateralLoanOrderDetail

CollateralOrder GetCollateralLoanOrderDetail(ctx, orderId)

Query single order details

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
orderId int64 Order ID returned when order is successfully created

Example

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",
                             }
                            )
    orderId := 100001 // int64 - Order ID returned when order is successfully created
    
    result, _, err := client.CollateralLoanApi.GetCollateralLoanOrderDetail(ctx, orderId)
    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)
    }
}

Return type

CollateralOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepayCollateralLoan

RepayResp RepayCollateralLoan(ctx, repayLoan)

Collateral loan repayment

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repayLoan RepayLoan

Example

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",
                             }
                            )
    repayLoan := gateapi.RepayLoan{} // RepayLoan - 
    
    result, _, err := client.CollateralLoanApi.RepayCollateralLoan(ctx, repayLoan)
    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)
    }
}

Return type

RepayResp

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListRepayRecords

[]RepayRecord ListRepayRecords(ctx, source, optional)

Query collateral loan repayment records

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
source string Operation type: repay - Regular repayment, liquidate - Liquidation
optional ListRepayRecordsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListRepayRecordsOpts struct

Name Type Description Notes
borrowCurrency optional.String Borrowed currency
collateralCurrency optional.String Collateral currency
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 for the query
to optional.Int64 End timestamp for the query, defaults to current time if not specified

Example

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",
                             }
                            )
    source := "repay" // string - Operation type: repay - Regular repayment, liquidate - Liquidation
    
    result, _, err := client.CollateralLoanApi.ListRepayRecords(ctx, source, 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)
    }
}

Return type

[]RepayRecord

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCollateralRecords

[]CollateralRecord ListCollateralRecords(ctx, optional)

Query collateral adjustment records

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional ListCollateralRecordsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListCollateralRecordsOpts struct

Name Type Description Notes
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 for the query
to optional.Int64 End timestamp for the query, defaults to current time if not specified
borrowCurrency optional.String Borrowed currency
collateralCurrency optional.String Collateral currency

Example

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.CollateralLoanApi.ListCollateralRecords(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)
    }
}

Return type

[]CollateralRecord

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

OperateCollateral

OperateCollateral(ctx, collateralAlign)

Increase or redeem collateral

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
collateralAlign CollateralAlign

Example

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",
                             }
                            )
    collateralAlign := gateapi.CollateralAlign{} // CollateralAlign - 
    
    result, _, err := client.CollateralLoanApi.OperateCollateral(ctx, collateralAlign)
    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)
    }
}

Return type

(empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUserTotalAmount

UserTotalAmount GetUserTotalAmount(ctx, )

Query user's total borrowing and collateral amount

Required Parameters

Example

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.CollateralLoanApi.GetUserTotalAmount(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)
    }
}

Return type

UserTotalAmount

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUserLtvInfo

UserLtvInfo GetUserLtvInfo(ctx, collateralCurrency, borrowCurrency)

Query user's collateralization ratio and remaining borrowable currencies

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
collateralCurrency string Collateral currency
borrowCurrency string Borrowed currency

Example

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",
                             }
                            )
    collateralCurrency := "BTC" // string - Collateral currency
    borrowCurrency := "USDT" // string - Borrowed currency
    
    result, _, err := client.CollateralLoanApi.GetUserLtvInfo(ctx, collateralCurrency, borrowCurrency)
    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)
    }
}

Return type

UserLtvInfo

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCollateralCurrencies

[]CollateralLoanCurrency ListCollateralCurrencies(ctx, optional)

Query supported borrowing and collateral currencies

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional ListCollateralCurrenciesOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListCollateralCurrenciesOpts struct

Name Type Description Notes
loanCurrency optional.String Parameter loan_currency. If omitted, returns all supported borrowing currencies; if provided, returns the array of collateral currencies supported for that borrowing currency

Example

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.CollateralLoanApi.ListCollateralCurrencies(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)
    }
}

Return type

[]CollateralLoanCurrency

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]