You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
your example getbalance.py not working. base on the log, looks like you try to create instance from class_name, but didn't expected dictionary object.
`
huobi/utils/json_parser.py
def fill_obj(dict_data, class_name=object):
obj = class_name()
for ks, vs in dict_data.items():
obj_key = key_trans(ks)
# print("===== fill_obj =====", ks, obj_key, str(vs))
if hasattr(obj, obj_key):
setattr(obj, obj_key, vs)
continue
return obj
`
account/get_balance.py", line 21, in parse def parse(dict_data): data = dict_data.get("data", {}) return default_parse(data, AccountBalance, {}) <<<< but why you pass dictionary in?
Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/Users/zen/code/bayes_excersice/src/tradingfirm/platforms/huobi_api.py", line 326, in <module> list_obj = account_client.get_balance(account_id=spot_account_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/client/account.py", line 34, in get_balance return GetBalanceService(params).request(**self.__kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/service/account/get_balance.py", line 23, in request return RestApiSyncClient(**kwargs).request_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/restapi_sync_client.py", line 155, in request_process return self.request_process_product(method, url, params, parse) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/restapi_sync_client.py", line 160, in request_process_product return call_sync(request) ^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/impl/restapi_invoker.py", line 62, in call_sync return request.json_parser(dict_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/service/account/get_balance.py", line 21, in parse return default_parse(data, AccountBalance, {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 46, in default_parse new_value = fill_obj_list(outer_value, inner_class_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 26, in fill_obj_list inner_obj = fill_obj(row, class_name) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 12, in fill_obj obj = class_name() ^^^^^^^^^^^^ TypeError: 'dict' object is not callable
The text was updated successfully, but these errors were encountered:
your example getbalance.py not working. base on the log, looks like you try to create instance from class_name, but didn't expected dictionary object.
`
huobi/utils/json_parser.py
def fill_obj(dict_data, class_name=object):
obj = class_name()
for ks, vs in dict_data.items():
obj_key = key_trans(ks)
# print("===== fill_obj =====", ks, obj_key, str(vs))
if hasattr(obj, obj_key):
setattr(obj, obj_key, vs)
continue
return obj
`
account/get_balance.py", line 21, in parse def parse(dict_data): data = dict_data.get("data", {}) return default_parse(data, AccountBalance, {}) <<<< but why you pass dictionary in?
Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/Users/zen/code/bayes_excersice/src/tradingfirm/platforms/huobi_api.py", line 326, in <module> list_obj = account_client.get_balance(account_id=spot_account_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/client/account.py", line 34, in get_balance return GetBalanceService(params).request(**self.__kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/service/account/get_balance.py", line 23, in request return RestApiSyncClient(**kwargs).request_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/restapi_sync_client.py", line 155, in request_process return self.request_process_product(method, url, params, parse) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/restapi_sync_client.py", line 160, in request_process_product return call_sync(request) ^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/connection/impl/restapi_invoker.py", line 62, in call_sync return request.json_parser(dict_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/service/account/get_balance.py", line 21, in parse return default_parse(data, AccountBalance, {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 46, in default_parse new_value = fill_obj_list(outer_value, inner_class_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 26, in fill_obj_list inner_obj = fill_obj(row, class_name) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zen/code/bayes_excersice/huobi/utils/json_parser.py", line 12, in fill_obj obj = class_name() ^^^^^^^^^^^^ TypeError: 'dict' object is not callable
The text was updated successfully, but these errors were encountered: