Tentacle development

About Tentacles

This page covers tentacle development.
A tentacle is part of a tentacle package and defines a tool for OctoBot such as a way to analyse moving averages, listen to twitter for create grid-like orders.
OctoBot uses tentacles to handle:
  • Price technical analysis (moving averages, RSI, MACD, ...)
  • Social analysis (Twitter, Telegram, Reddit and Google)
  • Evaluator signals interpretations (strategies)
  • Orders creation and followup (trading modes)
  • User interfaces and notifications (web, telegram, twitter)
  • Backtesting data files reading and writing (.data)
  • Exchanges fixes (to handle exchange local differences)
There is no limit to the things OctoBot can handle: everything that can be coded can be used by OctoBot through a tentacle. It is possible to create a new tentacle to add a new tool to OctoBot or to build on an existing one and improve it.

Developing a new Tentacle

The most efficient way to create a new tentacle si to build on top of an existing one to add features to it. It is of course also possible to create a new completely new tentacle, in this case please have a look at similar tentacles.
To create a tentacle improving an existing one, all you need to do, is to use the existing tentacle folder as a template (to create a tentacle package) and extend the existing tentacle you want to improve and re-implement the methods you want to change in the package's python file.
Examples:
TwitterNewsEvaluator is a simple Twitter evaluator available by default in tentacles/Evaluator/Social/new_evaluator/news.py. Let's say you want to implement SuperTwitterNewsEvaluator which is a better Twitter evaluator.
Create the tentacles/Evaluator/Social/super_new_evaluator/ tentacle package based on tentacles/Evaluator/Social/new_evaluator and start coding the the python file.
1
import tentacles.Evaluator.Social as Socials
2
3
class SuperTwitterNewsEvaluator(Socials.TwitterNewsEvaluator):
4
# _get_tweet_sentiment is the TwitterNewsEvaluator method taking a tweet and
5
# returning a number representing the "bullishness" of the tweet.
6
# to change this part only, just redefine this method here
7
def _get_tweet_sentiment(self, tweet, tweet_text, is_a_quote=False):
8
# your new content
9
sentiment = 1
10
# some advanced tweet analysis to set sentiment value
11
return sentiment
Copied!
SimpleStrategyEvaluator is a strategy available by default in tentacles/Evaluator/Strategies/mixed_strategies_evaluator/mixed_strategies.py. Create the tentacles/Evaluator/Social/super_simple_strategy_evaluator/ tentacle package based on tentacles/Evaluator/Strategies/mixed_strategies_evaluator and start coding the the python file.
1
import tentacles.Evaluator.Strategies as Strategies
2
3
class SuperSimpleStrategyEvaluator(SimpleStrategyEvaluator):
4
5
# _trigger_evaluation is the methods called when OctoBot is
6
# asking for a strategy evaluation
7
async def matrix_callback(self,
8
matrix_id,
9
evaluator_name,
10
evaluator_type,
11
eval_note,
12
eval_note_type,
13
exchange_name,
14
cryptocurrency,
15
symbol,
16
time_frame):
17
final_evaluation = 0
18
# some advanced computations to set final_evaluation value
19
20
# update self.eval_note to store the strategy result
21
self.eval_note = final_evaluation
22
# finally, call self.strategy_completed to notify that
23
# trading modes should wake up after this update
24
await self.strategy_completed(cryptocurrency, symbol)
Copied!
Export as PDF
Copy link