-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update according to API update in May and June
- Loading branch information
Showing
73 changed files
with
1,335 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from huobi.client.account import AccountClient | ||
from huobi.constant import * | ||
|
||
account_client = AccountClient(api_key=g_api_key, secret_key=g_secret_key) | ||
transfer_result = account_client.post_account_transfer(36979737, 'spot', 3684354, 122946475, 'spot', 11907558, 'usdt', 1) | ||
transfer_result.print_object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from huobi.client.algo import AlgoClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
symbol_test = "adausdt" | ||
account_id = g_account_id | ||
|
||
algo_client = AlgoClient(api_key=g_api_key, secret_key=g_secret_key) | ||
result = algo_client.get_open_orders() | ||
LogInfo.output_list(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from huobi.client.algo import AlgoClient | ||
from huobi.constant import * | ||
|
||
account_id = g_account_id | ||
client_order_id = "test002" | ||
|
||
# get specific order by clientOrderId | ||
algo_client = AlgoClient(api_key=g_api_key, secret_key=g_secret_key) | ||
result = algo_client.get_order(client_order_id) | ||
result.print_object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from huobi.client.algo import AlgoClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
symbol_test = "adausdt" | ||
account_id = g_account_id | ||
|
||
algo_client = AlgoClient(api_key=g_api_key, secret_key=g_secret_key) | ||
result = algo_client.get_order_history(symbol_test, AlgoOrderStatus.TRIGGERED) | ||
LogInfo.output_list(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from huobi.client.algo import AlgoClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
symbol_test = "adausdt" | ||
account_id = g_account_id | ||
|
||
orders_to_cancel = ["test003", "test001"] | ||
algo_client = AlgoClient(api_key=g_api_key, secret_key=g_secret_key) | ||
result = algo_client.cancel_orders(orders_to_cancel) | ||
result.print_object() | ||
|
||
# order_id = algo_client.create_order(symbol=symbol_test, account_id=account_id, order_type=OrderType.BUY_MARKET, source=OrderSource.API, amount=5.0, price=1.292) | ||
# LogInfo.output("created order id : {id}".format(id=order_id)) | ||
# | ||
# order_id = algo_client.create_order(symbol=symbol_test, account_id=account_id, order_type=OrderType.SELL_MARKET, source=OrderSource.API, amount=1.77, price=None) | ||
# LogInfo.output("created order id : {id}".format(id=order_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from huobi.client.algo import AlgoClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
symbol_test = "adausdt" | ||
account_id = g_account_id | ||
|
||
algo_client = AlgoClient(api_key=g_api_key, secret_key=g_secret_key) | ||
order_id = algo_client.create_order(symbol=symbol_test, account_id=account_id, order_side=OrderSide.BUY, | ||
order_type=AlgoOrderType.LIMIT, order_size=65, order_price=0.08, stop_price=0.085, | ||
client_order_id="test004") | ||
LogInfo.output("created order id : {id}".format(id=order_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from huobi.client.generic import GenericClient | ||
|
||
generic_client = GenericClient() | ||
market_status = generic_client.get_market_status() | ||
print(market_status) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
from huobi.client.market import MarketClient | ||
from huobi.constant import * | ||
|
||
|
||
def callback(mbp_event: 'MbpFullEvent'): | ||
mbp_event.print_object() | ||
|
||
|
||
def error(e: 'HuobiApiException'): | ||
print(e.error_code + e.error_message) | ||
|
||
market_client = MarketClient(init_log=True) | ||
market_client.sub_mbp_full("btcusdt,eosusdt", MbpLevel.MBP20, callback, error) | ||
|
||
market_client = MarketClient(init_log=True) | ||
market_client.sub_mbp_full("btcusdt,eosusdt", MbpLevel.MBP5, callback, error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
apikey_info = subuser_client.get_user_apikey_info(122946475) | ||
LogInfo.output_list(apikey_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
import string | ||
import random | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
userName = ''.join(random.choices(string.ascii_uppercase + string.digits, k=7)) | ||
params = {"userList": [ | ||
{ | ||
"userName": userName, | ||
"note": "huobi" | ||
} | ||
]} | ||
|
||
userList = subuser_client.post_create_subuser(params) | ||
LogInfo.output_list(userList) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
sub_uids = '122946475' | ||
|
||
transferability_result = subuser_client.post_set_subuser_transferability(sub_uids, False) | ||
LogInfo.output_list(transferability_result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
sub_uid = '122946475' | ||
access_key = '7ab679d7-b9fee8ed-9cd4cd8a-bgbfh5tv3f' | ||
|
||
result = subuser_client.post_subuser_apikey_deletion(sub_uid, access_key) | ||
LogInfo.output(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
|
||
otp_token = '746316' | ||
sub_uid = 122946475 | ||
note = "huobi_subuser" | ||
permission = 'readOnly' | ||
# ip_addresses = '' | ||
|
||
result = subuser_client.post_subuser_apikey_generate(otp_token, sub_uid, note, permission) | ||
result.print_object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
|
||
subUid = 122946475 | ||
access_key = "abc" | ||
note = "test" | ||
permission = 'readOnly,trade' | ||
|
||
result = subuser_client.post_subuser_apikey_modification(subUid, access_key, permission=permission, note=note) | ||
result.print_object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from huobi.client.subuser import SubuserClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key) | ||
|
||
subUids = '159284259' | ||
accountType = SubuserTradePrivilegeType.MARGIN | ||
activation = SubUserTradeStatus.DEACTIVATED | ||
|
||
subUserList = subuser_client.post_set_tradable_market(subUids, accountType, activation) | ||
LogInfo.output_list(subUserList) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
from huobi.client.wallet import WalletClient | ||
from huobi.constant import * | ||
from huobi.utils import * | ||
|
||
|
||
wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) | ||
list_obj = wallet_client.get_account_withdraw_address(currency="usdt") | ||
LogInfo.output_list(list_obj) | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.