|
@@ -1,12 +1,30 @@
|
|
|
# DO NOT COPY: TOP SECRET
|
|
|
from math import ceil
|
|
|
from random import uniform
|
|
|
+
|
|
|
from secret_trading_tools import tradables_except_kollar, flip_a_coin, cheapest_buy_order, best_sell_order, \
|
|
|
- place_order, some_orders_on, buy, sell, old_order_is_expired, delete_order_on, \
|
|
|
+ some_orders_on, buy, sell, old_order_is_expired, delete_order_on, \
|
|
|
transactions_size_since_last_order_on, order_on
|
|
|
|
|
|
|
|
|
-def create_order():
|
|
|
+def follower():
|
|
|
+ """
|
|
|
+ The main algorithm
|
|
|
+ """
|
|
|
+ for tradable in tradables_except_kollar:
|
|
|
+ create_order_on(tradable)
|
|
|
+
|
|
|
+ while True:
|
|
|
+ for tradable in tradables_except_kollar:
|
|
|
+ if old_order_is_expired(tradable):
|
|
|
+ create_order_on(tradable)
|
|
|
+
|
|
|
+ if transactions_size_since_last_order_on(tradable) > 2 * order_on(tradable).amount:
|
|
|
+ delete_order_on(tradable)
|
|
|
+ create_order_on(tradable)
|
|
|
+
|
|
|
+
|
|
|
+def create_order_on(tradable):
|
|
|
"""
|
|
|
This function places a new order on the given tradable
|
|
|
"""
|
|
@@ -26,15 +44,5 @@ def create_order():
|
|
|
sell(tradable, amount, limit, stop_loss, duration)
|
|
|
|
|
|
|
|
|
-for tradable in tradables_except_kollar:
|
|
|
- create_order()
|
|
|
-
|
|
|
-while True:
|
|
|
- for tradable in tradables_except_kollar:
|
|
|
- if old_order_is_expired(tradable):
|
|
|
- delete_order_on(tradable)
|
|
|
- create_order()
|
|
|
-
|
|
|
- if transactions_size_since_last_order_on(tradable) > 2 * order_on(tradable).amount:
|
|
|
- delete_order_on(tradable)
|
|
|
- create_order()
|
|
|
+if __name__ == '__main__':
|
|
|
+ follower()
|