Skip to content

Commit 368b943

Browse files
committed
initial commit
0 parents  commit 368b943

34 files changed

Lines changed: 8977 additions & 0 deletions

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
venv/
48+
.python-version
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
57+
# Sphinx documentation
58+
docs/_build/
59+
60+
# PyBuilder
61+
target/
62+
63+
#Ipython Notebook
64+
.ipynb_checkpoints

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3.1

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "2.7"
5+
- "3.2"
6+
- "3.3"
7+
- "3.4"
8+
- "3.5"
9+
#- "3.5-dev" # 3.5 development branch
10+
#- "nightly" # points to the latest development branch e.g. 3.6-dev
11+
# command to install dependencies
12+
install: "pip install -r requirements.txt"
13+
# command to run tests
14+
script: nosetests

README.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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

Comments
 (0)