X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=helper.py;fp=helper.py;h=421e8cdc9b7f0adcbe3af64328fe178681a16eed;hb=5a72ded790f8b5e7c9b38a3cc91c12fbfb6cb97a;hp=8a29f40419473ab0fc61cc0ff5c130781bf1a648;hpb=1aa7d4fa2ec3c2b3268bef31a666ca6e1aaa6563;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git 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"): print(balance) TradeStore.print_all_with_order() -def make_orders(market, base_currency="BTC"): - prepare_trades(market, base_currency=base_currency) - for trade in TradeStore.all: - print(trade) - for order in trade.orders: - print("\t", order, sep="") - order.run() +def process_sell_needed__1_sell(market, base_currency="BTC", debug=False): + prepare_trades(market, base_currency=base_currency, debug=debug) + TradeStore.prepare_orders(compute_value="average", only="dispose") + print("------------------") + for currency, balance in BalanceStore.all.items(): + print(balance) + print("------------------") + TradeStore.print_all_with_order() + print("------------------") + TradeStore.run_orders() + follow_orders() + +def process_sell_needed__2_sell(market, base_currency="BTC", debug=False): + update_trades(market, base_currency=base_currency, debug=debug, only="acquire") + TradeStore.prepare_orders(compute_value="average", only="acquire") + print("------------------") + for currency, balance in BalanceStore.all.items(): + print(balance) + print("------------------") + TradeStore.print_all_with_order() + print("------------------") + move_balances(market, debug=debug) + TradeStore.run_orders() + follow_orders() -def process_sell_all_sell(market, base_currency="BTC", debug=False): - prepare_trades_to_sell_all(market, debug=debug) +def process_sell_all__1_all_sell(market, base_currency="BTC", debug=False): + prepare_trades_to_sell_all(market, base_currency=base_currency, debug=debug) TradeStore.prepare_orders(compute_value="average") print("------------------") for currency, balance in BalanceStore.all.items(): @@ -135,8 +152,8 @@ def process_sell_all_sell(market, base_currency="BTC", debug=False): TradeStore.run_orders() follow_orders() -def process_sell_all_buy(market, base_currency="BTC", debug=False): - prepare_trades(market, debug=debug) +def process_sell_all__2_all_buy(market, base_currency="BTC", debug=False): + prepare_trades(market, base_currency=base_currency, debug=debug) TradeStore.prepare_orders() print("------------------") for currency, balance in BalanceStore.all.items():