All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
ListOptionsUnderlyings | Get /options/underlyings | List all underlyings |
ListOptionsExpirations | Get /options/expirations | List all expiration times |
ListOptionsContracts | Get /options/contracts | List all the contracts with specified underlying and expiration time |
GetOptionsContract | Get /options/contracts/{contract} | Query specified contract detail |
ListOptionsSettlements | Get /options/settlements | List settlement history |
GetOptionsSettlement | Get /options/settlements/{contract} | Get specified contract's settlement |
ListMyOptionsSettlements | Get /options/my_settlements | List my options settlements |
ListOptionsOrderBook | Get /options/order_book | Options order book |
ListOptionsTickers | Get /options/tickers | List tickers of options contracts |
ListOptionsUnderlyingTickers | Get /options/underlying/tickers/{underlying} | Get underlying ticker |
ListOptionsCandlesticks | Get /options/candlesticks | Get options candlesticks |
ListOptionsUnderlyingCandlesticks | Get /options/underlying/candlesticks | Mark price candlesticks of an underlying |
ListOptionsTrades | Get /options/trades | Options trade history |
ListOptionsAccount | Get /options/accounts | List options account |
ListOptionsAccountBook | Get /options/account_book | List account changing history |
ListOptionsPositions | Get /options/positions | List user's positions of specified underlying |
GetOptionsPosition | Get /options/positions/{contract} | Get specified contract position |
ListOptionsPositionClose | Get /options/position_close | List user's liquidation history of specified underlying |
ListOptionsOrders | Get /options/orders | List options orders |
CreateOptionsOrder | Post /options/orders | Create an options order |
CancelOptionsOrders | Delete /options/orders | Cancel all `open` orders matched |
GetOptionsOrder | Get /options/orders/{order_id} | Get a single order |
CancelOptionsOrder | Delete /options/orders/{order_id} | Cancel a single order |
CountdownCancelAllOptions | Post /options/countdown_cancel_all | Countdown cancel orders |
ListMyOptionsTrades | Get /options/my_trades | List personal trading history |
GetOptionsMMP | Get /options/mmp | MMP Query |
SetOptionsMMP | Post /options/mmp | MMP Settings |
ResetOptionsMMP | Post /options/mmp/reset | MMP Reset |
[]OptionsUnderlying ListOptionsUnderlyings(ctx, )
List all underlyings
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.OptionsApi.ListOptionsUnderlyings(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]
[]int64 ListOptionsExpirations(ctx, underlying)
List all expiration times
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) |
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()
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsExpirations(ctx, underlying)
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)
}
}
[]int64
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]OptionsContract ListOptionsContracts(ctx, underlying, optional)
List all the contracts with specified underlying and expiration time
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListOptionsContractsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsContractsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
expiration | optional.Int64 | Unix timestamp of the expiration time |
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()
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsContracts(ctx, underlying, 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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OptionsContract GetOptionsContract(ctx, contract)
Query specified contract detail
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string |
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()
contract := "BTC_USDT-20211130-65000-C" // string -
result, _, err := client.OptionsApi.GetOptionsContract(ctx, contract)
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]
[]OptionsSettlement ListOptionsSettlements(ctx, underlying, optional)
List settlement history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListOptionsSettlementsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsSettlementsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
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()
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsSettlements(ctx, underlying, 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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OptionsSettlement GetOptionsSettlement(ctx, contract, underlying, at)
Get specified contract's settlement
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | ||
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
at | int64 |
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()
contract := "BTC_USDT-20211130-65000-C" // string -
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
at := 56 // int64 -
result, _, err := client.OptionsApi.GetOptionsSettlement(ctx, contract, underlying, at)
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]
[]OptionsMySettlements ListMyOptionsSettlements(ctx, underlying, optional)
List my options settlements
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListMyOptionsSettlementsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMyOptionsSettlementsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract name | |
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
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",
}
)
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListMyOptionsSettlements(ctx, underlying, 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]
FuturesOrderBook ListOptionsOrderBook(ctx, contract, optional)
Options order book
Bids will be sorted by price from high to low, while asks sorted reversely
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Options contract name | |
optional | ListOptionsOrderBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsOrderBookOpts struct
Name | Type | Description | Notes |
---|---|---|---|
interval | optional.String | Order depth. 0 means no aggregation is applied. default to 0 | [default to 0] |
limit | optional.Int32 | Maximum number of order depth data in asks or bids | [default to 10] |
withId | optional.Bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [default to false] |
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()
contract := "BTC_USDT-20210916-5000-C" // string - Options contract name
result, _, err := client.OptionsApi.ListOptionsOrderBook(ctx, contract, 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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]OptionsTicker ListOptionsTickers(ctx, underlying)
List tickers of options contracts
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) |
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()
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsTickers(ctx, underlying)
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]
OptionsUnderlyingTicker ListOptionsUnderlyingTickers(ctx, underlying)
Get underlying ticker
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying |
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()
underlying := "BTC_USDT" // string - Underlying
result, _, err := client.OptionsApi.ListOptionsUnderlyingTickers(ctx, underlying)
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]
[]OptionsCandlestick ListOptionsCandlesticks(ctx, contract, optional)
Get options candlesticks
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Options contract name | |
optional | ListOptionsCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsCandlesticksOpts struct
Name | Type | Description | Notes |
---|---|---|---|
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp | |
interval | optional.String | Interval time between data points | [default to 5m] |
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()
contract := "BTC_USDT-20210916-5000-C" // string - Options contract name
result, _, err := client.OptionsApi.ListOptionsCandlesticks(ctx, contract, 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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesCandlestick ListOptionsUnderlyingCandlesticks(ctx, underlying, optional)
Mark price candlesticks of an underlying
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListOptionsUnderlyingCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsUnderlyingCandlesticksOpts struct
Name | Type | Description | Notes |
---|---|---|---|
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp | |
interval | optional.String | Interval time between data points | [default to 5m] |
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()
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsUnderlyingCandlesticks(ctx, underlying, 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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesTrade ListOptionsTrades(ctx, optional)
Options trade history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | ListOptionsTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsTradesOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract name | |
type_ | optional.String | `C` is call, while `P` is put | |
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
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.OptionsApi.ListOptionsTrades(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)
}
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OptionsAccount ListOptionsAccount(ctx, )
List options 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.OptionsApi.ListOptionsAccount(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]
[]OptionsAccountBook ListOptionsAccountBook(ctx, optional)
List account changing history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | ListOptionsAccountBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsAccountBookOpts struct
Name | Type | Description | Notes |
---|---|---|---|
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp | |
type_ | optional.String | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL |
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.OptionsApi.ListOptionsAccountBook(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]
[]OptionsPosition ListOptionsPositions(ctx, optional)
List user's positions of specified underlying
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | ListOptionsPositionsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsPositionsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
underlying | optional.String | Underlying |
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.OptionsApi.ListOptionsPositions(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]
OptionsPosition GetOptionsPosition(ctx, contract)
Get specified contract position
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string |
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",
}
)
contract := "BTC_USDT-20211130-65000-C" // string -
result, _, err := client.OptionsApi.GetOptionsPosition(ctx, contract)
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]
[]OptionsPositionClose ListOptionsPositionClose(ctx, underlying, optional)
List user's liquidation history of specified underlying
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListOptionsPositionCloseOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsPositionCloseOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract 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.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListOptionsPositionClose(ctx, underlying, 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]
[]OptionsOrder ListOptionsOrders(ctx, status, optional)
List options orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
status | string | Only list the orders with this status | |
optional | ListOptionsOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOptionsOrdersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract name | |
underlying | optional.String | Underlying | |
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
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 - Only list the orders with this status
result, _, err := client.OptionsApi.ListOptionsOrders(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]
OptionsOrder CreateOptionsOrder(ctx, optionsOrder)
Create an options order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optionsOrder | OptionsOrder |
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",
}
)
optionsOrder := gateapi.OptionsOrder{} // OptionsOrder -
result, _, err := client.OptionsApi.CreateOptionsOrder(ctx, optionsOrder)
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]
[]OptionsOrder CancelOptionsOrders(ctx, optional)
Cancel all open
orders matched
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | CancelOptionsOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a CancelOptionsOrdersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract name | |
underlying | optional.String | Underlying | |
side | optional.String | All bids or asks. Both included 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.OptionsApi.CancelOptionsOrders(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]
OptionsOrder GetOptionsOrder(ctx, orderId)
Get a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | int64 | Order ID returned on successful order creation |
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",
}
)
orderId := 12345 // int64 - Order ID returned on successful order creation
result, _, err := client.OptionsApi.GetOptionsOrder(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)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OptionsOrder CancelOptionsOrder(ctx, orderId)
Cancel a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | int64 | Order ID returned on successful order creation |
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",
}
)
orderId := 12345 // int64 - Order ID returned on successful order creation
result, _, err := client.OptionsApi.CancelOptionsOrder(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)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TriggerTime CountdownCancelAllOptions(ctx, countdownCancelAllOptionsTask)
Countdown cancel orders
Option order heartbeat detection, when the timeout
time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order
will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout
set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlying
contract
you specified will be automatically cancelled. If underlying
contract
is not specified, all pending orders of the user will be automatically cancelled If timeout
is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
countdownCancelAllOptionsTask | CountdownCancelAllOptionsTask |
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",
}
)
countdownCancelAllOptionsTask := gateapi.CountdownCancelAllOptionsTask{} // CountdownCancelAllOptionsTask -
result, _, err := client.OptionsApi.CountdownCancelAllOptions(ctx, countdownCancelAllOptionsTask)
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]
[]OptionsMyTrade ListMyOptionsTrades(ctx, underlying, optional)
List personal trading history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
underlying | string | Underlying (Obtained by listing underlying endpoint) | |
optional | ListMyOptionsTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMyOptionsTradesOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Options contract name | |
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] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
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",
}
)
underlying := "BTC_USDT" // string - Underlying (Obtained by listing underlying endpoint)
result, _, err := client.OptionsApi.ListMyOptionsTrades(ctx, underlying, 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]
[]OptionsMmp GetOptionsMMP(ctx, optional)
MMP Query
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | GetOptionsMMPOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetOptionsMMPOpts struct
Name | Type | Description | Notes |
---|---|---|---|
underlying | optional.String | Underlying |
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.OptionsApi.GetOptionsMMP(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]
OptionsMmp SetOptionsMMP(ctx, optionsMmp)
MMP Settings
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optionsMmp | OptionsMmp |
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",
}
)
optionsMmp := gateapi.OptionsMmp{} // OptionsMmp -
result, _, err := client.OptionsApi.SetOptionsMMP(ctx, optionsMmp)
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]
OptionsMmp ResetOptionsMMP(ctx, optionsMmpReset)
MMP Reset
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optionsMmpReset | OptionsMmpReset |
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",
}
)
optionsMmpReset := gateapi.OptionsMmpReset{} // OptionsMmpReset -
result, _, err := client.OptionsApi.ResetOptionsMMP(ctx, optionsMmpReset)
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]