|
| 1 | +# gate-client |
| 2 | +APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 |
| 3 | + |
| 4 | +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: |
| 5 | + |
| 6 | +- API version: 1.0.0 |
| 7 | +- Package version: 1.0.0 |
| 8 | +- Build package: org.openapitools.codegen.languages.PythonClientCodegen |
| 9 | +For more information, please visit [https://gate.io/page/contacts](https://gate.io/page/contacts) |
| 10 | + |
| 11 | +## Requirements. |
| 12 | + |
| 13 | +Python 2.7 and 3.4+ |
| 14 | + |
| 15 | +## Installation & Usage |
| 16 | +### pip install |
| 17 | + |
| 18 | +If the python package is hosted on Github, you can install directly from Github |
| 19 | + |
| 20 | +```sh |
| 21 | +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git |
| 22 | +``` |
| 23 | +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) |
| 24 | + |
| 25 | +Then import the package: |
| 26 | +```python |
| 27 | +import gate_client |
| 28 | +``` |
| 29 | + |
| 30 | +### Setuptools |
| 31 | + |
| 32 | +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). |
| 33 | + |
| 34 | +```sh |
| 35 | +python setup.py install --user |
| 36 | +``` |
| 37 | +(or `sudo python setup.py install` to install the package for all users) |
| 38 | + |
| 39 | +Then import the package: |
| 40 | +```python |
| 41 | +import gate_client |
| 42 | +``` |
| 43 | + |
| 44 | +## Getting Started |
| 45 | + |
| 46 | +Please follow the [installation procedure](#installation--usage) and then run the following: |
| 47 | + |
| 48 | +```python |
| 49 | +from __future__ import print_function |
| 50 | +import time |
| 51 | +import gate_client |
| 52 | +from gate_client.rest import ApiException |
| 53 | +from pprint import pprint |
| 54 | + |
| 55 | +# Configure API key authorization: api_key |
| 56 | +configuration = gate_client.Configuration() |
| 57 | +configuration.api_key['KEY'] = 'YOUR_API_KEY' |
| 58 | +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 59 | +# configuration.api_key_prefix['KEY'] = 'Bearer' |
| 60 | +# Configure API key authorization: api_sign |
| 61 | +configuration = gate_client.Configuration() |
| 62 | +configuration.api_key['SIGN'] = 'YOUR_API_KEY' |
| 63 | +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 64 | +# configuration.api_key_prefix['SIGN'] = 'Bearer' |
| 65 | +# Configure API key authorization: api_timestamp |
| 66 | +configuration = gate_client.Configuration() |
| 67 | +configuration.api_key['Timestamp'] = 'YOUR_API_KEY' |
| 68 | +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 69 | +# configuration.api_key_prefix['Timestamp'] = 'Bearer' |
| 70 | + |
| 71 | +# create an instance of the API class |
| 72 | +api_instance = gate_client.FuturesApi(gate_client.ApiClient(configuration)) |
| 73 | +order_id = 'order_id_example' # str | 成功创建订单时返回的 ID |
| 74 | + |
| 75 | +try: |
| 76 | + # 撤销单个订单 |
| 77 | + api_instance.cancel_order(order_id) |
| 78 | +except ApiException as e: |
| 79 | + print("Exception when calling FuturesApi->cancel_order: %s\n" % e) |
| 80 | + |
| 81 | +``` |
| 82 | + |
| 83 | +## Documentation for API Endpoints |
| 84 | + |
| 85 | +All URIs are relative to *https://fx-api.gateio.io/api/v4* |
| 86 | + |
| 87 | +Class | Method | HTTP request | Description |
| 88 | +------------ | ------------- | ------------- | ------------- |
| 89 | +*FuturesApi* | [**cancel_order**](docs/FuturesApi.md#cancel_order) | **DELETE** /futures/orders/{order_id} | 撤销单个订单 |
| 90 | +*FuturesApi* | [**cancel_orders**](docs/FuturesApi.md#cancel_orders) | **DELETE** /futures/orders | 批量取消状态为 open 的订单 |
| 91 | +*FuturesApi* | [**create_order**](docs/FuturesApi.md#create_order) | **POST** /futures/orders | 期货交易下单 |
| 92 | +*FuturesApi* | [**get_my_trades**](docs/FuturesApi.md#get_my_trades) | **GET** /futures/my_trades | 查询个人成交记录 |
| 93 | +*FuturesApi* | [**get_order**](docs/FuturesApi.md#get_order) | **GET** /futures/orders/{order_id} | 查询单个订单详情 |
| 94 | +*FuturesApi* | [**list_futures_accounts**](docs/FuturesApi.md#list_futures_accounts) | **GET** /futures/accounts | 获取期货账号 |
| 95 | +*FuturesApi* | [**list_futures_candlesticks**](docs/FuturesApi.md#list_futures_candlesticks) | **GET** /futures/candlesticks | 期货市场 K 线图 |
| 96 | +*FuturesApi* | [**list_futures_contracts**](docs/FuturesApi.md#list_futures_contracts) | **GET** /futures/contracts | 查询所有的期货信息 |
| 97 | +*FuturesApi* | [**list_futures_funding_rate_history**](docs/FuturesApi.md#list_futures_funding_rate_history) | **GET** /futures/funding_rate | 期货市场历史资金费率 |
| 98 | +*FuturesApi* | [**list_futures_insurance_ledger**](docs/FuturesApi.md#list_futures_insurance_ledger) | **GET** /futures/insurance | 期货市场保险基金历史 |
| 99 | +*FuturesApi* | [**list_futures_order_book**](docs/FuturesApi.md#list_futures_order_book) | **GET** /futures/order_book | 查询期货市场深度信息 |
| 100 | +*FuturesApi* | [**list_futures_tickers**](docs/FuturesApi.md#list_futures_tickers) | **GET** /futures/tickers | 获取所有期货交易行情统计 |
| 101 | +*FuturesApi* | [**list_futures_trades**](docs/FuturesApi.md#list_futures_trades) | **GET** /futures/trades | 期货市场成交记录 |
| 102 | +*FuturesApi* | [**list_orders**](docs/FuturesApi.md#list_orders) | **GET** /futures/orders | 查询订单列表 |
| 103 | +*FuturesApi* | [**list_positions**](docs/FuturesApi.md#list_positions) | **GET** /futures/positions | 获取用户头寸列表 |
| 104 | +*FuturesApi* | [**update_position_leverage**](docs/FuturesApi.md#update_position_leverage) | **POST** /futures/positions/{contract}/leverage | 更新头寸杠杆 |
| 105 | +*FuturesApi* | [**update_position_margin**](docs/FuturesApi.md#update_position_margin) | **POST** /futures/positions/{contract}/margin | 更新头寸保证金 |
| 106 | +*FuturesApi* | [**update_position_risk_limit**](docs/FuturesApi.md#update_position_risk_limit) | **POST** /futures/positions/{contract}/risk_limit | 更新头寸风险限额 |
| 107 | + |
| 108 | + |
| 109 | +## Documentation For Models |
| 110 | + |
| 111 | + - [Contract](docs/Contract.md) |
| 112 | + - [FundingRateHistory](docs/FundingRateHistory.md) |
| 113 | + - [FundingRateHistoryInner](docs/FundingRateHistoryInner.md) |
| 114 | + - [FuturesAccount](docs/FuturesAccount.md) |
| 115 | + - [FuturesCandlesticks](docs/FuturesCandlesticks.md) |
| 116 | + - [FuturesCandlesticksInner](docs/FuturesCandlesticksInner.md) |
| 117 | + - [FuturesErrorResponse](docs/FuturesErrorResponse.md) |
| 118 | + - [FuturesOrder](docs/FuturesOrder.md) |
| 119 | + - [FuturesOrderBook](docs/FuturesOrderBook.md) |
| 120 | + - [FuturesOrderBookAsks](docs/FuturesOrderBookAsks.md) |
| 121 | + - [FuturesTicker](docs/FuturesTicker.md) |
| 122 | + - [FuturesTrade](docs/FuturesTrade.md) |
| 123 | + - [InsuranceRecord](docs/InsuranceRecord.md) |
| 124 | + - [InsuranceRecordInner](docs/InsuranceRecordInner.md) |
| 125 | + - [MyFuturesTrade](docs/MyFuturesTrade.md) |
| 126 | + - [Position](docs/Position.md) |
| 127 | + |
| 128 | + |
| 129 | +## Documentation For Authorization |
| 130 | + |
| 131 | + |
| 132 | +## api_key |
| 133 | + |
| 134 | +- **Type**: API key |
| 135 | +- **API key parameter name**: KEY |
| 136 | +- **Location**: HTTP header |
| 137 | + |
| 138 | +## api_sign |
| 139 | + |
| 140 | +- **Type**: API key |
| 141 | +- **API key parameter name**: SIGN |
| 142 | +- **Location**: HTTP header |
| 143 | + |
| 144 | +## api_timestamp |
| 145 | + |
| 146 | +- **Type**: API key |
| 147 | +- **API key parameter name**: Timestamp |
| 148 | +- **Location**: HTTP header |
| 149 | + |
| 150 | + |
| 151 | +## Author |
| 152 | + |
| 153 | +support@mail.gate.io |
| 154 | + |
| 155 | + |
0 commit comments