Skip to content

Commit

Permalink
#22 Made fonctionnal
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bouquet committed Oct 1, 2018
1 parent 4b18d79 commit 6392d40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions Evaluator/RealTime/instant_fluctuations_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
OctoBot Tentacle
$tentacle_description: {
"package_name": "OctoBot-Tentacles",
"name": "instant_fluctuations_evaluator",
"type": "Evaluator",
"subtype": "RealTime",
Expand Down Expand Up @@ -212,8 +213,10 @@ def _should_eval(self):
return self.should_eval


# This RT evaluator should be used on regulated markets like USDT/USD or TUSD/USDT...
class InstantRegulatedMarketEvaluator(RealTimeTAEvaluator):
MARKET_PRICE = "regulated_market_price"
MARKET_RANGE = "regulated_market_range"

def __init__(self, exchange, symbol):
super().__init__(exchange, symbol)
self.last_candle_data = None
Expand All @@ -232,9 +235,21 @@ def eval_impl(self):

last_price = close_values[-1]

self.eval_note = 0
# TODO
# should sell
if last_price > self.specific_config[self.MARKET_PRICE] + self.specific_config[self.MARKET_RANGE]:
self.eval_note = 1

self.notify_evaluator_thread_managers(self.__class__.__name__)
# should buy
elif last_price < self.specific_config[self.MARKET_PRICE] + self.specific_config[self.MARKET_RANGE]:
self.eval_note = -1

else:
self.eval_note = 0

if self.last_eval_note != self.eval_note:
self.notify_evaluator_thread_managers(self.__class__.__name__)
self.last_eval_note = self.eval_note

def set_default_config(self):
super().set_default_config()
Expand Down
2 changes: 1 addition & 1 deletion Evaluator/Strategies/mixed_strategies_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ def eval_impl(self) -> None:

def finalize(self):
if self.counter > 0:
self.eval_note += self.evaluation / self.counter
self.eval_note = self.evaluation / self.counter

0 comments on commit 6392d40

Please sign in to comment.