aboutsummaryrefslogtreecommitdiff
path: root/helper.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-11 22:40:30 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-11 22:40:30 +0100
commit5a72ded790f8b5e7c9b38a3cc91c12fbfb6cb97a (patch)
treee12aa9ec9a5c543442aa512ee0d485ccf9f02906 /helper.py
parent1aa7d4fa2ec3c2b3268bef31a666ca6e1aaa6563 (diff)
downloadTrader-5a72ded790f8b5e7c9b38a3cc91c12fbfb6cb97a.tar.gz
Trader-5a72ded790f8b5e7c9b38a3cc91c12fbfb6cb97a.tar.zst
Trader-5a72ded790f8b5e7c9b38a3cc91c12fbfb6cb97a.zip
Add missing tests
Diffstat (limited to 'helper.py')
-rw-r--r--helper.py39
1 files changed, 28 insertions, 11 deletions
diff --git a/helper.py b/helper.py
index 8a29f40..421e8cd 100644
--- a/helper.py
+++ b/helper.py
@@ -115,16 +115,33 @@ def print_orders(market, base_currency="BTC"):
115 print(balance) 115 print(balance)
116 TradeStore.print_all_with_order() 116 TradeStore.print_all_with_order()
117 117
118def make_orders(market, base_currency="BTC"): 118def process_sell_needed__1_sell(market, base_currency="BTC", debug=False):
119 prepare_trades(market, base_currency=base_currency) 119 prepare_trades(market, base_currency=base_currency, debug=debug)
120 for trade in TradeStore.all: 120 TradeStore.prepare_orders(compute_value="average", only="dispose")
121 print(trade) 121 print("------------------")
122 for order in trade.orders: 122 for currency, balance in BalanceStore.all.items():
123 print("\t", order, sep="") 123 print(balance)
124 order.run() 124 print("------------------")
125 TradeStore.print_all_with_order()
126 print("------------------")
127 TradeStore.run_orders()
128 follow_orders()
129
130def process_sell_needed__2_sell(market, base_currency="BTC", debug=False):
131 update_trades(market, base_currency=base_currency, debug=debug, only="acquire")
132 TradeStore.prepare_orders(compute_value="average", only="acquire")
133 print("------------------")
134 for currency, balance in BalanceStore.all.items():
135 print(balance)
136 print("------------------")
137 TradeStore.print_all_with_order()
138 print("------------------")
139 move_balances(market, debug=debug)
140 TradeStore.run_orders()
141 follow_orders()
125 142
126def process_sell_all_sell(market, base_currency="BTC", debug=False): 143def process_sell_all__1_all_sell(market, base_currency="BTC", debug=False):
127 prepare_trades_to_sell_all(market, debug=debug) 144 prepare_trades_to_sell_all(market, base_currency=base_currency, debug=debug)
128 TradeStore.prepare_orders(compute_value="average") 145 TradeStore.prepare_orders(compute_value="average")
129 print("------------------") 146 print("------------------")
130 for currency, balance in BalanceStore.all.items(): 147 for currency, balance in BalanceStore.all.items():
@@ -135,8 +152,8 @@ def process_sell_all_sell(market, base_currency="BTC", debug=False):
135 TradeStore.run_orders() 152 TradeStore.run_orders()
136 follow_orders() 153 follow_orders()
137 154
138def process_sell_all_buy(market, base_currency="BTC", debug=False): 155def process_sell_all__2_all_buy(market, base_currency="BTC", debug=False):
139 prepare_trades(market, debug=debug) 156 prepare_trades(market, base_currency=base_currency, debug=debug)
140 TradeStore.prepare_orders() 157 TradeStore.prepare_orders()
141 print("------------------") 158 print("------------------")
142 for currency, balance in BalanceStore.all.items(): 159 for currency, balance in BalanceStore.all.items():