Skip to content

Commit f97e64e

Browse files
committed
Merge branch 'release/4.15.4'
2 parents 2899d9d + 673cb75 commit f97e64e

24 files changed

Lines changed: 1419 additions & 411 deletions

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ 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.3
7-
- Package version: 4.15.3
6+
- API version: 4.15.4
7+
- Package version: 4.15.4
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

@@ -98,6 +98,8 @@ except ApiException as e:
9898

9999
```
100100

101+
For a more complete API usage example, refer to the demo application in [example](example) directory
102+
101103
## Documentation for API Endpoints
102104

103105
All URIs are relative to *https://api.gateio.ws/api/v4*
@@ -199,6 +201,7 @@ Class | Method | HTTP request | Description
199201
*WalletApi* | [**transfer**](docs/WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts
200202
*WalletApi* | [**list_sub_account_transfers**](docs/WalletApi.md#list_sub_account_transfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts
201203
*WalletApi* | [**transfer_with_sub_account**](docs/WalletApi.md#transfer_with_sub_account) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts
204+
*WalletApi* | [**list_withdraw_status**](docs/WalletApi.md#list_withdraw_status) | **GET** /wallet/withdraw_status | Retrieve withdrawal status
202205
*WithdrawalApi* | [**withdraw**](docs/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw
203206

204207

@@ -252,6 +255,7 @@ Class | Method | HTTP request | Description
252255
- [TradeFee](docs/TradeFee.md)
253256
- [Transfer](docs/Transfer.md)
254257
- [TriggerOrderResponse](docs/TriggerOrderResponse.md)
258+
- [WithdrawStatus](docs/WithdrawStatus.md)
255259

256260

257261
## Documentation For Authorization

docs/TradeFee.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
1010
**gt_taker_fee** | **str** | Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional]
1111
**gt_maker_fee** | **str** | Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional]
1212
**loan_fee** | **str** | Loan fee rate of margin lending | [optional]
13+
**point_type** | **str** | Point type. 0 - Initial version. 1 - new version since 202009 | [optional]
1314

1415
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1516

docs/WalletApi.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**transfer**](WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts
1111
[**list_sub_account_transfers**](WalletApi.md#list_sub_account_transfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts
1212
[**transfer_with_sub_account**](WalletApi.md#transfer_with_sub_account) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts
13+
[**list_withdraw_status**](WalletApi.md#list_withdraw_status) | **GET** /wallet/withdraw_status | Retrieve withdrawal status
1314

1415

1516
# **get_deposit_address**
@@ -444,3 +445,70 @@ void (empty response body)
444445

445446
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
446447

448+
# **list_withdraw_status**
449+
> list[WithdrawStatus] list_withdraw_status(currency=currency)
450+
451+
Retrieve withdrawal status
452+
453+
### Example
454+
455+
* Api Key Authentication (apiv4):
456+
```python
457+
from __future__ import print_function
458+
import gate_api
459+
from gate_api.exceptions import ApiException, GateApiException
460+
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
461+
# See configuration.py for a list of all supported configuration parameters.
462+
# The client must configure the authentication and authorization parameters
463+
# in accordance with the API server security policy.
464+
# Examples for each auth method are provided below, use the example that
465+
# satisfies your auth use case.
466+
467+
# Configure APIv4 key authorization
468+
configuration = gate_api.Configuration(
469+
host = "https://api.gateio.ws/api/v4",
470+
key = "YOU_API_KEY",
471+
secret = "YOUR_API_SECRET"
472+
)
473+
474+
api_client = gate_api.ApiClient(configuration)
475+
# Create an instance of the API class
476+
api_instance = gate_api.WalletApi(api_client)
477+
currency = 'BTC' # str | Retrieved specified currency related data (optional)
478+
479+
try:
480+
# Retrieve withdrawal status
481+
api_response = api_instance.list_withdraw_status(currency=currency)
482+
print(api_response)
483+
except GateApiException as ex:
484+
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
485+
except ApiException as e:
486+
print("Exception when calling WalletApi->list_withdraw_status: %s\n" % e)
487+
```
488+
489+
### Parameters
490+
491+
Name | Type | Description | Notes
492+
------------- | ------------- | ------------- | -------------
493+
**currency** | **str**| Retrieved specified currency related data | [optional]
494+
495+
### Return type
496+
497+
[**list[WithdrawStatus]**](WithdrawStatus.md)
498+
499+
### Authorization
500+
501+
[apiv4](../README.md#apiv4)
502+
503+
### HTTP request headers
504+
505+
- **Content-Type**: Not defined
506+
- **Accept**: application/json
507+
508+
### HTTP response details
509+
| Status code | Description | Response headers |
510+
|-------------|-------------|------------------|
511+
**200** | List retrieved | - |
512+
513+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
514+

docs/WithdrawStatus.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# WithdrawStatus
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**currency** | **str** | Currency | [optional]
7+
**name** | **str** | Currency name | [optional]
8+
**name_cn** | **str** | Currency Chinese name | [optional]
9+
**deposit** | **str** | Deposits fee | [optional]
10+
**withdraw_percent** | **str** | Withdrawal fee rate percentage | [optional]
11+
**withdraw_fix** | **str** | Fixed withdrawal fee | [optional]
12+
**withdraw_day_limit** | **str** | Daily allowed withdrawal amount | [optional]
13+
**withdraw_amount_mini** | **str** | Minimum withdrawal amount | [optional]
14+
**withdraw_day_limit_remain** | **str** | Daily withdrawal amount left | [optional]
15+
**withdraw_eachtime_limit** | **str** | Maximum amount for each withdrawal | [optional]
16+
17+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
18+
19+

example/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Example Application
2+
3+
This is a demo application using `gate-api` to show how Gate APIv4 works.
4+
Instead of running it, it is recommended to read the source code to get a general idea of
5+
how this SDK is used. However, you can modify this code directly to implement your own logic.
6+
7+
## Build
8+
9+
1. Clone this project and make sure it is named with `gateapi-python`
10+
2. Run `./build.sh`, then your demo application will be created beside `gateapi-python`
11+
12+
## Run
13+
14+
**READ THIS BEFORE YOU RUN ANYTHING**
15+
16+
**This application is shown for demo only. It will try to use your input API key and secret to
17+
trade, lend and borrow, etc. Make sure you know exactly what it does before running it.**
18+
19+
> The build.sh script will try to initiate a virtualenv environment if it can find virtualenv
20+
> executable. Follow what the script prints before running the demo application
21+
22+
```bash
23+
# run futures demo against TestNet
24+
python app.py futures -k <YOUR_TESTNET_API_KEY> -s <YOUR_TESTNET_API_SECRET> -u fx-api-testnet.gateio.ws
25+
26+
# run futures demo against real trading
27+
python app.py futures -k <YOUR_API_KEY> -s <YOUR_API_SECRET>
28+
29+
# run spot demo
30+
python app.py spot -k <YOUR_API_KEY> -s <YOUR_API_SECRET>
31+
32+
# run margin demo
33+
python app.py margin -k <YOUR_API_KEY> -s <YOUR_API_SECRET>
34+
```

example/app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# !/usr/bin/env python
2+
# coding: utf-8
3+
import logging
4+
from argparse import ArgumentParser
5+
6+
from config import RunConfig
7+
from futures import futures_demo
8+
from margin import margin_demo
9+
from spot import spot_demo
10+
11+
logging.basicConfig(format="%(asctime)s: %(message)s", level=logging.DEBUG)
12+
logger = logging.getLogger(__name__)
13+
14+
15+
def main():
16+
parser = ArgumentParser(description="Run Gate APIv4 demo application")
17+
parser.add_argument("-k", "--key", required=True, help="Gate APIv4 Key")
18+
parser.add_argument("-s", "--secret", required=True, help="Gate APIv4 Secret")
19+
parser.add_argument("-u", "--url", required=False, help="API base URL used to test")
20+
parser.add_argument("tests", nargs='+', help="tests to run")
21+
options = parser.parse_args()
22+
23+
host_used = options.url
24+
if not host_used:
25+
host_used = "https://api.gateio.ws/api/v4"
26+
if not host_used.startswith("http"):
27+
host_used = "https://" + host_used
28+
host_used = host_used.rstrip("/")
29+
if not host_used.endswith("/api/v4"):
30+
host_used += '/api/v4'
31+
32+
run_config = RunConfig(options.key, options.secret, host_used)
33+
for t in options.tests:
34+
logger.info("run %s API demo", t)
35+
if t == 'spot':
36+
spot_demo(run_config)
37+
elif t == 'margin':
38+
margin_demo(run_config)
39+
elif t == 'futures':
40+
futures_demo(run_config)
41+
else:
42+
logger.warning("ignore unknown test %s", t)
43+
44+
45+
if __name__ == '__main__':
46+
main()

example/build.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
WORKDIR="${PWD}/gateapi-demo"
6+
VENV_DIR="$WORKDIR/.venv"
7+
: "${GATEAPI_SOURCE_DIR:=gateapi-python}"
8+
9+
# determine python environment
10+
python=$(command -v python3 || true)
11+
12+
if [ -z "$python" ]; then
13+
python=$(command -v python2 || true)
14+
if [ -z "$python" ]; then
15+
echo >&2 "No python executable found."
16+
exit 1
17+
fi
18+
fi
19+
20+
mkdir -p "$WORKDIR"
21+
22+
virtualenv=$(command -v virtualenv || true)
23+
if [ -z "$virtualenv" ]; then
24+
echo "No virtualenv found. Native python environment will be used"
25+
LOCAL_INSTALL="--user"
26+
else
27+
if [ -n "$VIRTUAL_ENV" ]; then
28+
# find original python path, osx compatible
29+
while true; do
30+
orig=$(readlink "$python")
31+
if [ -z "$orig" ]; then
32+
break
33+
elif [ "$orig" != "${orig#/}" ]; then
34+
python=$orig
35+
break
36+
else
37+
python="$(dirname "${python}")"/"$orig"
38+
fi
39+
done
40+
fi
41+
if [ ! -d "$VENV_DIR" ]; then
42+
"$virtualenv" -p "$python" "$VENV_DIR"
43+
fi
44+
python="$VENV_DIR/bin/python"
45+
fi
46+
47+
echo "Python used: $python"
48+
49+
cd "$GATEAPI_SOURCE_DIR" && "$python" setup.py install ${LOCAL_INSTALL+"$LOCAL_INSTALL"} && cd -
50+
cp "$GATEAPI_SOURCE_DIR"/example/*.py "$WORKDIR"
51+
52+
if [ -n "$virtualenv" ]; then
53+
echo "run \`source $VENV_DIR/bin/activate \` and then "
54+
fi
55+
echo "run \`cd $WORKDIR && $python app.py -h\` for help"

example/config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# !/usr/bin/env python
2+
# coding: utf-8
3+
4+
from six.moves.urllib.parse import urlparse
5+
6+
7+
class RunConfig(object):
8+
9+
def __init__(self, api_key=None, api_secret=None, host_used=None):
10+
# type: (str, str, str) -> None
11+
self.api_key = api_key
12+
self.api_secret = api_secret
13+
self.host_used = host_used
14+
self.use_test = urlparse(host_used).hostname == "fx-api-testnet.gateio.ws"

0 commit comments

Comments
 (0)