All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| QueryOptionFeeRate | GET /stock_options/fee-rate | Get option trading fee rates |
| QueryOptionSymbols | GET /stock_options/underlyings | List option underlyings |
| QueryOptionContracts | GET /stock_options/contracts | List option contracts |
| QueryOptionExpirations | GET /stock_options/market/expirations | List option expiration dates |
| QueryOptionChain | GET /stock_options/market/chain | Get the option chain |
| QueryOptionOrderBook | GET /stock_options/market/{symbol}/orderbook | Get the option order book |
| QueryOptionPositions | GET /stock_options/positions | List current option positions |
| CloseOptionPosition | POST /stock_options/positions/close | Close an option position |
| QueryOptionOrderList | GET /stock_options/orders | List current option orders |
| CreateOptionOrder | POST /stock_options/orders | Create an option order |
| CancelAllOptionOrders | DELETE /stock_options/orders | Cancel all option limit orders |
| QueryOptionOrderDetail | GET /stock_options/orders/{order_id} | Get option order details |
| UpdateOptionOrder | PUT /stock_options/orders/{order_id} | Amend an option limit order |
| CancelOptionOrder | DELETE /stock_options/orders/{order_id} | Cancel an option limit order |
| QueryOptionOrderHistory | GET /stock_options/orders/history | List historical option orders |
StockOptionConfigResponse QueryOptionFeeRate ()
Get option trading fee rates
Query the fee configuration for options trading before placing an order. Returns the rates and applicable minimum and maximum fees for SEC, TAF, OCC, ORF and CAT charges.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionFeeRateExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
try
{
// Get option trading fee rates
StockOptionConfigResponse result = apiInstance.QueryOptionFeeRate();
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionFeeRate: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option trading fee configuration | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionSymbolListResponse QueryOptionSymbols (string underlyings = null)
List option underlyings
Query available option underlyings before looking up contracts, expiration dates and option chains. Returns underlying symbols, names, multilingual descriptions, icons, price precision and order quantity limits. underlyings accepts multiple comma-separated symbols; omit it to query all available underlyings.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionSymbolsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
var underlyings = "AAPL,TSLA"; // string | Comma-separated option underlying symbols, for example AAPL,TSLA. Omit to query all available underlyings. (optional)
try
{
// List option underlyings
StockOptionSymbolListResponse result = apiInstance.QueryOptionSymbols(underlyings);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionSymbols: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlyings | string | Comma-separated option underlying symbols, for example AAPL,TSLA. Omit to query all available underlyings. | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option underlying list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionContractListResponse QueryOptionContracts (string underlying, string exchange = null, DateTime? expirationDate = null, StockOptionOptionType? optionType = null, int? page = null, int? pageSize = null)
List option contracts
Query option contracts for an underlying, including contract symbols, strike prices, expiration dates and trading rules. underlying is required. Filter by expiration date and call or put type; only US market (us) contracts are currently available. Results are paginated in ascending contract symbol order, with total records, total pages and the current page. The default and maximum page_size are both 1000. Use price precision and minimum and maximum order quantities to check an order before submission.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionContractsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol.
var exchange = "us"; // string | Trading market filter. Only US market (us) contracts are currently available. Omitted or empty values use us. - us: US market. (optional)
var expirationDate = "2026-08-14"; // DateTime? | Option expiration date in YYYY-MM-DD format. Omit to disable expiration date filtering. (optional)
var optionType = new StockOptionOptionType(); // StockOptionOptionType? | Option type filter for the contract list. Omit for both types. - call: Call option. - put: Put option. (optional)
var page = 1; // int? | Page number, starting from 1. Defaults to 1 when omitted. (optional) (default to 1)
var pageSize = 1000; // int? | Contracts per page. Defaults to 1000 when omitted; values above 1000 are capped at 1000. (optional) (default to 1000)
try
{
// List option contracts
StockOptionContractListResponse result = apiInstance.QueryOptionContracts(underlying, exchange, expirationDate, optionType, page, pageSize);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionContracts: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol. | |
| exchange | string | Trading market filter. Only US market (us) contracts are currently available. Omitted or empty values use us. - us: US market. | [optional] |
| expirationDate | DateTime? | Option expiration date in YYYY-MM-DD format. Omit to disable expiration date filtering. | [optional] |
| optionType | StockOptionOptionType? | Option type filter for the contract list. Omit for both types. - call: Call option. - put: Put option. | [optional] |
| page | int? | Page number, starting from 1. Defaults to 1 when omitted. | [optional] [default to 1] |
| pageSize | int? | Contracts per page. Defaults to 1000 when omitted; values above 1000 are capped at 1000. | [optional] [default to 1000] |
StockOptionContractListResponse
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option contract list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionExpirationListResponse QueryOptionExpirations (string underlying)
List option expiration dates
Query expiration dates for an option underlying before selecting a contract expiration. underlying is required. Returns dates and their Unix timestamps; use the selected date to query the option chain.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionExpirationsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol.
try
{
// List option expiration dates
StockOptionExpirationListResponse result = apiInstance.QueryOptionExpirations(underlying);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionExpirations: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol. |
StockOptionExpirationListResponse
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option expiration date list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionOptionChainResponse QueryOptionChain (string underlying, DateTime expirationDate, string optionType = null)
Get the option chain
Query option quotes at different strike prices for the same underlying and expiration date to compare call and put contracts. underlying and expiration_date are required. Set option_type to call or put to filter; omit it or use all for both types. Returns contract symbols, strike prices, bid and ask quotes, last prices, mark prices, implied volatility and Greeks.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionChainExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol.
var expirationDate = "2026-08-14"; // DateTime | Required option expiration date in YYYY-MM-DD format, obtained from the expiration date list.
var optionType = "optionType_example"; // string | Option type filter for the option chain. - call: Call options only. - put: Put options only. - all: Both types, equivalent to omitting this parameter. (optional)
try
{
// Get the option chain
StockOptionOptionChainResponse result = apiInstance.QueryOptionChain(underlying, expirationDate, optionType);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionChain: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. This is one underlying symbol, not an option contract symbol. | |
| expirationDate | DateTime | Required option expiration date in YYYY-MM-DD format, obtained from the expiration date list. | |
| optionType | string | Option type filter for the option chain. - call: Call options only. - put: Put options only. - all: Both types, equivalent to omitting this parameter. | [optional] |
StockOptionOptionChainResponse
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option chain | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionOrderBookResponse QueryOptionOrderBook (string symbol)
Get the option order book
Query the best bid and ask for an option contract. symbol is the option contract symbol. Each of bids and asks contains at most one price level, without order quantities. A side without an available quote is an empty array. Both sides are empty arrays when the contract is not found.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionOrderBookExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new StockOptionsApi(config);
var symbol = "AAPL260814P00130000"; // string | Option contract symbol
try
{
// Get the option order book
StockOptionOrderBookResponse result = apiInstance.QueryOptionOrderBook(symbol);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionOrderBook: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | string | Option contract symbol |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option order book | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionPositionListResponse QueryOptionPositions (string underlying = null, string symbol = null, StockOptionPositionPnlPriceType? priceType = null)
List current option positions
Query the current user's option positions, market values and profit and loss. Filter by underlying or symbol. A specified symbol must identify an existing option contract; no position returns an empty list. price_type selects the price for market value, unrealized PnL and today's PnL: latest (default) uses the last traded price; mark uses the mark price. Aggregate today_pnl includes current positions and contracts fully closed today. Results are sorted by open_time descending, then symbol ascending.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionPositionsExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. (optional)
var symbol = "AAPL260814P00130000"; // string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. (optional)
var priceType = new StockOptionPositionPnlPriceType(); // StockOptionPositionPnlPriceType? | Valuation price type for position market value, unrealized PnL, and daily PnL. Options: `latest` (last traded price) or `mark` (mark price). Defaults to `latest` when omitted or empty. (optional)
try
{
// List current option positions
StockOptionPositionListResponse result = apiInstance.QueryOptionPositions(underlying, symbol, priceType);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionPositions: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. | [optional] |
| symbol | string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. | [optional] |
| priceType | StockOptionPositionPnlPriceType? | Valuation price type for position market value, unrealized PnL, and daily PnL. Options: `latest` (last traded price) or `mark` (mark price). Defaults to `latest` when omitted or empty. | [optional] |
StockOptionPositionListResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Current option position list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionClosePositionResponse CloseOptionPosition (StockOptionClosePositionRequest stockOptionClosePositionRequest)
Close an option position
Submit a closing order for part or all of an option position. symbol and quantity are required. The positive quantity must not exceed the available position and must satisfy the contract's minimum, maximum and quantity increment rules. Omit order_type or pass an empty value for a market order. A limit order requires a positive price; a market order ignores price. The closing side is derived from the position and time in force is fixed to day. The response returns the closing order_id; query the order for its subsequent status.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class CloseOptionPositionExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var stockOptionClosePositionRequest = new StockOptionClosePositionRequest(); // StockOptionClosePositionRequest |
try
{
// Close an option position
StockOptionClosePositionResponse result = apiInstance.CloseOptionPosition(stockOptionClosePositionRequest);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.CloseOptionPosition: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| stockOptionClosePositionRequest | StockOptionClosePositionRequest |
StockOptionClosePositionResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Position closing response | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionOrderListResponse QueryOptionOrderList (string underlying = null, string symbol = null, StockOptionOrderListSide? side = null)
List current option orders
Query the current user's unfinished option orders, including open and partially filled orders. Filter by underlying, symbol or side. underlying accepts only one symbol, not a comma-separated list. status includes only 1 (new) and 2 (partially filled). Query order history for terminal orders. Matching orders are sorted by creation time time_setup descending. This endpoint has no pagination parameters.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionOrderListExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. (optional)
var symbol = "AAPL260814P00130000"; // string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. (optional)
var side = new StockOptionOrderListSide(); // StockOptionOrderListSide? | Order side filter. Omit to query both sides. - 1: Sell orders only. - 2: Buy orders only. (optional)
try
{
// List current option orders
StockOptionOrderListResponse result = apiInstance.QueryOptionOrderList(underlying, symbol, side);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionOrderList: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. | [optional] |
| symbol | string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. | [optional] |
| side | StockOptionOrderListSide? | Order side filter. Omit to query both sides. - 1: Sell orders only. - 2: Buy orders only. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Current option order list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionPutOrderResponse CreateOptionOrder (StockOptionPutOrderRequest stockOptionPutOrderRequest)
Create an option order
Submit a buy or sell order for an option contract and return the order ID on success. symbol, side, order_type, time_in_force and quantity are required. side is 1 (sell) or 2 (buy). Limit orders require a positive price and support day or gtc. Market orders ignore price and support only day. Quantity is a positive decimal string within the contract's minimum and maximum order quantities. Sell orders require sufficient available long positions. client_order_id is optional and is generated automatically when omitted or whitespace-only. Query current orders or order details to track the returned order ID.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class CreateOptionOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var stockOptionPutOrderRequest = new StockOptionPutOrderRequest(); // StockOptionPutOrderRequest |
try
{
// Create an option order
StockOptionPutOrderResponse result = apiInstance.CreateOptionOrder(stockOptionPutOrderRequest);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.CreateOptionOrder: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| stockOptionPutOrderRequest | StockOptionPutOrderRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order creation response | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionCancelAllOrdersResponse CancelAllOptionOrders (StockOptionCancelAllOrdersRequest stockOptionCancelAllOrdersRequest = null)
Cancel all option limit orders
Cancel all or a filtered set of the current user's option limit orders. The request body may be omitted or an empty object. Without filters, all limit orders are cancelled. Filter by underlying, symbol or side. side supports 1 (sell) and 2 (buy); omit it to include both sides. The response reports the cancellation request result. Query the orders to confirm their subsequent status.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class CancelAllOptionOrdersExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var stockOptionCancelAllOrdersRequest = new StockOptionCancelAllOrdersRequest(); // StockOptionCancelAllOrdersRequest | (optional)
try
{
// Cancel all option limit orders
StockOptionCancelAllOrdersResponse result = apiInstance.CancelAllOptionOrders(stockOptionCancelAllOrdersRequest);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.CancelAllOptionOrders: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| stockOptionCancelAllOrdersRequest | StockOptionCancelAllOrdersRequest | [optional] |
StockOptionCancelAllOrdersResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Bulk order cancellation response | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionOrderDetailResponse QueryOptionOrderDetail (string orderId)
Get option order details
Query one of the current user's orders by ID to track its status, filled quantity and average fill price. order_id is required and must be a positive integer represented as a string. Both current and finished orders can be queried, without filtering by terminal status. Returns price, quantity, filled quantity, status description, average fill price, fees and timestamps.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionOrderDetailExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var orderId = "8000000001"; // string | Option order ID as a positive integer string, obtained from order submission or query results.
try
{
// Get option order details
StockOptionOrderDetailResponse result = apiInstance.QueryOptionOrderDetail(orderId);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionOrderDetail: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | Option order ID as a positive integer string, obtained from order submission or query results. |
StockOptionOrderDetailResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Option order details | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionUpdateOrderResponse UpdateOptionOrder (string orderId, StockOptionUpdateOrderRequest stockOptionUpdateOrderRequest)
Amend an option limit order
Update the price and total quantity of one of the current user's option limit orders. The path order_id and body price and quantity are required. Market orders cannot be amended. quantity is the new total order quantity, not the remaining unfilled quantity, and must be at least filled_quantity. Amending a sell order also requires sufficient available positions for the new unfilled quantity. Returns the order ID; query the order for its subsequent status.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class UpdateOptionOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var orderId = "72057594037983901"; // string | Option order ID as a positive integer string, obtained from order submission or query results.
var stockOptionUpdateOrderRequest = new StockOptionUpdateOrderRequest(); // StockOptionUpdateOrderRequest |
try
{
// Amend an option limit order
StockOptionUpdateOrderResponse result = apiInstance.UpdateOptionOrder(orderId, stockOptionUpdateOrderRequest);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.UpdateOptionOrder: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | Option order ID as a positive integer string, obtained from order submission or query results. | |
| stockOptionUpdateOrderRequest | StockOptionUpdateOrderRequest |
StockOptionUpdateOrderResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order amendment response | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionCancelOrderResponse CancelOptionOrder (string orderId)
Cancel an option limit order
Cancel one of the current user's option limit orders by ID. order_id is required. Only limit orders can be cancelled; already filled quantities are unaffected. Returns the order ID. Query order details or order history for the final status.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class CancelOptionOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var orderId = "72057594037983901"; // string | Option order ID as a positive integer string, obtained from order submission or query results.
try
{
// Cancel an option limit order
StockOptionCancelOrderResponse result = apiInstance.CancelOptionOrder(orderId);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.CancelOptionOrder: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | Option order ID as a positive integer string, obtained from order submission or query results. |
StockOptionCancelOrderResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order cancellation response | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StockOptionOrderHistoryResponse QueryOptionOrderHistory (string underlying = null, string symbol = null, long? beginTime = null, long? endTime = null, StockOptionOrderListSide? side = null, int? page = null, int? pageSize = null)
List historical option orders
Query the current user's finished option orders with pagination to check orders, fills and fees. status includes only 3 (filled), 4 (cancelled) and 5 (rejected). Filter by underlying, contract, side or order creation time. begin_time and end_time are Unix timestamps in seconds; when both are provided, the start must not be later than the end. Returns total records, total pages and the current page. The default and maximum page_size are both 100.
using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace Example
{
public class QueryOptionOrderHistoryExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new StockOptionsApi(config);
var underlying = "AAPL"; // string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. (optional)
var symbol = "AAPL260814P00130000"; // string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. (optional)
var beginTime = 56; // long? | Order creation time filter start, as a Unix timestamp in seconds. Omit for no lower bound; must not exceed end_time when both are provided. (optional)
var endTime = 56; // long? | Order creation time filter end, as a Unix timestamp in seconds. Omit for no upper bound; must not precede begin_time when both are provided. (optional)
var side = new StockOptionOrderListSide(); // StockOptionOrderListSide? | Order side filter. Omit to query both sides. - 1: Sell orders only. - 2: Buy orders only. (optional)
var page = 1; // int? | Page number, starting from 1. Defaults to 1 when omitted. (optional) (default to 1)
var pageSize = 100; // int? | Number of items per page, up to 100. Defaults to 100 when omitted; values above 100 are capped at 100. (optional) (default to 100)
try
{
// List historical option orders
StockOptionOrderHistoryResponse result = apiInstance.QueryOptionOrderHistory(underlying, symbol, beginTime, endTime, side, page, pageSize);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling StockOptionsApi.QueryOptionOrderHistory: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| underlying | string | Option underlying symbol, for example AAPL. Omit to disable underlying filtering. Current orders support only one underlying. | [optional] |
| symbol | string | Full option contract symbol, for example AAPL260814P00130000. Omit to disable contract filtering. | [optional] |
| beginTime | long? | Order creation time filter start, as a Unix timestamp in seconds. Omit for no lower bound; must not exceed end_time when both are provided. | [optional] |
| endTime | long? | Order creation time filter end, as a Unix timestamp in seconds. Omit for no upper bound; must not precede begin_time when both are provided. | [optional] |
| side | StockOptionOrderListSide? | Order side filter. Omit to query both sides. - 1: Sell orders only. - 2: Buy orders only. | [optional] |
| page | int? | Page number, starting from 1. Defaults to 1 when omitted. | [optional] [default to 1] |
| pageSize | int? | Number of items per page, up to 100. Defaults to 100 when omitted; values above 100 are capped at 100. | [optional] [default to 100] |
StockOptionOrderHistoryResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Historical option order list | - |
| 400 | Request failed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]