Bladeren bron

Do not ask when buying with limit 0

Eren Yilmaz 6 jaren geleden
bovenliggende
commit
c7626fbd38
1 gewijzigde bestanden met toevoegingen van 6 en 12 verwijderingen
  1. 6 12
      client_controller.py

+ 6 - 12
client_controller.py

@@ -211,12 +211,6 @@ def buy(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
             stop_loss = None
     if limit != '' and stop_loss == '':
         stop_loss = yn_dialog('Is this a stop-loss limit?')
-    if limit is not None and \
-            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:
         expiry = input('Time until order expires (minutes, default ' + str(DEFAULT_ORDER_EXPIRY) + '):')
@@ -258,10 +252,10 @@ def sell(obj_name=None, amount=None, limit='', stop_loss='', expiry=None):
             stop_loss = None
     if limit != '' and stop_loss == '':
         stop_loss = yn_dialog('Is this a stop-loss limit?')
-    if limit is not None and \
-            float(limit) <= 0 and \
-            input('Are you sure you want to use such a low limit (limit=' + str(
-                limit) + ')? (type in "yes" or something else):') != 'yes':
+
+    question = 'Are you sure you want to use such a low limit (limit=' + str(limit) + \
+               ')? (type in "yes" or something else):'
+    if limit is not None and float(limit) <= 0 and input(question) != 'yes':
         print('Order was not placed.')
         return
 
@@ -399,7 +393,7 @@ def trades_on(obj_name=None, limit=5):
 
 def trades(limit=10):
     limit = float(limit)
-    fake_loading_bar('Loading Data', duration=limit*0.27)
+    fake_loading_bar('Loading Data', duration=limit * 0.21)
     response = client_request('trades', {"session_id": connection.session_id,
                                          "limit": limit})
     success = 'data' in response
@@ -420,7 +414,7 @@ def old_orders(include_canceled=None, include_executed=None, limit=10):
         include_canceled = yn_dialog('Include canceled/expired orders in list?')
     if include_executed is None:
         include_executed = yn_dialog('Include fully executed orders in list?')
-    fake_loading_bar('Loading Data', duration=limit*0.37)
+    fake_loading_bar('Loading Data', duration=limit * 0.27)
     response = client_request('old_orders', {"session_id": connection.session_id,
                                              "include_canceled": include_canceled,
                                              "include_executed": include_executed,