|
@@ -391,7 +391,7 @@ def trades_on(obj_name=None, limit=5):
|
|
limit = float(limit)
|
|
limit = float(limit)
|
|
if obj_name is None: # TODO list some available objects
|
|
if obj_name is None: # TODO list some available objects
|
|
obj_name = input('Name of object to check: ')
|
|
obj_name = input('Name of object to check: ')
|
|
- fake_loading_bar('Loading Data', duration=1.3)
|
|
|
|
|
|
+ fake_loading_bar('Loading Data', duration=0.34*limit)
|
|
response = client_request('trades_on', {"session_id": connection.session_id,
|
|
response = client_request('trades_on', {"session_id": connection.session_id,
|
|
"ownable": obj_name,
|
|
"ownable": obj_name,
|
|
"limit": limit})
|
|
"limit": limit})
|
|
@@ -409,7 +409,7 @@ def trades_on(obj_name=None, limit=5):
|
|
|
|
|
|
def trades(limit=10):
|
|
def trades(limit=10):
|
|
limit = float(limit)
|
|
limit = float(limit)
|
|
- fake_loading_bar('Loading Data', duration=2.7)
|
|
|
|
|
|
+ fake_loading_bar('Loading Data', duration=limit*0.27)
|
|
response = client_request('trades', {"session_id": connection.session_id,
|
|
response = client_request('trades', {"session_id": connection.session_id,
|
|
"limit": limit})
|
|
"limit": limit})
|
|
success = 'data' in response
|
|
success = 'data' in response
|
|
@@ -430,24 +430,21 @@ def old_orders(include_canceled=None, include_executed=None, limit=10):
|
|
include_canceled = yn_dialog('Include canceled/expired orders in list?')
|
|
include_canceled = yn_dialog('Include canceled/expired orders in list?')
|
|
if include_executed is None:
|
|
if include_executed is None:
|
|
include_executed = yn_dialog('Include fully executed orders in list?')
|
|
include_executed = yn_dialog('Include fully executed orders in list?')
|
|
- if not include_canceled and not include_executed:
|
|
|
|
- data = []
|
|
|
|
|
|
+ fake_loading_bar('Loading Data', duration=limit*0.37)
|
|
|
|
+ response = client_request('old_orders', {"session_id": connection.session_id,
|
|
|
|
+ "include_canceled": include_canceled,
|
|
|
|
+ "include_executed": include_executed,
|
|
|
|
+ "limit": limit})
|
|
|
|
+ success = 'data' in response
|
|
|
|
+ if success:
|
|
|
|
+ print(my_tabulate(response['data'],
|
|
|
|
+ headers=['Buy?', 'Name', 'Size', 'Limit', 'Expiry', 'No.', 'Status'],
|
|
|
|
+ tablefmt="pipe"))
|
|
else:
|
|
else:
|
|
- fake_loading_bar('Loading Data', duration=2.7)
|
|
|
|
- response = client_request('old_orders', {"session_id": connection.session_id,
|
|
|
|
- "include_canceled": include_canceled,
|
|
|
|
- "include_executed": include_executed,
|
|
|
|
- "limit": limit})
|
|
|
|
- success = 'data' in response
|
|
|
|
- if success:
|
|
|
|
- print(my_tabulate(response['data'],
|
|
|
|
- headers=['Buy?', 'Name', 'Size', 'Limit', 'Expiry', 'No.', 'Status'],
|
|
|
|
- tablefmt="pipe"))
|
|
|
|
|
|
+ if 'error_message' in response:
|
|
|
|
+ print('Order access failed with message:', response['error_message'])
|
|
else:
|
|
else:
|
|
- if 'error_message' in response:
|
|
|
|
- print('Order access failed with message:', response['error_message'])
|
|
|
|
- else:
|
|
|
|
- print('Order access failed.')
|
|
|
|
|
|
+ print('Order access failed.')
|
|
|
|
|
|
|
|
|
|
# noinspection PyShadowingBuiltins
|
|
# noinspection PyShadowingBuiltins
|