|
@@ -5,7 +5,7 @@ from inspect import signature
|
|
|
import connection
|
|
|
from run_client import allowed_commands, fake_loading_bar
|
|
|
from connection import client_request
|
|
|
-from tabulate import tabulate
|
|
|
+import tabulate
|
|
|
|
|
|
from debug import debug
|
|
|
|
|
@@ -128,7 +128,8 @@ def help():
|
|
|
def _my_tabulate(data, **params):
|
|
|
if data == [] and 'headers' in params:
|
|
|
data = [(None for _ in params['headers'])]
|
|
|
- return tabulate(data, **params)
|
|
|
+ tabulate.MIN_PADDING = 0
|
|
|
+ return tabulate.tabulate(data, **params)
|
|
|
|
|
|
|
|
|
def depot():
|
|
@@ -206,6 +207,7 @@ def buy(amount=None, object_name=None, limit='', stop_loss='', time_until_expira
|
|
|
time_until_expiration = input('Time until order expires (minutes, default 1440):')
|
|
|
if time_until_expiration == '':
|
|
|
time_until_expiration = 1440
|
|
|
+ fake_loading_bar('Loading Data', duration=1.3)
|
|
|
response = client_request('order', {"buy": True,
|
|
|
"session_id": connection.session_id,
|
|
|
"amount": amount,
|
|
@@ -240,6 +242,7 @@ def sell(amount=None, object_name=None, limit='', stop_loss='', time_until_expir
|
|
|
time_until_expiration = input('Time until order expires (minutes, default 1440):')
|
|
|
if time_until_expiration == '':
|
|
|
time_until_expiration = 1440
|
|
|
+ fake_loading_bar('Loading Data', duration=1.3)
|
|
|
response = client_request('order', {"buy": False,
|
|
|
"session_id": connection.session_id,
|
|
|
"amount": amount,
|
|
@@ -260,7 +263,7 @@ def orders():
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
|
print(_my_tabulate(response['data'],
|
|
|
- headers=['Buy?', 'Name', 'Amount', 'Limit', 'Stop Loss?', 'Orig. Size', 'Expires', 'No.'],
|
|
|
+ headers=['Buy?', 'Name', 'Amount', 'Limit', 'stop-loss', 'Expires', 'No.'],
|
|
|
tablefmt="pipe"))
|
|
|
else:
|
|
|
if 'error_message' in response:
|
|
@@ -277,7 +280,7 @@ def orders_on(object_name=None):
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
|
print(_my_tabulate(response['data'],
|
|
|
- headers=['Buy?', 'Name', 'Amount', 'Limit', 'Stop Loss?', 'Expires', 'No.'],
|
|
|
+ headers=['Buy?', 'Name', 'Amount', 'Limit', 'stop-loss', 'Expires', 'No.'],
|
|
|
tablefmt="pipe"))
|
|
|
else:
|
|
|
if 'error_message' in response:
|