Skip to content

Commit 842b480

Browse files
authored
Merge pull request #2056 from Drakkar-Software/dev
master merge
2 parents 05f7c08 + 983bccb commit 842b480

File tree

9 files changed

+35
-8
lines changed

9 files changed

+35
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
*It is strongly advised to perform an update of your tentacles after updating OctoBot. (start.py tentacles --install --all)*
88

9-
## [0.4.11] - 2022-10-12
9+
## [0.4.12] - 2022-10-15
10+
### Fixed
11+
- Copy trading
12+
13+
## [0.4.11] - 2022-10-14
1014
### Added
1115
- User inputs system
1216
- Phemex exchange
1317
- Run storage
1418
### Updated
1519
- Configuration for each tentacle
1620
- Community bot system instead of devices
17-
### Fixed
18-
- Exchange API issues (Bybit, Kucoin)
1921

2022
## [0.4.10] - 2022-09-13
2123
### Updated

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OctoBot [0.4.11](https://octobot.click/gh-changelog)
1+
# OctoBot [0.4.12](https://octobot.click/gh-changelog)
22
[![PyPI](https://img.shields.io/pypi/v/OctoBot.svg)](https://octobot.click/gh-pypi)
33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e07fb190156d4efb8e7d07aaa5eff2e1)](https://app.codacy.com/gh/Drakkar-Software/OctoBot?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot&utm_campaign=Badge_Grade_Dashboard)[![Downloads](https://pepy.tech/badge/octobot/month)](https://pepy.tech/project/octobot)
44
[![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot.svg)](https://octobot.click/gh-dockerhub)

octobot/cli.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def _create_startup_config(logger):
120120
config.read(should_raise=False)
121121
else:
122122
_read_config(config, logger)
123+
_ensure_profile(config, logger)
123124
_validate_config(config, logger)
124125
return config
125126

@@ -135,6 +136,19 @@ def _read_config(config, logger):
135136
raise errors.ConfigError(e)
136137

137138

139+
def _ensure_profile(config, logger):
140+
if config.profile is None:
141+
# no selected profile or profile not found
142+
try:
143+
config.select_profile(common_constants.DEFAULT_PROFILE)
144+
except KeyError:
145+
logger.error(f"Missing default profiles. Please make sure that the {config.profiles_path} "
146+
f"folder is accessible. To reinstall default profiles, delete the "
147+
f"'{tentacles_manager_constants.TENTACLES_PATH}' "
148+
f"folder or start OctoBot with the following arguments: tentacles --install --all")
149+
raise errors.NoProfileError
150+
151+
138152
def _validate_config(config, logger):
139153
try:
140154
config.validate()

octobot/community/authentication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ async def select_bot(self, bot_id):
272272
if fetched_bot is None:
273273
raise errors.BotNotFoundError(f"Can't find bot with id: {bot_id}")
274274
self.user_account.set_selected_bot_raw_data(fetched_bot)
275+
bot_name = self.user_account.get_bot_name_or_id(self.user_account.get_selected_bot_raw_data())
276+
self.logger.debug(f"Selected bot '{bot_name}'")
275277
self.user_account.gql_bot_id = bot_id
276278
self._save_gql_bot_id(self.user_account.gql_bot_id)
277279
await self.on_new_bot_select()

octobot/community/community_user_account.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class CommunityUserAccount:
2222
BOT_DEVICE = "device"
2323
NO_SELECTED_BOT_DESC = "No selected bot. Please select a bot to enable your community features."
2424

25-
2625
def __init__(self):
2726
self.gql_user_id = None
2827
self.gql_bot_id = None
@@ -62,6 +61,12 @@ def get_selected_bot_device_uuid(self):
6261
except AttributeError:
6362
raise errors.NoBotDeviceError("No device associated to the select bot")
6463

64+
def get_selected_bot_device_name(self):
65+
try:
66+
return self.get_selected_bot_raw_data(raise_on_missing=True).get(self.BOT_DEVICE, {}).get("name", None)
67+
except AttributeError:
68+
raise errors.NoBotDeviceError("No device associated to the select bot")
69+
6570
@staticmethod
6671
def get_bot_id(bot):
6772
return bot["_id"]

octobot/community/feeds/community_mqtt_feed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ async def _connect(self):
267267
self._update_client_config(self._mqtt_client)
268268
self._register_callbacks(self._mqtt_client)
269269
self._mqtt_client.set_auth_credentials(self._device_uuid, None)
270-
self.logger.debug(f"Connecting client")
270+
self.logger.debug(f"Connecting client using device "
271+
f"'{self.authenticator.user_account.get_selected_bot_device_name()}'")
271272
self._connect_task = asyncio.create_task(
272273
self._mqtt_client.connect(self.feed_url, self.mqtt_broker_port, version=self.MQTT_VERSION)
273274
)

octobot/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
PROJECT_NAME = "OctoBot"
2323
AUTHOR = "DrakkarSoftware"
24-
SHORT_VERSION = "0.4.11" # major.minor.revision
24+
SHORT_VERSION = "0.4.12" # major.minor.revision
2525
PATCH_VERSION = "" # patch : pX
2626
VERSION_DEV_PHASE = "" # alpha : a / beta : b / release candidate : rc
2727
VERSION_PHASE = "" # XX

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cython==0.29.26
33

44
# Drakkar-Software requirements
55
OctoBot-Commons==1.7.24
6-
OctoBot-Trading==2.2.18
6+
OctoBot-Trading==2.2.19
77
OctoBot-Evaluators==1.7.5
88
OctoBot-Tentacles-Manager==2.7.3
99
OctoBot-Services==1.3.6

tests/unit_tests/community/test_community_mqtt_feed.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
FEED_URL = "x.y.z"
3232
TOKEN = "acb1"
33+
NAME = "name_a"
3334

3435

3536
def _build_message(value, identifier):
@@ -65,6 +66,8 @@ async def connected_community_feed(authenticator):
6566
feed.INIT_TIMEOUT = 1
6667
with mock.patch.object(authenticator.user_account, "get_selected_bot_device_uuid", mock.Mock(return_value=TOKEN)) \
6768
as get_selected_bot_device_uuid_mock, \
69+
mock.patch.object(authenticator.user_account, "get_selected_bot_device_name", mock.Mock(return_value=NAME)
70+
) as _get_selected_bot_device_uuid_mock, \
6871
mock.patch.object(feed, "_subscribe", mock.AsyncMock()) as _subscribe_mock, \
6972
mock.patch.object(gmqtt.Client, "connect", mock.AsyncMock()) as _connect_mock:
7073
await feed.register_feed_callback(commons_enums.CommunityChannelTypes.SIGNAL, mock.AsyncMock())

0 commit comments

Comments
 (0)