[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
1076 lines (769 loc) · 31.9 KB

UnifiedApi.md

File metadata and controls

1076 lines (769 loc) · 31.9 KB

UnifiedApi

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

Method HTTP request Description
ListUnifiedAccounts Get /unified/accounts Get unified account information
ListUnifiedAccountMode Get /unified/account_mode Inquire about unified account mode (deprecated)
SetUnifiedAccountMode Post /unified/account_mode Set unified account mode (deprecated)
GetUnifiedBorrowable Get /unified/borrowable Query about the maximum borrowing for the unified account
GetUnifiedTransferable Get /unified/transferable Query about the maximum transferable for the unified account
ListUnifiedLoans Get /unified/loans List loans
CreateUnifiedLoan Post /unified/loans Borrow or repay
ListUnifiedLoanRecords Get /unified/loan_records Get load records
ListUnifiedLoanInterestRecords Get /unified/interest_records List interest records
GetUnifiedRiskUnits Get /unified/risk_units Retrieve user risk unit details, only valid in portfolio margin mode
GetUnifiedMode Get /unified/unified_mode Query mode of the unified account
SetUnifiedMode Put /unified/unified_mode Set mode of the unified account
GetUnifiedEstimateRate Get /unified/estimate_rate Get unified estimate rate
ListCurrencyDiscountTiers Get /unified/currency_discount_tiers list currency discount tiers
CalculatePortfolioMargin Post /unified/portfolio_calculator portfolio margin calculator

ListUnifiedAccounts

UnifiedAccount ListUnifiedAccounts(ctx, optional)

Get unified account information

The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. You can refer to the Formula in the documentation

Required Parameters

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

Optional Parameters

Optional parameters are passed through a pointer to a ListUnifiedAccountsOpts struct

Name Type Description Notes
currency optional.String Retrieve data of the specified currency

Example

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.UnifiedApi.ListUnifiedAccounts(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

UnifiedAccount

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]

ListUnifiedAccountMode

map[string]bool ListUnifiedAccountMode(ctx, )

Inquire about unified account mode (deprecated)

cross_margin - Spot full-margin trading, usdt_futures - USDT perpetual futures

Required Parameters

Example

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.UnifiedApi.ListUnifiedAccountMode(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

map[string]bool

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]

SetUnifiedAccountMode

map[string]bool SetUnifiedAccountMode(ctx, unifiedMode)

Set unified account mode (deprecated)

Required Parameters

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

Example

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",
                             }
                            )
    unifiedMode := gateapi.UnifiedMode{} // UnifiedMode - 
    
    result, _, err := client.UnifiedApi.SetUnifiedAccountMode(ctx, unifiedMode)
    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

map[string]bool

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]

GetUnifiedBorrowable

UnifiedBorrowable GetUnifiedBorrowable(ctx, currency)

Query about the maximum borrowing for the unified account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
currency string Retrieve data of the specified currency

Example

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.UnifiedApi.GetUnifiedBorrowable(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)
    }
}

Return type

UnifiedBorrowable

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]

GetUnifiedTransferable

UnifiedTransferable GetUnifiedTransferable(ctx, currency)

Query about the maximum transferable for the unified account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
currency string Retrieve data of the specified currency

Example

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.UnifiedApi.GetUnifiedTransferable(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)
    }
}

Return type

UnifiedTransferable

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]

ListUnifiedLoans

[]UniLoan ListUnifiedLoans(ctx, optional)

List loans

Required Parameters

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

Optional Parameters

Optional parameters are passed through a pointer to a ListUnifiedLoansOpts struct

Name Type Description Notes
currency optional.String Retrieve data of the specified currency
page optional.Int32 Page number [default to 1]
limit optional.Int32 Maximum response items. Default: 100, minimum: 1, Maximum: 100 [default to 100]
type_ optional.String Loan type, platform - platform, margin - margin

Example

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.UnifiedApi.ListUnifiedLoans(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

[]UniLoan

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]

CreateUnifiedLoan

CreateUnifiedLoan(ctx, unifiedLoan)

Borrow or repay

When borrowing, it is essential to ensure that the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter repaid_all=true

Required Parameters

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

Example

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",
                             }
                            )
    unifiedLoan := gateapi.UnifiedLoan{} // UnifiedLoan - 
    
    result, _, err := client.UnifiedApi.CreateUnifiedLoan(ctx, unifiedLoan)
    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]

ListUnifiedLoanRecords

[]UnifiedLoanRecord ListUnifiedLoanRecords(ctx, optional)

Get load records

Required Parameters

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

Optional Parameters

Optional parameters are passed through a pointer to a ListUnifiedLoanRecordsOpts struct

Name Type Description Notes
type_ optional.String The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds
currency optional.String Retrieve data of the specified currency
page optional.Int32 Page number [default to 1]
limit optional.Int32 Maximum response items. Default: 100, minimum: 1, Maximum: 100 [default to 100]

Example

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.UnifiedApi.ListUnifiedLoanRecords(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

[]UnifiedLoanRecord

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]

ListUnifiedLoanInterestRecords

[]UniLoanInterestRecord ListUnifiedLoanInterestRecords(ctx, optional)

List interest records

Required Parameters

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

Optional Parameters

Optional parameters are passed through a pointer to a ListUnifiedLoanInterestRecordsOpts struct

Name Type Description Notes
currency optional.String Retrieve data of the specified currency
page optional.Int32 Page number [default to 1]
limit optional.Int32 Maximum response items. Default: 100, minimum: 1, Maximum: 100 [default to 100]
type_ optional.String Loan type, platform - platform, margin - margin

Example

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.UnifiedApi.ListUnifiedLoanInterestRecords(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

[]UniLoanInterestRecord

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]

GetUnifiedRiskUnits

UnifiedRiskUnits GetUnifiedRiskUnits(ctx, )

Retrieve user risk unit details, only valid in portfolio margin mode

Required Parameters

Example

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.UnifiedApi.GetUnifiedRiskUnits(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

UnifiedRiskUnits

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]

GetUnifiedMode

UnifiedModeSet GetUnifiedMode(ctx, )

Query mode of the unified account

Unified account mode: - classic: Classic account mode - multi_currency: Multi-currency margin mode - portfolio: Portfolio margin mode

Required Parameters

Example

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.UnifiedApi.GetUnifiedMode(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

UnifiedModeSet

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]

SetUnifiedMode

SetUnifiedMode(ctx, unifiedModeSet)

Set mode of the unified account

Switching between different account modes requires only passing the parameters n\corresponding to the target account mode. It also supports opening or closing configuration switches for the corresponding account mode when switching- When enabling classic account mode,mode=classic PUT /unified/unified_mode { \"mode\": \"classic\" } - When enabling multi-currency margin mode, mode=multi_currency PUT /unified/unified_mode { \"mode\": \"multi_currency\", \"settings\": { \"usdt_futures\": true } } - When enabling portfolio margin mode,mode=portfolio PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } }

Required Parameters

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

Example

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",
                             }
                            )
    unifiedModeSet := gateapi.UnifiedModeSet{} // UnifiedModeSet - 
    
    result, _, err := client.UnifiedApi.SetUnifiedMode(ctx, unifiedModeSet)
    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]

GetUnifiedEstimateRate

map[string]string GetUnifiedEstimateRate(ctx, currencies)

Get unified estimate rate

Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
currencies []string Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.

Example

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",
                             }
                            )
    currencies := []string{"[\"BTC\",\"GT\"]"} // []string - Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.
    
    result, _, err := client.UnifiedApi.GetUnifiedEstimateRate(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)
    }
}

Return type

map[string]string

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]

ListCurrencyDiscountTiers

[]UnifiedDiscount ListCurrencyDiscountTiers(ctx, )

list currency discount tiers

Required Parameters

Example

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.UnifiedApi.ListCurrencyDiscountTiers(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

[]UnifiedDiscount

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]

CalculatePortfolioMargin

UnifiedPortfolioOutput CalculatePortfolioMargin(ctx, unifiedPortfolioInput)

portfolio margin calculator

组合保证金计算器 当输入为模拟仓位组合时,每个仓位包括仓位名和持有量,只支持市场范围:BTC、ETH的永续合约、期权、现货 当输入为模拟挂单时,每个挂单包括市场标识、挂单价、挂单量,只支持市场范围:BTC、ETH的永续合约、期权、现货。挂单不包括市价单

Required Parameters

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

Example

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()
    unifiedPortfolioInput := gateapi.UnifiedPortfolioInput{} // UnifiedPortfolioInput - 
    
    result, _, err := client.UnifiedApi.CalculatePortfolioMargin(ctx, unifiedPortfolioInput)
    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

UnifiedPortfolioOutput

Authorization

No authorization required

HTTP request headers

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

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