|
@@ -145,6 +145,8 @@ def help():
|
|
print(' All parameters for all commands are optional!')
|
|
print(' All parameters for all commands are optional!')
|
|
print(' Commands can be combined in one line with ; between them.')
|
|
print(' Commands can be combined in one line with ; between them.')
|
|
print(' Parameters are separated with any whitespace.')
|
|
print(' Parameters are separated with any whitespace.')
|
|
|
|
+ print(' Use . as a decimal separator.')
|
|
|
|
+ print(' Use 0/1 for boolean parameters (other strings might work).')
|
|
|
|
|
|
|
|
|
|
def _my_tabulate(data, **params):
|
|
def _my_tabulate(data, **params):
|
|
@@ -207,6 +209,7 @@ def yn_dialog(msg):
|
|
return True
|
|
return True
|
|
if result == 'n':
|
|
if result == 'n':
|
|
return False
|
|
return False
|
|
|
|
+ print('Type in \'y\' or \'n\'!')
|
|
|
|
|
|
|
|
|
|
def buy(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
def buy(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
@@ -224,11 +227,21 @@ def buy(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
|
|
stop_loss = None
|
|
stop_loss = None
|
|
if limit is not None and stop_loss == '':
|
|
if limit is not None and stop_loss == '':
|
|
stop_loss = yn_dialog('Is this a stop-loss limit?')
|
|
stop_loss = yn_dialog('Is this a stop-loss limit?')
|
|
|
|
+ if float(limit) <= 0 and input(input('Are you sure you want to use such a low limit (limit=' + str(
|
|
|
|
+ limit) + '? (type in "yes" or something else):') != 'yes'):
|
|
|
|
+ print('Order was not placed.')
|
|
|
|
+ return
|
|
|
|
|
|
if expiry is None:
|
|
if expiry is None:
|
|
expiry = input('Time until order expires (minutes, default 43200):')
|
|
expiry = input('Time until order expires (minutes, default 43200):')
|
|
if expiry == '':
|
|
if expiry == '':
|
|
expiry = 43200
|
|
expiry = 43200
|
|
|
|
+ try:
|
|
|
|
+ float(expiry)
|
|
|
|
+ except ValueError:
|
|
|
|
+ print('Invalid expiration time.')
|
|
|
|
+ return
|
|
|
|
+
|
|
fake_loading_bar('Loading Data', duration=1.3)
|
|
fake_loading_bar('Loading Data', duration=1.3)
|
|
response = client_request('order', {"buy": True,
|
|
response = client_request('order', {"buy": True,
|
|
"session_id": connection.session_id,
|
|
"session_id": connection.session_id,
|