diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-01 17:39:48 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-01 17:39:48 +0100 |
commit | 065ee3422a6ee9d40136cfa6b272e951e15c2e50 (patch) | |
tree | b93618243649704ddf6a8d16e6adee3f3650f7bc /helper.py | |
parent | 23f4616a85bef7e9acc57740f889a2a0346788af (diff) | |
download | Trader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.tar.gz Trader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.tar.zst Trader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.zip |
Add processors
Diffstat (limited to 'helper.py')
-rw-r--r-- | helper.py | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -129,8 +129,8 @@ def main_process_market(user_market, actions, before=False, after=False): | |||
129 | if before: | 129 | if before: |
130 | process_sell_all__1_all_sell(user_market) | 130 | process_sell_all__1_all_sell(user_market) |
131 | if after: | 131 | if after: |
132 | portfolio.Portfolio.wait_for_recent(user_market) | 132 | process_sell_all__2_wait(user_market) |
133 | process_sell_all__2_all_buy(user_market) | 133 | process_sell_all__3_all_buy(user_market) |
134 | else: | 134 | else: |
135 | for action in actions: | 135 | for action in actions: |
136 | if action in globals(): | 136 | if action in globals(): |
@@ -191,15 +191,20 @@ def process_sell_all__1_all_sell(market, base_currency="BTC", liquidity="medium" | |||
191 | market.balances.fetch_balances(tag="process_sell_all__1_all_sell_end") | 191 | market.balances.fetch_balances(tag="process_sell_all__1_all_sell_end") |
192 | market.report.log_stage("process_sell_all__1_all_sell_end") | 192 | market.report.log_stage("process_sell_all__1_all_sell_end") |
193 | 193 | ||
194 | def process_sell_all__2_all_buy(market, base_currency="BTC", liquidity="medium"): | 194 | def process_sell_all__2_wait(market, liquidity="medium", base_currency="BTC"): |
195 | market.report.log_stage("process_sell_all__2_all_buy_begin") | 195 | market.report.log_stage("process_sell_all__2_wait_begin") |
196 | market.balances.fetch_balances(tag="process_sell_all__2_all_buy_begin") | 196 | portfolio.Portfolio.wait_for_recent(market) |
197 | market.report.log_stage("process_sell_all__2_wait_end") | ||
198 | |||
199 | def process_sell_all__3_all_buy(market, base_currency="BTC", liquidity="medium"): | ||
200 | market.report.log_stage("process_sell_all__3_all_buy_begin") | ||
201 | market.balances.fetch_balances(tag="process_sell_all__3_all_buy_begin") | ||
197 | market.prepare_trades(liquidity=liquidity, base_currency=base_currency) | 202 | market.prepare_trades(liquidity=liquidity, base_currency=base_currency) |
198 | market.trades.prepare_orders(compute_value="average") | 203 | market.trades.prepare_orders(compute_value="average") |
199 | market.move_balances() | 204 | market.move_balances() |
200 | market.trades.run_orders() | 205 | market.trades.run_orders() |
201 | market.follow_orders() | 206 | market.follow_orders() |
202 | market.balances.fetch_balances(tag="process_sell_all__2_all_buy_end") | 207 | market.balances.fetch_balances(tag="process_sell_all__3_all_buy_end") |
203 | market.report.log_stage("process_sell_all__2_all_buy_end") | 208 | market.report.log_stage("process_sell_all__3_all_buy_end") |
204 | 209 | ||
205 | 210 | ||