Parcourir la source

Implement intial part of trading bot

Eren Yilmaz il y a 6 ans
Parent
commit
6edb8b25b8
1 fichiers modifiés avec 17 ajouts et 0 suppressions
  1. 17 0
      trading_bot.py

+ 17 - 0
trading_bot.py

@@ -24,3 +24,20 @@ def place_order(ownable_id):
                       stop_loss=False,
                       amount=amount,
                       expiry=expiry)
+
+
+def main():  # TODO testen
+    """the initial part of the trading bot algorithm"""
+    if model.get_user_orders(model.bank_id()):
+        raise AssertionError('The trading bot already has some orders.')
+    if input('Are you sure you want to set the trading bots initial orders? (type in "yes" or something else):') == 'yes':
+        for ownable_id in model.ownable_ids():
+            if ownable_id != model.currency_id():
+                place_order(ownable_id)
+    else:
+        print('Not placing orders.')
+    model.cleanup()
+
+
+if __name__ == '__main__':
+    main()