-
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.
Refine GetAccounts and Add two new API for API update in April 2020
- Loading branch information
Showing
13 changed files
with
423 additions
and
52 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
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,20 @@ | ||
from huobi import RequestClient | ||
from huobi.constant.test import * | ||
from huobi.base.printobject import * | ||
from huobi.model import Account | ||
request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) | ||
account_balance_list = request_client.get_account_balance() | ||
if account_balance_list and len(account_balance_list): | ||
for account in account_balance_list: | ||
print("======= ID", account.id, "=======") | ||
print("Account Status", account.account_state) | ||
print("Account Type", account.account_type) | ||
print("Subtype", account.subtype) | ||
if account.balances and len(account.balances): | ||
for balance in account.balances: | ||
print("\tBalance Currency", balance.currency) | ||
print("\tBalance Type", balance.balance_type) | ||
print("\tBalance", balance.balance) | ||
print() | ||
print() | ||
|
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 import RequestClient | ||
from huobi.constant.test import * | ||
|
||
|
||
def print_obj_list(list_obj): | ||
if list_obj and len(list_obj): | ||
for obj in list_obj: | ||
obj.print_object() | ||
print() | ||
|
||
client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) | ||
list_obj = client.get_sub_user_deposit_address(sub_uid=g_sub_uid, currency="btc") | ||
print_obj_list(list_obj) |
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 import RequestClient | ||
from huobi.constant.test import * | ||
|
||
|
||
def print(deposit_history): | ||
if deposit_history.data and len(deposit_history.data): | ||
print(deposit_history.nextId) | ||
for obj in deposit_history.data: | ||
obj.print_object() | ||
print() | ||
|
||
client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) | ||
deposit_history = client.get_sub_user_deposit_history(sub_uid=g_sub_uid) | ||
print(deposit_history) |
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
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
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,50 @@ | ||
from huobi.model.constant import * | ||
|
||
|
||
class DepositHistory: | ||
""" | ||
The deposit history | ||
:member | ||
id: The transfer id. | ||
currency: The crypto currency to deposit. | ||
txHash: The on-chain transaction hash. | ||
amount: The number of crypto asset transferred in its minimum unit. | ||
address: The deposit source address. | ||
addressTag: The user defined address tag. | ||
deposit_state: The deposit state of this transfer. | ||
created_timestamp: The UNIX formatted timestamp in UTC for the transfer creation. | ||
updated_timestamp: The UNIX formatted timestamp in UTC for the transfer's latest update. | ||
""" | ||
|
||
def __init__(self): | ||
self.data = list() | ||
self.nextId = 0 | ||
|
||
|
||
class History: | ||
|
||
def __init__(self): | ||
self.id = 0 | ||
self.currency = "" | ||
self.txHash = "" | ||
self.chain = "" | ||
self.amount = 0.0 | ||
self.address = "" | ||
self.addressTag = "" | ||
self.deposit_state = WithdrawState.INVALID | ||
self.created_timestamp = 0 | ||
self.updated_timestamp = 0 | ||
|
||
def print_object(self, format_data=""): | ||
from huobi.base.printobject import PrintBasic | ||
PrintBasic.print_basic(self.id, format_data + "ID") | ||
PrintBasic.print_basic(self.currency, format_data + "Currency") | ||
PrintBasic.print_basic(self.chain, format_data + "Chain") | ||
PrintBasic.print_basic(self.txHash, format_data + "Trade Hash") | ||
PrintBasic.print_basic(self.amount, format_data + "Amount") | ||
PrintBasic.print_basic(self.address, format_data + "Address") | ||
PrintBasic.print_basic(self.addressTag, format_data + "Address Tag") | ||
PrintBasic.print_basic(self.deposit_state, format_data + "Deposit State") | ||
PrintBasic.print_basic(self.created_timestamp, format_data + "Create Time") | ||
PrintBasic.print_basic(self.updated_timestamp, format_data + "Update Time") |
Oops, something went wrong.