Skip to content

Latest commit

 

History

History
791 lines (575 loc) · 21.8 KB

File metadata and controls

791 lines (575 loc) · 21.8 KB

SubAccountApi

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

Method HTTP request Description
ListSubAccounts Get /sub_accounts List sub-accounts
CreateSubAccounts Post /sub_accounts Create a new sub-account
GetSubAccount Get /sub_accounts/{user_id} Get sub-account
ListSubAccountKeys Get /sub_accounts/{user_id}/keys List all API key pairs of the sub-account
CreateSubAccountKeys Post /sub_accounts/{user_id}/keys Create new sub-account API key pair
GetSubAccountKey Get /sub_accounts/{user_id}/keys/{key} Get specific API key pair of the sub-account
UpdateSubAccountKeys Put /sub_accounts/{user_id}/keys/{key} Update sub-account API key pair
DeleteSubAccountKeys Delete /sub_accounts/{user_id}/keys/{key} Delete sub-account API key pair
LockSubAccount Post /sub_accounts/{user_id}/lock Lock sub-account
UnlockSubAccount Post /sub_accounts/{user_id}/unlock Unlock sub-account
ListUnifiedMode Get /sub_accounts/unified_mode Get sub-account mode

ListSubAccounts

[]SubAccount ListSubAccounts(ctx, optional)

List sub-accounts

Required Parameters

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

Optional Parameters

Optional parameters are passed through a pointer to a ListSubAccountsOpts struct

Name Type Description Notes
type_ optional.String Enter `0` to list all types of sub-accounts (currently supporting cross-margin sub-accounts and regular sub-accounts). Enter `1` to query regular sub-accounts only. If no parameter is passed, only regular sub-accounts will be queried by default.

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.SubAccountApi.ListSubAccounts(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

[]SubAccount

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]

CreateSubAccounts

SubAccount CreateSubAccounts(ctx, subAccount)

Create a new sub-account

Required Parameters

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

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",
                             }
                            )
    subAccount := gateapi.SubAccount{} // SubAccount - 
    
    result, _, err := client.SubAccountApi.CreateSubAccounts(ctx, subAccount)
    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

SubAccount

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]

GetSubAccount

SubAccount GetSubAccount(ctx, userId)

Get sub-account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int64 Sub-account user ID

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",
                             }
                            )
    userId := 56 // int64 - Sub-account user ID
    
    result, _, err := client.SubAccountApi.GetSubAccount(ctx, userId)
    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

SubAccount

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]

ListSubAccountKeys

[]SubAccountKey ListSubAccountKeys(ctx, userId)

List all API key pairs of the sub-account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int32 Sub-account user ID

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",
                             }
                            )
    userId := 56 // int32 - Sub-account user ID
    
    result, _, err := client.SubAccountApi.ListSubAccountKeys(ctx, userId)
    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

[]SubAccountKey

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]

CreateSubAccountKeys

SubAccountKey CreateSubAccountKeys(ctx, userId, subAccountKey)

Create new sub-account API key pair

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int64 Sub-account user ID
subAccountKey SubAccountKey

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",
                             }
                            )
    userId := 56 // int64 - Sub-account user ID
    subAccountKey := gateapi.SubAccountKey{} // SubAccountKey - 
    
    result, _, err := client.SubAccountApi.CreateSubAccountKeys(ctx, userId, subAccountKey)
    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

SubAccountKey

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]

GetSubAccountKey

SubAccountKey GetSubAccountKey(ctx, userId, key)

Get specific API key pair of the sub-account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int32 Sub-account user ID
key string Sub-account API key

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",
                             }
                            )
    userId := 56 // int32 - Sub-account user ID
    key := "key_example" // string - Sub-account API key
    
    result, _, err := client.SubAccountApi.GetSubAccountKey(ctx, userId, key)
    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

SubAccountKey

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]

UpdateSubAccountKeys

UpdateSubAccountKeys(ctx, userId, key, subAccountKey)

Update sub-account API key pair

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int32 Sub-account user ID
key string Sub-account API key
subAccountKey SubAccountKey

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",
                             }
                            )
    userId := 56 // int32 - Sub-account user ID
    key := "key_example" // string - Sub-account API key
    subAccountKey := gateapi.SubAccountKey{} // SubAccountKey - 
    
    result, _, err := client.SubAccountApi.UpdateSubAccountKeys(ctx, userId, key, subAccountKey)
    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]

DeleteSubAccountKeys

DeleteSubAccountKeys(ctx, userId, key)

Delete sub-account API key pair

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int32 Sub-account user ID
key string Sub-account API key

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",
                             }
                            )
    userId := 56 // int32 - Sub-account user ID
    key := "key_example" // string - Sub-account API key
    
    result, _, err := client.SubAccountApi.DeleteSubAccountKeys(ctx, userId, key)
    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: Not defined
  • Accept: Not defined

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

LockSubAccount

LockSubAccount(ctx, userId)

Lock sub-account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int64 Sub-account user ID

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",
                             }
                            )
    userId := 56 // int64 - Sub-account user ID
    
    result, _, err := client.SubAccountApi.LockSubAccount(ctx, userId)
    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: Not defined
  • Accept: Not defined

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

UnlockSubAccount

UnlockSubAccount(ctx, userId)

Unlock sub-account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId int64 Sub-account user ID

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",
                             }
                            )
    userId := 56 // int64 - Sub-account user ID
    
    result, _, err := client.SubAccountApi.UnlockSubAccount(ctx, userId)
    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: Not defined
  • Accept: Not defined

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

ListUnifiedMode

[]SubUserMode ListUnifiedMode(ctx, )

Get sub-account mode

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/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.SubAccountApi.ListUnifiedMode(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

[]SubUserMode

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]