|
@@ -91,7 +91,7 @@ def cancel_order(order_no=None):
|
|
print('Order cancelling failed with message:', response['error_message'])
|
|
print('Order cancelling failed with message:', response['error_message'])
|
|
|
|
|
|
|
|
|
|
-def change_password(password=None, retype_pw=None):
|
|
|
|
|
|
+def change_pw(password=None, retype_pw=None):
|
|
if password != retype_pw:
|
|
if password != retype_pw:
|
|
password = None
|
|
password = None
|
|
if password is None:
|
|
if password is None:
|
|
@@ -210,9 +210,9 @@ def yn_dialog(msg):
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
-def buy(object_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
|
|
- if object_name is None: # TODO list some available objects
|
|
|
|
- object_name = input('Name of object to buy: ')
|
|
|
|
|
|
+def buy(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
|
|
+ if obj_name is None: # TODO list some available objects
|
|
|
|
+ obj_name = input('Name of object to buy: ')
|
|
if amount is None:
|
|
if amount is None:
|
|
amount = input('Amount: ')
|
|
amount = input('Amount: ')
|
|
if limit == '':
|
|
if limit == '':
|
|
@@ -234,7 +234,7 @@ def buy(object_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
response = client_request('order', {"buy": True,
|
|
response = client_request('order', {"buy": True,
|
|
"session_id": connection.session_id,
|
|
"session_id": connection.session_id,
|
|
"amount": amount,
|
|
"amount": amount,
|
|
- "ownable": object_name,
|
|
|
|
|
|
+ "ownable": obj_name,
|
|
"limit": limit,
|
|
"limit": limit,
|
|
"stop_loss": stop_loss,
|
|
"stop_loss": stop_loss,
|
|
"time_until_expiration": expiry})
|
|
"time_until_expiration": expiry})
|
|
@@ -245,9 +245,9 @@ def buy(object_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
'to see if the order has been executed already.')
|
|
'to see if the order has been executed already.')
|
|
|
|
|
|
|
|
|
|
-def sell(object_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
|
|
- if object_name is None: # TODO list some available objects
|
|
|
|
- object_name = input('Name of object to sell: ')
|
|
|
|
|
|
+def sell(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
|
|
+ if obj_name is None: # TODO list some available objects
|
|
|
|
+ obj_name = input('Name of object to sell: ')
|
|
if amount is None:
|
|
if amount is None:
|
|
amount = input('Amount: ')
|
|
amount = input('Amount: ')
|
|
if limit == '':
|
|
if limit == '':
|
|
@@ -269,7 +269,7 @@ def sell(object_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
response = client_request('order', {"buy": False,
|
|
response = client_request('order', {"buy": False,
|
|
"session_id": connection.session_id,
|
|
"session_id": connection.session_id,
|
|
"amount": amount,
|
|
"amount": amount,
|
|
- "ownable": object_name,
|
|
|
|
|
|
+ "ownable": obj_name,
|
|
"limit": limit,
|
|
"limit": limit,
|
|
"stop_loss": stop_loss,
|
|
"stop_loss": stop_loss,
|
|
"time_until_expiration": expiry})
|
|
"time_until_expiration": expiry})
|
|
@@ -295,11 +295,11 @@ def orders():
|
|
print('Order access failed.')
|
|
print('Order access failed.')
|
|
|
|
|
|
|
|
|
|
-def orders_on(object_name=None):
|
|
|
|
- if object_name is None: # TODO list some available objects
|
|
|
|
- object_name = input('Name of object to check: ')
|
|
|
|
|
|
+def orders_on(obj_name=None):
|
|
|
|
+ if obj_name is None: # TODO list some available objects
|
|
|
|
+ obj_name = input('Name of object to check: ')
|
|
fake_loading_bar('Loading Data', duration=2.3)
|
|
fake_loading_bar('Loading Data', duration=2.3)
|
|
- response = client_request('orders_on', {"session_id": connection.session_id, "ownable": object_name})
|
|
|
|
|
|
+ response = client_request('orders_on', {"session_id": connection.session_id, "ownable": obj_name})
|
|
success = 'data' in response
|
|
success = 'data' in response
|
|
if success:
|
|
if success:
|
|
print(_my_tabulate(response['data'],
|
|
print(_my_tabulate(response['data'],
|
|
@@ -312,18 +312,18 @@ def orders_on(object_name=None):
|
|
print('Order access failed.')
|
|
print('Order access failed.')
|
|
|
|
|
|
|
|
|
|
-def gift(username=None, object_name=None, amount=None):
|
|
|
|
|
|
+def gift(username=None, obj_name=None, amount=None):
|
|
if username is None:
|
|
if username is None:
|
|
username = input('Username of recipient: ')
|
|
username = input('Username of recipient: ')
|
|
- if object_name is None:
|
|
|
|
- object_name = input('Name of object to give: ')
|
|
|
|
|
|
+ if obj_name is None:
|
|
|
|
+ obj_name = input('Name of object to give: ')
|
|
if amount is None:
|
|
if amount is None:
|
|
amount = input('How many?: ')
|
|
amount = input('How many?: ')
|
|
fake_loading_bar('Sending Gift', duration=4.2)
|
|
fake_loading_bar('Sending Gift', duration=4.2)
|
|
response = client_request('gift',
|
|
response = client_request('gift',
|
|
{"session_id": connection.session_id,
|
|
{"session_id": connection.session_id,
|
|
"username": username,
|
|
"username": username,
|
|
- "object_name": object_name,
|
|
|
|
|
|
+ "object_name": obj_name,
|
|
"amount": amount})
|
|
"amount": amount})
|
|
if 'error_message' in response:
|
|
if 'error_message' in response:
|
|
print('Order access failed with message:', response['error_message'])
|
|
print('Order access failed with message:', response['error_message'])
|
|
@@ -346,11 +346,11 @@ def news():
|
|
print('Order access failed.')
|
|
print('Order access failed.')
|
|
|
|
|
|
|
|
|
|
-def transactions(object_name=None):
|
|
|
|
- if object_name is None: # TODO list some available objects
|
|
|
|
- object_name = input('Name of object to check: ')
|
|
|
|
|
|
+def transactions(obj_name=None):
|
|
|
|
+ if obj_name is None: # TODO list some available objects
|
|
|
|
+ obj_name = input('Name of object to check: ')
|
|
fake_loading_bar('Loading Data', duration=1.3)
|
|
fake_loading_bar('Loading Data', duration=1.3)
|
|
- response = client_request('transactions', {"session_id": connection.session_id, "ownable": object_name})
|
|
|
|
|
|
+ response = client_request('transactions', {"session_id": connection.session_id, "ownable": obj_name})
|
|
success = 'data' in response
|
|
success = 'data' in response
|
|
if success:
|
|
if success:
|
|
print(_my_tabulate(response['data'],
|
|
print(_my_tabulate(response['data'],
|