diff options
Diffstat (limited to 'portfolio.py')
-rw-r--r-- | portfolio.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/portfolio.py b/portfolio.py index bed4326..94472a3 100644 --- a/portfolio.py +++ b/portfolio.py | |||
@@ -4,6 +4,10 @@ from decimal import Decimal as D, ROUND_DOWN | |||
4 | from ccxt import ExchangeError, InsufficientFunds, ExchangeNotAvailable, InvalidOrder, OrderNotCached, OrderNotFound, RequestTimeout, InvalidNonce | 4 | from ccxt import ExchangeError, InsufficientFunds, ExchangeNotAvailable, InvalidOrder, OrderNotCached, OrderNotFound, RequestTimeout, InvalidNonce |
5 | 5 | ||
6 | class Computation: | 6 | class Computation: |
7 | @staticmethod | ||
8 | def eat_several(market): | ||
9 | return lambda x, y: market.ccxt.fetch_nth_order_book(x["symbol"], y, 15) | ||
10 | |||
7 | computations = { | 11 | computations = { |
8 | "default": lambda x, y: x[y], | 12 | "default": lambda x, y: x[y], |
9 | "average": lambda x, y: x["average"], | 13 | "average": lambda x, y: x["average"], |
@@ -288,8 +292,12 @@ class Trade: | |||
288 | if tick in self.tick_actions: | 292 | if tick in self.tick_actions: |
289 | update, compute_value = self.tick_actions[tick] | 293 | update, compute_value = self.tick_actions[tick] |
290 | elif tick % 3 == 1: | 294 | elif tick % 3 == 1: |
291 | update = "market_adjust" | 295 | if tick < 20: |
292 | compute_value = "default" | 296 | update = "market_adjust" |
297 | compute_value = "default" | ||
298 | else: | ||
299 | update = "market_adjust_eat" | ||
300 | compute_value = Computation.eat_several(self.market) | ||
293 | else: | 301 | else: |
294 | update = "waiting" | 302 | update = "waiting" |
295 | compute_value = None | 303 | compute_value = None |