Skip to content

Commit 9d90577

Browse files
committed
*update
1 parent 83b5c70 commit 9d90577

6 files changed

Lines changed: 88 additions & 56 deletions

File tree

huobi/spot/rest/account.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,40 @@ def __init__(self, access_key: str, secret_key: str, host=HOST_SPOT):
1111

1212
def get_accounts(self) -> json:
1313
path = "/v1/account/accounts"
14-
return get(self.__host, path, access_key=self.__access_key, secret_key=self.__secret_key)
14+
return get(self.__host, path, None, self.__access_key, self.__secret_key)
1515

16-
def get_balance(self, params: dict = None) -> json:
16+
def get_balance(self, params: dict) -> json:
1717
path = "/v1/account/accounts/{}/balance".format(params['account-id'])
18-
return get(self.__host, path, access_key=self.__access_key, secret_key=self.__secret_key)
18+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
1919

2020
def get_valuation(self, params: dict = None) -> json:
2121
path = "/v2/account/valuation"
22-
return get(self.__host, path, params=params, access_key=self.__access_key, secret_key=self.__secret_key)
22+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
2323

24-
def get_uid_valuation(self, params: dict = None) -> json:
24+
def get_type_valuation(self, params: dict) -> json:
2525
path = "/v2/account/asset-valuation"
26-
return get(self.__host, path, params=params, access_key=self.__access_key, secret_key=self.__secret_key)
26+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
2727

28-
def account_transfer(self, params: dict = None) -> json:
28+
def account_transfer(self, params: dict) -> json:
2929
path = "/v1/account/transfer"
30-
return post(self.__host, path, data=params, access_key=self.__access_key, secret_key=self.__secret_key)
30+
return post(self.__host, path, self.__access_key, self.__secret_key, params)
3131

32-
def get_account_history(self, params: dict = None) -> json:
32+
def get_history(self, params: dict) -> json:
3333
path = "/v1/account/history"
34-
return get(self.__host, path, params=params, access_key=self.__access_key, secret_key=self.__secret_key)
34+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
3535

36-
def get_ledger(self, params: dict = None) -> json:
36+
def get_ledger(self, params: dict) -> json:
3737
path = "/v2/account/ledger"
38-
return get(self.__host, path, params=params, access_key=self.__access_key, secret_key=self.__secret_key)
38+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
3939

40-
def futures_transfer(self, params: dict = None) -> json:
40+
def futures_transfer(self, params: dict) -> json:
4141
path = "/v1/futures/transfer"
42-
return post(self.__host, path, data=params, access_key=self.__access_key, secret_key=self.__secret_key)
42+
return post(self.__host, path, self.__access_key, self.__secret_key, params)
4343

4444
def get_point(self, params: dict = None) -> json:
4545
path = "/v2/point/account"
46-
return get(self.__host, path, params=params, access_key=self.__access_key, secret_key=self.__secret_key)
46+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
4747

48-
def point_transfer(self, params: dict = None) -> json:
48+
def point_transfer(self, params: dict) -> json:
4949
path = "/v2/point/transfer"
50-
return post(self.__host, path, data=params, access_key=self.__access_key, secret_key=self.__secret_key)
50+
return post(self.__host, path, self.__access_key, self.__secret_key, params)

huobi/spot/rest/algo_order.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from huobi.utils.http import get, post
2+
from huobi.host import HOST_SPOT
3+
import json
4+
5+
6+
class AlgoOrder:
7+
def __init__(self, access_key: str, secret_key: str, host=HOST_SPOT):
8+
self.__access_key = access_key
9+
self.__secret_key = secret_key
10+
self.__host = host
11+
12+
def order(self, params: dict) -> json:
13+
path = "/v2/algo-orders"
14+
return post(self.__host, path, self.__access_key, self.__secret_key, params)
15+
16+
def cancel(self, params: dict) -> json:
17+
path = "/v2/algo-orders/cancellation"
18+
return post(self.__host, path, self.__access_key, self.__secret_key, params)
19+
20+
def get_open_orders(self, params: dict = None) -> json:
21+
path = "/v2/algo-orders/opening"
22+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
23+
24+
def get_history(self, params: dict) -> json:
25+
path = "/v2/algo-orders/history"
26+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
27+
28+
def get_open_or_failed_orders(self, params: dict) -> json:
29+
path = "/v2/algo-orders/specific"
30+
return get(self.__host, path, params, self.__access_key, self.__secret_key)
31+
32+

huobi/spot/rest/market.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@ class Market:
77
def __init__(self, host=HOST_SPOT):
88
self.__host = host
99

10-
def get_kline(self, params: dict = None) -> json:
10+
def get_kline(self, params: dict) -> json:
1111
path = "/market/history/kline"
1212
return get(self.__host, path, params)
1313

14-
def get_merged(self, params: dict = None) -> json:
14+
def get_merged(self, params: dict) -> json:
1515
path = "/market/detail/merged"
1616
return get(self.__host, path, params)
1717

1818
def get_tickers(self) -> json:
1919
path = "/market/tickers"
2020
return get(self.__host, path)
2121

22-
def get_depth(self, params: dict = None) -> json:
22+
def get_depth(self, params: dict) -> json:
2323
path = "/market/depth"
2424
return get(self.__host, path, params)
2525

26-
def get_trade(self, params: dict = None) -> json:
26+
def get_trade(self, params: dict) -> json:
2727
path = "/market/trade"
2828
return get(self.__host, path, params)
2929

30-
def get_his_trade(self, params: dict = None) -> json:
30+
def get_his_trade(self, params) -> json:
3131
path = "/market/history/trade"
3232
return get(self.__host, path, params)
3333

34-
def get_market_detail(self, params: dict = None) -> json:
34+
def get_market_detail(self, params: dict) -> json:
3535
path = "/market/detail"
3636
return get(self.__host, path, params)
3737

38-
def get_etp(self, params: dict = None) -> json:
38+
def get_etp(self, params: dict) -> json:
3939
path = "/market/etp"
4040
return get(self.__host, path, params)

huobi/spot/rest/order.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ def __init__(self, access_key: str, secret_key: str, host=HOST_SPOT):
99
self.__secret_key = secret_key
1010
self.__host = host
1111

12-
def order(self, params: dict = None) -> json:
12+
def order(self, params: dict) -> json:
1313
path = "/v1/order/orders/place"
1414
return post(self.__host, path, self.__access_key, self.__secret_key, params)
1515

16-
def batch_orders(self, params: list = None) -> json:
16+
def batch_orders(self, params: list) -> json:
1717
path = "/v1/order/batch-orders"
1818
return post(self.__host, path, self.__access_key, self.__secret_key, params)
1919

20-
def cancel_by_id(self, params: dict = None) -> json:
20+
def cancel_by_id(self, params: dict) -> json:
2121
order_id = params['order-id']
2222
path = "/v1/order/orders/{}/submitcancel".format(order_id)
2323
return post(self.__host, path, self.__access_key, self.__secret_key, params)
2424

25-
def cancel_by_cid(self, params: dict = None) -> json:
25+
def cancel_by_cid(self, params: dict) -> json:
2626
path = "/v1/order/orders/submitCancelClientOrder"
2727
return post(self.__host, path, self.__access_key, self.__secret_key, params)
2828

29-
def cancel_all_after(self, params: dict = None) -> json:
29+
def cancel_all_after(self, params: dict) -> json:
3030
path = "/v2/algo-orders/cancel-all-after"
3131
return post(self.__host, path, self.__access_key, self.__secret_key, params)
3232

@@ -42,21 +42,21 @@ def batch_cancel_by_ids(self, params: dict = None) -> json:
4242
path = "/v1/order/orders/batchcancel"
4343
return post(self.__host, path, self.__access_key, self.__secret_key, params)
4444

45-
def get_order_detail_by_id(self, params: dict = None) -> json:
45+
def get_order_detail_by_id(self, params: dict) -> json:
4646
order_id = params['order-id']
4747
path = "/v1/order/orders/{}".format(order_id)
4848
return get(self.__host, path, params, self.__access_key, self.__secret_key)
4949

50-
def get_order_detail_by_cid(self, params: dict = None) -> json:
50+
def get_order_detail_by_cid(self, params: dict) -> json:
5151
path = "/v1/order/orders/getClientOrder"
5252
return get(self.__host, path, params, self.__access_key, self.__secret_key)
5353

54-
def get_match_results_by_id(self, params: dict = None) -> json:
54+
def get_match_results_by_id(self, params: dict) -> json:
5555
order_id = params['order-id']
5656
path = "/v1/order/orders/{}/matchresults".format(order_id)
5757
return get(self.__host, path, params, self.__access_key, self.__secret_key)
5858

59-
def get_orders(self, params: dict = None) -> json:
59+
def get_orders(self, params: dict) -> json:
6060
path = "/v1/order/orders"
6161
return get(self.__host, path, params, self.__access_key, self.__secret_key)
6262

@@ -68,6 +68,6 @@ def get_match_results_by_cri(self, params: dict = None) -> json:
6868
path = "/v1/order/matchresults"
6969
return get(self.__host, path, params, self.__access_key, self.__secret_key)
7070

71-
def get_fee_rate(self, params: dict = None) -> json:
71+
def get_fee_rate(self, params: dict) -> json:
7272
path = "/v2/reference/transact-fee-rate"
7373
return get(self.__host, path, params, self.__access_key, self.__secret_key)

huobi/spot/rest/sub_user.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,75 +9,75 @@ def __init__(self, access_key: str, secret_key: str, host=HOST_SPOT):
99
self.__secret_key = secret_key
1010
self.__host = host
1111

12-
def set_deduct_mode(self, params: dict = None) -> json:
12+
def set_deduct_mode(self, params: dict) -> json:
1313
path = "/v2/sub-user/deduct-mode"
1414
return post(self.__host, path, self.__access_key, self.__secret_key, params)
1515

16-
def get_api_key_info(self, params: dict = None) -> json:
16+
def get_api_key_info(self, params: dict) -> json:
1717
path = "/v2/user/api-key"
1818
return get(self.__host, path, params, self.__access_key, self.__secret_key)
1919

2020
def get_uid(self) -> json:
2121
path = "/v2/user/uid"
2222
return get(self.__host, path, None, self.__access_key, self.__secret_key)
2323

24-
def create(self, params: dict = None) -> json:
24+
def create(self, params: dict) -> json:
2525
path = "/v2/sub-user/creation"
2626
return post(self.__host, path, self.__access_key, self.__secret_key, params)
2727

2828
def get_sub_user_list(self, params: dict = None) -> json:
2929
path = "/v2/sub-user/user-list"
3030
return get(self.__host, path, params, self.__access_key, self.__secret_key)
3131

32-
def management(self, params: dict = None) -> json:
32+
def management(self, params: dict) -> json:
3333
path = "/v2/sub-user/management"
3434
return post(self.__host, path, self.__access_key, self.__secret_key, params)
3535

36-
def get_state(self, params: dict = None) -> json:
36+
def get_state(self, params: dict) -> json:
3737
path = "/v2/sub-user/user-state"
3838
return get(self.__host, path, params, self.__access_key, self.__secret_key)
3939

40-
def set_tradable(self, params: dict = None) -> json:
40+
def set_tradable(self, params: dict) -> json:
4141
path = "/v2/sub-user/tradable-market"
4242
return post(self.__host, path, self.__access_key, self.__secret_key, params)
4343

44-
def set_transferability(self, params: dict = None) -> json:
44+
def set_transferability(self, params: dict) -> json:
4545
path = "/v2/sub-user/transferability"
4646
return post(self.__host, path, self.__access_key, self.__secret_key, params)
4747

48-
def get_account_list(self, params: dict = None) -> json:
48+
def get_account_list(self, params: dict) -> json:
4949
path = "/v2/sub-user/account-list"
5050
return get(self.__host, path, params, self.__access_key, self.__secret_key)
5151

52-
def generate_api_key(self, params: dict = None) -> json:
52+
def generate_api_key(self, params: dict) -> json:
5353
path = "/v2/sub-user/api-key-generation"
5454
return post(self.__host, path, self.__access_key, self.__secret_key, params)
5555

56-
def modify_api_key(self, params: dict = None) -> json:
56+
def modify_api_key(self, params: dict) -> json:
5757
path = "/v2/sub-user/api-key-modification"
5858
return post(self.__host, path, self.__access_key, self.__secret_key, params)
5959

60-
def delete_api_key(self, params: dict = None) -> json:
60+
def delete_api_key(self, params: dict) -> json:
6161
path = "/v2/sub-user/api-key-deletion"
6262
return post(self.__host, path, self.__access_key, self.__secret_key, params)
6363

64-
def transfer(self, params: dict = None) -> json:
64+
def transfer(self, params: dict) -> json:
6565
path = "/v1/subuser/transfer"
6666
return post(self.__host, path, self.__access_key, self.__secret_key, params)
6767

68-
def get_deposit_address(self, params: dict = None) -> json:
68+
def get_deposit_address(self, params: dict) -> json:
6969
path = "/v2/sub-user/deposit-address"
7070
return get(self.__host, path, params, self.__access_key, self.__secret_key)
7171

72-
def get_deposit(self, params: dict = None) -> json:
72+
def get_deposit(self, params: dict) -> json:
7373
path = "/v2/sub-user/query-deposit"
7474
return get(self.__host, path, params, self.__access_key, self.__secret_key)
7575

7676
def get_aggregate_balance(self) -> json:
7777
path = "/v1/subuser/aggregate-balance"
7878
return get(self.__host, path, None, self.__access_key, self.__secret_key)
7979

80-
def get_balance(self, params: dict = None) -> json:
80+
def get_balance(self, params: dict) -> json:
8181
sub_uid = params['sub-uid']
8282
path = "/v1/account/accounts/{}".format(sub_uid)
8383
return get(self.__host, path, params, self.__access_key, self.__secret_key)

huobi/spot/rest/wallet.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ def __init__(self, access_key: str, secret_key: str, host=HOST_SPOT):
99
self.__secret_key = secret_key
1010
self.__host = host
1111

12-
def get_deposit_address(self, params: dict = None) -> json:
12+
def get_deposit_address(self, params: dict) -> json:
1313
path = "/v2/account/deposit/address"
1414
return get(self.__host, path, params, self.__access_key, self.__secret_key)
1515

16-
def get_withdraw_quota(self, params: dict = None) -> json:
16+
def get_withdraw_quota(self, params: dict) -> json:
1717
path = "/v2/account/withdraw/quota"
1818
return get(self.__host, path, params, self.__access_key, self.__secret_key)
1919

20-
def get_withdraw_address(self, params: dict = None) -> json:
20+
def get_withdraw_address(self, params: dict) -> json:
2121
path = "/v2/account/withdraw/address"
2222
return get(self.__host, path, params, self.__access_key, self.__secret_key)
2323

24-
def withdraw(self, params: dict = None) -> json:
24+
def withdraw(self, params: dict) -> json:
2525
path = "/v1/dw/withdraw/api/create"
2626
return post(self.__host, path, self.__access_key, self.__secret_key, params)
2727

28-
def get_withdraw_info(self, params: dict = None) -> json:
28+
def get_withdraw_info(self, params: dict) -> json:
2929
path = "/v1/query/withdraw/client-order-id"
3030
return get(self.__host, path, params, self.__access_key, self.__secret_key)
3131

32-
def cancel(self, params: dict = None) -> json:
32+
def cancel(self, params: dict) -> json:
3333
withdraw_id = params['withdraw-id']
3434
path = "/v1/dw/withdraw-virtual/{}/cancel".format(withdraw_id)
3535
return post(self.__host, path, self.__access_key, self.__secret_key, params)
3636

37-
def get_deposit_withdraw_info(self, params: dict = None) -> json:
37+
def get_deposit_withdraw_info(self, params: dict) -> json:
3838
path = "/v1/query/deposit-withdraw"
3939
return get(self.__host, path, params, self.__access_key, self.__secret_key)

0 commit comments

Comments
 (0)