diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-04 12:59:57 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-04 12:59:57 +0100 |
commit | 17598517c544a3dda8b9f773dfeb669c886ea92b (patch) | |
tree | eb02553743f2aa2cdd64e2b1cdd02d3c02d4a6cd /store.py | |
parent | 9db7d156833cd384baa64b6148b5c646bfcc41f8 (diff) | |
download | Trader-17598517c544a3dda8b9f773dfeb669c886ea92b.tar.gz Trader-17598517c544a3dda8b9f773dfeb669c886ea92b.tar.zst Trader-17598517c544a3dda8b9f773dfeb669c886ea92b.zip |
Add close trades action
Diffstat (limited to 'store.py')
-rw-r--r-- | store.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -234,7 +234,7 @@ class TradeStore: | |||
234 | 234 | ||
235 | @property | 235 | @property |
236 | def pending(self): | 236 | def pending(self): |
237 | return list(filter(lambda t: not t.is_fullfiled, self.all)) | 237 | return list(filter(lambda t: t.pending, self.all)) |
238 | 238 | ||
239 | def compute_trades(self, values_in_base, new_repartition, only=None): | 239 | def compute_trades(self, values_in_base, new_repartition, only=None): |
240 | computed_trades = [] | 240 | computed_trades = [] |
@@ -275,6 +275,10 @@ class TradeStore: | |||
275 | orders.append(trade.prepare_order(compute_value=compute_value)) | 275 | orders.append(trade.prepare_order(compute_value=compute_value)) |
276 | self.market.report.log_orders(orders, only, compute_value) | 276 | self.market.report.log_orders(orders, only, compute_value) |
277 | 277 | ||
278 | def close_trades(self): | ||
279 | for trade in self.all: | ||
280 | trade.close() | ||
281 | |||
278 | def print_all_with_order(self, ind=""): | 282 | def print_all_with_order(self, ind=""): |
279 | for trade in self.all: | 283 | for trade in self.all: |
280 | trade.print_with_order(ind=ind) | 284 | trade.print_with_order(ind=ind) |