Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
git clone -q $OCTOBOT_GH_REPO -b ${TARGET_BRANCH} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH
cd OctoBot
git status
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt -r full_requirements.txt
cd ..
mkdir new_tentacles
cp -r Automation Backtesting Evaluator Meta Services Trading profiles new_tentacles
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
cd OctoBot
git status
pip install --upgrade pip setuptools wheel
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt -r full_requirements.txt
cd ..
mkdir new_tentacles
xcopy Automation new_tentacles\\Automation /E/H/I
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
git clone -q $OCTOBOT_GH_REPO -b ${TARGET_BRANCH} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH
cd OctoBot
git status
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt -r full_requirements.txt
cd ..
mkdir new_tentacles
cp -r Automation Backtesting Evaluator Meta Services Trading profiles new_tentacles
Expand Down
3 changes: 1 addition & 2 deletions Evaluator/Social/forum_evaluator/forum.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
# RedditForumEvaluator is used to get an overall state of a market, it will not trigger a trade
# (notify its evaluators) but is used to measure hype and trend of a market.
class RedditForumEvaluator(evaluators.SocialEvaluator):

SERVICE_FEED_CLASS = Services_feeds.RedditServiceFeed
SERVICE_FEED_CLASS = Services_feeds.RedditServiceFeed if hasattr(Services_feeds, 'RedditServiceFeed') else None

def __init__(self, tentacles_setup_config):
evaluators.SocialEvaluator.__init__(self, tentacles_setup_config)
Expand Down
2 changes: 1 addition & 1 deletion Evaluator/Social/news_evaluator/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# disable inheritance to disable tentacle visibility. Disabled as starting from feb 9 2023, API is now paid only
# class TwitterNewsEvaluator(evaluators.SocialEvaluator):
class TwitterNewsEvaluator:
SERVICE_FEED_CLASS = Services_feeds.TwitterServiceFeed
SERVICE_FEED_CLASS = Services_feeds.TwitterServiceFeed if hasattr(Services_feeds, 'TwitterServiceFeed') else None

# max time to live for a pulse is 10min
_EVAL_MAX_TIME_TO_LIVE = 10 * commons_constants.MINUTE_TO_SECONDS
Expand Down
4 changes: 2 additions & 2 deletions Evaluator/Social/signal_evaluator/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class TelegramSignalEvaluator(evaluators.SocialEvaluator):
SERVICE_FEED_CLASS = Services_feeds.TelegramServiceFeed
SERVICE_FEED_CLASS = Services_feeds.TelegramServiceFeed if hasattr(Services_feeds, 'TelegramServiceFeed') else None

def init_user_inputs(self, inputs: dict) -> None:
channels_config = self.UI.user_input(services_constants.CONFIG_TELEGRAM_CHANNEL,
Expand Down Expand Up @@ -106,7 +106,7 @@ def _get_tentacle_registration_topic(self, all_symbols_by_crypto_currencies, tim


class TelegramChannelSignalEvaluator(evaluators.SocialEvaluator):
SERVICE_FEED_CLASS = Services_feeds.TelegramApiServiceFeed
SERVICE_FEED_CLASS = Services_feeds.TelegramApiServiceFeed if hasattr(Services_feeds, 'TelegramApiServiceFeed') else None

SIGNAL_PATTERN_KEY = "signal_pattern"
SIGNAL_PATTERN_MARKET_BUY_KEY = "MARKET_BUY"
Expand Down
2 changes: 1 addition & 1 deletion Evaluator/Social/trends_evaluator/trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


class GoogleTrendsEvaluator(evaluators.SocialEvaluator):
SERVICE_FEED_CLASS = Services_feeds.GoogleServiceFeed
SERVICE_FEED_CLASS = Services_feeds.GoogleServiceFeed if hasattr(Services_feeds, 'GoogleServiceFeed') else None

def __init__(self, tentacles_setup_config):
evaluators.SocialEvaluator.__init__(self, tentacles_setup_config)
Expand Down
12 changes: 11 additions & 1 deletion Evaluator/Util/text_analysis/text_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library.

import vaderSentiment.vaderSentiment as vaderSentiment
import octobot_commons.constants as commons_constants
try:
import vaderSentiment.vaderSentiment as vaderSentiment
except ImportError:
if commons_constants.USE_MINIMAL_LIBS:
# mock vaderSentiment imports
class VaderSentimentImportMock:
class SentimentIntensityAnalyzer:
def __init__(self, *args):
raise ImportError("vaderSentiment not installed")
vaderSentiment = VaderSentimentImportMock()


class TextAnalysis:
Expand Down
4 changes: 3 additions & 1 deletion Services/Interfaces/telegram_bot_interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram_bot import TelegramBotInterface
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram_bot import TelegramBotInterface
7 changes: 4 additions & 3 deletions Services/Interfaces/web_interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ def register_notifier(notification_key, notifier):
STRATEGY_OPTIMIZER_NOTIFICATION_KEY = "strategy_optimizer_notifications"
DASHBOARD_NOTIFICATION_KEY = "dashboard_notifications"


# Make WebInterface visible to imports
from tentacles.Services.Interfaces.web_interface.web import WebInterface
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
# Make WebInterface visible to imports
from tentacles.Services.Interfaces.web_interface.web import WebInterface


# disable server logging
Expand Down
4 changes: 3 additions & 1 deletion Services/Notifiers/telegram_notifier/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram import TelegramNotifier
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram import TelegramNotifier
4 changes: 3 additions & 1 deletion Services/Notifiers/twitter_notifier/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .twitter import TwitterNotifier
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .twitter import TwitterNotifier
4 changes: 3 additions & 1 deletion Services/Notifiers/web_notifier/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .web import WebNotifier
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .web import WebNotifier
4 changes: 3 additions & 1 deletion Services/Services_bases/google_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .google import GoogleService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .google import GoogleService
4 changes: 3 additions & 1 deletion Services/Services_bases/reddit_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .reddit import RedditService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .reddit import RedditService
4 changes: 3 additions & 1 deletion Services/Services_bases/telegram_api_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram_api import TelegramApiService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram_api import TelegramApiService
4 changes: 3 additions & 1 deletion Services/Services_bases/telegram_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram import TelegramService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram import TelegramService
4 changes: 3 additions & 1 deletion Services/Services_bases/trading_view_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .trading_view import TradingViewService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .trading_view import TradingViewService
4 changes: 3 additions & 1 deletion Services/Services_bases/twitter_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .twitter import TwitterService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .twitter import TwitterService
4 changes: 3 additions & 1 deletion Services/Services_bases/web_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .web import WebService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .web import WebService
4 changes: 3 additions & 1 deletion Services/Services_bases/webhook_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .webhook import WebHookService
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .webhook import WebHookService
6 changes: 4 additions & 2 deletions Services/Services_feeds/google_service_feed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .google_feed import GoogleServiceFeed
from .google_feed import TrendTopic
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .google_feed import GoogleServiceFeed
from .google_feed import TrendTopic
4 changes: 3 additions & 1 deletion Services/Services_feeds/reddit_service_feed/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .reddit_feed import RedditServiceFeed
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .reddit_feed import RedditServiceFeed
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram_api_feed import TelegramApiServiceFeed
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram_api_feed import TelegramApiServiceFeed
4 changes: 3 additions & 1 deletion Services/Services_feeds/telegram_service_feed/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .telegram_feed import TelegramServiceFeed
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .telegram_feed import TelegramServiceFeed
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .trading_view_feed import TradingViewServiceFeed
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .trading_view_feed import TradingViewServiceFeed
4 changes: 3 additions & 1 deletion Services/Services_feeds/twitter_service_feed/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .twitter_feed import TwitterServiceFeed
import octobot_commons.constants as commons_constants
if not commons_constants.USE_MINIMAL_LIBS:
from .twitter_feed import TwitterServiceFeed
14 changes: 14 additions & 0 deletions Trading/Exchange/binance/binance_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# License along with this library.
import decimal
import typing
import enum

import ccxt

Expand All @@ -23,12 +24,19 @@
import octobot_trading.enums as trading_enums
import octobot_trading.exchanges as exchanges
import octobot_trading.errors as errors
import octobot_trading.constants as trading_constants
import octobot_trading.exchanges.connectors.ccxt.constants as ccxt_constants
import octobot_trading.exchanges.connectors.ccxt.enums as ccxt_enums
import octobot_trading.util as trading_util
import octobot_trading.personal_data as personal_data


class BinanceMarkets(enum.Enum):
SPOT = "spot"
LINEAR = "linear"
INVERSE = "inverse"


class Binance(exchanges.RestExchange):
DESCRIPTION = ""
FIX_MARKET_STATUS = True
Expand Down Expand Up @@ -241,6 +249,12 @@ def get_additional_connector_config(self):
"filterClosed": False, # return empty positions as well
}
}
if trading_constants.FETCH_MIN_EXCHANGE_MARKETS:
config[ccxt_constants.CCXT_OPTIONS][ccxt_constants.CCXT_FETCH_MARKETS] = (
[
BinanceMarkets.LINEAR.value, BinanceMarkets.INVERSE.value
] if self.exchange_manager.is_future else [BinanceMarkets.SPOT.value]
)
return config

def is_authenticated_request(self, url: str, method: str, headers: dict, body) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@
import async_channel.channels as channels
import octobot_commons.symbols.symbol_util as symbol_util
import octobot_commons.enums as commons_enums
import octobot_commons.constants as commons_constants
import octobot_commons.signals as commons_signals
import octobot_commons.tentacles_management as tentacles_management
import octobot_services.api as services_api
import octobot_trading.personal_data as trading_personal_data
import tentacles.Services.Services_feeds.trading_view_service_feed as trading_view_service_feed
try:
import tentacles.Services.Services_feeds.trading_view_service_feed as trading_view_service_feed
except ImportError:
if commons_constants.USE_MINIMAL_LIBS:
# mock trading_view_service_feed imports
class TradingViewServiceFeedImportMock:
class TradingViewServiceFeed:
def get_name(self, *args, **kwargs):
raise ImportError("trading_view_service_feed not installed")
trading_view_service_feed = TradingViewServiceFeedImportMock()
import tentacles.Trading.Mode.daily_trading_mode.daily_trading as daily_trading_mode
import octobot_trading.constants as trading_constants
import octobot_trading.enums as trading_enums
Expand All @@ -39,7 +49,7 @@


class TradingViewSignalsTradingMode(trading_modes.AbstractTradingMode):
SERVICE_FEED_CLASS = trading_view_service_feed.TradingViewServiceFeed
SERVICE_FEED_CLASS = trading_view_service_feed.TradingViewServiceFeed if hasattr(trading_view_service_feed, 'TradingViewServiceFeed') else None
TRADINGVIEW_FUTURES_SUFFIXES = [".P"]
PARAM_SEPARATORS = [";", "\\n", "\n"]

Expand Down Expand Up @@ -128,14 +138,22 @@ async def _get_feed_consumers(self):
parsed_symbol = symbol_util.parse_symbol(self.symbol)
self.str_symbol = str(parsed_symbol)
self.merged_simple_symbol = parsed_symbol.merged_str_base_and_quote_only_symbol(market_separator="")
service_feed = services_api.get_service_feed(self.SERVICE_FEED_CLASS, self.bot_id)
feed_consumer = []
if service_feed is not None:
feed_consumer = [await channels.get_chan(service_feed.FEED_CHANNEL.get_name()).new_consumer(
self._trading_view_signal_callback
)]
if self.SERVICE_FEED_CLASS is None:
if commons_constants.USE_MINIMAL_LIBS:
self.logger.debug(
"Trading view service feed not installed, this trading mode won't be listening to trading view signals."
)
else:
raise ImportError("TradingViewServiceFeed not installed")
else:
self.logger.error("Impossible to find the Trading view service feed, this trading mode can't work.")
service_feed = services_api.get_service_feed(self.SERVICE_FEED_CLASS, self.bot_id)
if service_feed is not None:
feed_consumer = [await channels.get_chan(service_feed.FEED_CHANNEL.get_name()).new_consumer(
self._trading_view_signal_callback
)]
else:
self.logger.error("Impossible to find the Trading view service feed, this trading mode can't work.")
return feed_consumer

async def create_consumers(self) -> list:
Expand Down