Skip to content

Commit e37291a

Browse files
committed
add return type hints; format code
1 parent 2695d30 commit e37291a

File tree

86 files changed

+4414
-5340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4414
-5340
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ coverage.xml
4545
*,cover
4646
.hypothesis/
4747
venv/
48+
.venv/
4849
.python-version
50+
.pytest_cache
4951

5052
# Translations
5153
*.mo

.gitlab-ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ref: https://docs.gitlab.com/ee/ci/README.html
2+
3+
stages:
4+
- test
5+
6+
.nosetest:
7+
stage: test
8+
script:
9+
- pip install -r requirements.txt
10+
- pip install -r test-requirements.txt
11+
- pytest --cov=gate_api
12+
13+
nosetest-2.7:
14+
extends: .nosetest
15+
image: python:2.7-alpine
16+
nosetest-3.3:
17+
extends: .nosetest
18+
image: python:3.3-alpine
19+
nosetest-3.4:
20+
extends: .nosetest
21+
image: python:3.4-alpine
22+
nosetest-3.5:
23+
extends: .nosetest
24+
image: python:3.5-alpine
25+
nosetest-3.6:
26+
extends: .nosetest
27+
image: python:3.6-alpine
28+
nosetest-3.7:
29+
extends: .nosetest
30+
image: python:3.7-alpine
31+
nosetest-3.8:
32+
extends: .nosetest
33+
image: python:3.8-alpine

.openapi-generator-ignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

.openapi-generator/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ python:
66
- "3.3"
77
- "3.4"
88
- "3.5"
9-
#- "3.5-dev" # 3.5 development branch
10-
#- "nightly" # points to the latest development branch e.g. 3.6-dev
9+
- "3.6"
10+
- "3.7"
11+
- "3.8"
1112
# command to install dependencies
12-
install: "pip install -r requirements.txt"
13+
install:
14+
- "pip install -r requirements.txt"
15+
- "pip install -r test-requirements.txt"
1316
# command to run tests
14-
script: nosetests
17+
script: pytest --cov=gate_api

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,35 @@ APIv4 provides spot, margin and futures trading operations. There are public API
33

44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
55

6-
- API version: 4.15.1
7-
- Package version: 4.15.1
6+
- API version: 4.15.2
7+
- Package version: 4.15.2
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)
1010

11+
## Versioning
12+
13+
Trying our best to follow the [semantic versioning](https://semver.org/), while enjoying recent features
14+
provided by programming language and libraries, from 4.15.2, one major versioning difference will be
15+
introduced:
16+
17+
If extra code rewrite is required when you upgrade the SDK, such as:
18+
19+
- some outdated programming language version support is dropped
20+
- API method signature has breaking changes.
21+
22+
**the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's
23+
instead of resetting to 0**, so that you can recognize it has some breaking changes, but still getting
24+
the idea of from which REST API version the change is introduced.
25+
26+
For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce
27+
some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release
28+
will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH
29+
version are identical to REST API's instead of resetting them to 0)
30+
31+
If MAJOR version is incremented, make sure you read the release note on
32+
[Releases](https://github.com/gateio/gateapi-python/releases)
33+
page
34+
1135
## Requirements.
1236

1337
Python 2.7 and 3.4+
@@ -156,6 +180,7 @@ Class | Method | HTTP request | Description
156180
*SpotApi* | [**list_order_book**](docs/SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book
157181
*SpotApi* | [**list_trades**](docs/SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades
158182
*SpotApi* | [**list_candlesticks**](docs/SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks
183+
*SpotApi* | [**get_fee**](docs/SpotApi.md#get_fee) | **GET** /spot/fee | Query user trading fee rates
159184
*SpotApi* | [**list_spot_accounts**](docs/SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts
160185
*SpotApi* | [**create_batch_orders**](docs/SpotApi.md#create_batch_orders) | **POST** /spot/batch_orders | Create a batch of orders
161186
*SpotApi* | [**list_all_open_orders**](docs/SpotApi.md#list_all_open_orders) | **GET** /spot/open_orders | List all open orders
@@ -222,6 +247,7 @@ Class | Method | HTTP request | Description
222247
- [SubAccountTransfer](docs/SubAccountTransfer.md)
223248
- [Ticker](docs/Ticker.md)
224249
- [Trade](docs/Trade.md)
250+
- [TradeFee](docs/TradeFee.md)
225251
- [Transfer](docs/Transfer.md)
226252
- [TriggerOrderResponse](docs/TriggerOrderResponse.md)
227253

docs/DeliveryApi.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ api_client = gate_api.ApiClient(configuration)
111111
# Create an instance of the API class
112112
api_instance = gate_api.DeliveryApi(api_client)
113113
settle = 'usdt' # str | Settle currency
114-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
114+
contract = 'BTC_USDT_20200814' # str | Futures contract
115115

116116
try:
117117
# Get a single contract
@@ -171,7 +171,7 @@ api_client = gate_api.ApiClient(configuration)
171171
# Create an instance of the API class
172172
api_instance = gate_api.DeliveryApi(api_client)
173173
settle = 'usdt' # str | Settle currency
174-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
174+
contract = 'BTC_USDT_20200814' # str | Futures contract
175175
interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0')
176176
limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10)
177177

@@ -233,7 +233,7 @@ api_client = gate_api.ApiClient(configuration)
233233
# Create an instance of the API class
234234
api_instance = gate_api.DeliveryApi(api_client)
235235
settle = 'usdt' # str | Settle currency
236-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
236+
contract = 'BTC_USDT_20200814' # str | Futures contract
237237
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
238238
last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional)
239239
_from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)
@@ -301,7 +301,7 @@ api_client = gate_api.ApiClient(configuration)
301301
# Create an instance of the API class
302302
api_instance = gate_api.DeliveryApi(api_client)
303303
settle = 'usdt' # str | Settle currency
304-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
304+
contract = 'BTC_USDT_20200814' # str | Futures contract
305305
_from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)
306306
to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional)
307307
limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100)
@@ -367,7 +367,7 @@ api_client = gate_api.ApiClient(configuration)
367367
# Create an instance of the API class
368368
api_instance = gate_api.DeliveryApi(api_client)
369369
settle = 'usdt' # str | Settle currency
370-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
370+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
371371

372372
try:
373373
# List futures tickers
@@ -695,7 +695,7 @@ api_client = gate_api.ApiClient(configuration)
695695
# Create an instance of the API class
696696
api_instance = gate_api.DeliveryApi(api_client)
697697
settle = 'usdt' # str | Settle currency
698-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
698+
contract = 'BTC_USDT_20200814' # str | Futures contract
699699

700700
try:
701701
# Get single position
@@ -762,7 +762,7 @@ api_client = gate_api.ApiClient(configuration)
762762
# Create an instance of the API class
763763
api_instance = gate_api.DeliveryApi(api_client)
764764
settle = 'usdt' # str | Settle currency
765-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
765+
contract = 'BTC_USDT_20200814' # str | Futures contract
766766
change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise.
767767

768768
try:
@@ -831,7 +831,7 @@ api_client = gate_api.ApiClient(configuration)
831831
# Create an instance of the API class
832832
api_instance = gate_api.DeliveryApi(api_client)
833833
settle = 'usdt' # str | Settle currency
834-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
834+
contract = 'BTC_USDT_20200814' # str | Futures contract
835835
leverage = '10' # str | New position leverage
836836

837837
try:
@@ -900,7 +900,7 @@ api_client = gate_api.ApiClient(configuration)
900900
# Create an instance of the API class
901901
api_instance = gate_api.DeliveryApi(api_client)
902902
settle = 'usdt' # str | Settle currency
903-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
903+
contract = 'BTC_USDT_20200814' # str | Futures contract
904904
risk_limit = '10' # str | New position risk limit
905905

906906
try:
@@ -972,7 +972,7 @@ api_client = gate_api.ApiClient(configuration)
972972
api_instance = gate_api.DeliveryApi(api_client)
973973
settle = 'usdt' # str | Settle currency
974974
status = 'open' # str | List orders based on status
975-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
975+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
976976
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
977977
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
978978
last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional)
@@ -1050,7 +1050,7 @@ api_client = gate_api.ApiClient(configuration)
10501050
# Create an instance of the API class
10511051
api_instance = gate_api.DeliveryApi(api_client)
10521052
settle = 'usdt' # str | Settle currency
1053-
futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder |
1053+
futures_order = gate_api.FuturesOrder() # FuturesOrder |
10541054

10551055
try:
10561056
# Create a futures order
@@ -1119,7 +1119,7 @@ api_client = gate_api.ApiClient(configuration)
11191119
# Create an instance of the API class
11201120
api_instance = gate_api.DeliveryApi(api_client)
11211121
settle = 'usdt' # str | Settle currency
1122-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract
1122+
contract = 'BTC_USDT_20200814' # str | Futures contract
11231123
side = 'ask' # str | All bids or asks. Both included in not specified (optional)
11241124

11251125
try:
@@ -1324,7 +1324,7 @@ api_client = gate_api.ApiClient(configuration)
13241324
# Create an instance of the API class
13251325
api_instance = gate_api.DeliveryApi(api_client)
13261326
settle = 'usdt' # str | Settle currency
1327-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
1327+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
13281328
order = 12345 # int | Futures order ID, return related data only if specified (optional)
13291329
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
13301330
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
@@ -1401,7 +1401,7 @@ api_client = gate_api.ApiClient(configuration)
14011401
# Create an instance of the API class
14021402
api_instance = gate_api.DeliveryApi(api_client)
14031403
settle = 'usdt' # str | Settle currency
1404-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
1404+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
14051405
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
14061406

14071407
try:
@@ -1470,7 +1470,7 @@ api_client = gate_api.ApiClient(configuration)
14701470
# Create an instance of the API class
14711471
api_instance = gate_api.DeliveryApi(api_client)
14721472
settle = 'usdt' # str | Settle currency
1473-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
1473+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
14741474
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
14751475
at = 0 # int | Specify a liquidation timestamp (optional) (default to 0)
14761476

@@ -1541,7 +1541,7 @@ api_client = gate_api.ApiClient(configuration)
15411541
# Create an instance of the API class
15421542
api_instance = gate_api.DeliveryApi(api_client)
15431543
settle = 'usdt' # str | Settle currency
1544-
contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional)
1544+
contract = 'BTC_USDT_20200814' # str | Futures contract (optional)
15451545
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
15461546
at = 0 # int | Specify a settlement timestamp (optional) (default to 0)
15471547

@@ -1685,7 +1685,7 @@ api_client = gate_api.ApiClient(configuration)
16851685
# Create an instance of the API class
16861686
api_instance = gate_api.DeliveryApi(api_client)
16871687
settle = 'usdt' # str | Settle currency
1688-
futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder |
1688+
futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder |
16891689

16901690
try:
16911691
# Create a price-triggered order

docs/DeliveryContract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Futures contract details
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**name** | **str** | Futures contract | [optional]
8-
**underling** | **str** | Underlying | [optional]
8+
**underlying** | **str** | Underlying | [optional]
99
**cycle** | **str** | Cycle type, e.g. WEEKLY, QUARTERLY | [optional]
1010
**type** | **str** | Futures contract type | [optional]
1111
**quanto_multiplier** | **str** | Multiplier used in converting from invoicing to settlement currency in quanto futures | [optional]

docs/FuturesApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ api_client = gate_api.ApiClient(configuration)
11101110
# Create an instance of the API class
11111111
api_instance = gate_api.FuturesApi(api_client)
11121112
settle = 'btc' # str | Settle currency (default to 'btc')
1113-
futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder |
1113+
futures_order = gate_api.FuturesOrder() # FuturesOrder |
11141114

11151115
try:
11161116
# Create a futures order
@@ -1674,7 +1674,7 @@ api_client = gate_api.ApiClient(configuration)
16741674
# Create an instance of the API class
16751675
api_instance = gate_api.FuturesApi(api_client)
16761676
settle = 'btc' # str | Settle currency (default to 'btc')
1677-
futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder |
1677+
futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder |
16781678

16791679
try:
16801680
# Create a price-triggered order

docs/FuturesErrorResponse.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/GateErrorResponse.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)