|
@@ -78,6 +78,30 @@ def cancel_order(order_no=None):
|
|
|
print('Order cancelling failed with message:', response['error_message'])
|
|
|
|
|
|
|
|
|
+def change_password(password=None, retype_password=None):
|
|
|
+ if password is None:
|
|
|
+ while True:
|
|
|
+ if sys.stdin.isatty():
|
|
|
+ password = getpass('New password: ')
|
|
|
+ retype_password = getpass('Retype password: ')
|
|
|
+ else:
|
|
|
+ password = input('New password: ')
|
|
|
+ retype_password = getpass('Retype password: ')
|
|
|
+ if password == retype_password:
|
|
|
+ break
|
|
|
+ print('Passwords do not match.')
|
|
|
+
|
|
|
+ fake_loading_bar('Validating password', duration=1.2)
|
|
|
+ fake_loading_bar('Changing password', duration=5.2)
|
|
|
+ response = client_request('change_password', {"session_id": connection.session_id, "password": password})
|
|
|
+
|
|
|
+ if 'error_message' in response:
|
|
|
+ print('Changing password failed with message:', response['error_message'])
|
|
|
+
|
|
|
+ fake_loading_bar('Signing out', duration=0.7)
|
|
|
+ connection.session_id = None
|
|
|
+
|
|
|
+
|
|
|
# noinspection PyShadowingBuiltins
|
|
|
def help():
|
|
|
print('Allowed commands:')
|
|
@@ -214,7 +238,7 @@ def sell(amount=None, object_name=None, limit=None, stop_loss=None, time_until_e
|
|
|
|
|
|
|
|
|
def orders():
|
|
|
- fake_loading_bar('Validating Key', duration=0.9)
|
|
|
+ fake_loading_bar('Loading Data', duration=0.9)
|
|
|
response = client_request('orders', {"session_id": connection.session_id})
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
@@ -231,7 +255,7 @@ def orders():
|
|
|
def orders_on(object_name=None):
|
|
|
if object_name is None: # TODO list some available objects
|
|
|
object_name = input('Name of object to check: ')
|
|
|
- fake_loading_bar('Validating Key', duration=2.3)
|
|
|
+ fake_loading_bar('Loading Data', duration=2.3)
|
|
|
response = client_request('orders_on', {"session_id": connection.session_id, "ownable": object_name})
|
|
|
success = 'data' in response
|
|
|
if success:
|