Skip to content

Commit 78d15bf

Browse files
authored
Merge pull request #2680 from Drakkar-Software/dev
Dev merge
2 parents c601c26 + e01e05c commit 78d15bf

File tree

9 files changed

+46
-7
lines changed

9 files changed

+46
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ 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+
## [2.0.2] - 2024-07-17
10+
### Updated
11+
- [WebInterface] Improve light & dark themes display
12+
### Fixed
13+
- [WebInterface] Fix extension checkout
14+
- [RAM] Reduce required RAM when loading a large amount of trades
15+
- [BingX] Fix order sizing issues
16+
917
## [2.0.1] - 2024-07-09
1018
### Updated
1119
- [WebInterface] Add contact on extension page

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OctoBot [2.0.1](https://github.com/Drakkar-Software/OctoBot/blob/master/CHANGELOG.md)
1+
# OctoBot [2.0.2](https://github.com/Drakkar-Software/OctoBot/blob/master/CHANGELOG.md)
22
[![PyPI](https://img.shields.io/pypi/v/OctoBot.svg?logo=pypi)](https://pypi.org/project/OctoBot)
33
[![Downloads](https://pepy.tech/badge/octobot/month)](https://pepy.tech/project/octobot)
44
[![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot.svg?logo=docker)](https://hub.docker.com/r/drakkarsoftware/octobot)

additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlemen
195195
size = self.get_order_size(
196196
await self.get_portfolio(), price, symbol=symbol, settlement_currency=settlement_currency
197197
)
198+
self.check_order_size_and_price(size, price)
198199
# # DEBUG tools, uncomment to create specific orders
199200
# symbol = "BTC/USD:BTC"
200201
# market_status = self.exchange_manager.exchange.get_market_status(symbol)
@@ -832,6 +833,23 @@ def get_order_size(self, portfolio, price, symbol=None, order_size=None, settlem
832833
order_quantity
833834
)
834835

836+
def check_order_size_and_price(self, size, price, symbol=None):
837+
market_status = self.exchange_manager.exchange.get_market_status(str(symbol or self.SYMBOL))
838+
precision_amount = market_status[
839+
trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION.value
840+
].get(trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION_AMOUNT.value, 0)
841+
assert 0 <= precision_amount < 10 # is really the number of digits
842+
assert int(precision_amount) == precision_amount # is an int
843+
precision_price = market_status[
844+
trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION.value
845+
].get(trading_enums.ExchangeConstantsMarketStatusColumns.PRECISION_PRICE.value, 0)
846+
assert 0 < precision_price < 10 # is really the number of digits
847+
assert int(precision_price) == precision_price # is an int
848+
849+
assert personal_data_orders.decimal_trunc_with_n_decimal_digits(size, precision_amount) == size
850+
assert personal_data_orders.decimal_trunc_with_n_decimal_digits(price, precision_price) == price
851+
852+
835853
def get_sell_size_from_buy_order(self, buy_order):
836854
sell_size = buy_order.origin_quantity
837855
if buy_order.fee and buy_order.fee[trading_enums.FeePropertyColumns.CURRENCY.value] == self.ORDER_CURRENCY:
@@ -1016,7 +1034,9 @@ async def order_in_fetched_orders(self, method, previous_orders, order, symbol=N
10161034
print(f"=> {self.exchange_manager.exchange_name} {order.order_type} Order found in {len(fetched_orders)} "
10171035
f"{method.__name__} after after {time.time() - t0} seconds and {iterations} iterations. "
10181036
f"Order: [{order}].")
1019-
assert len(fetched_orders) == len(previous_orders) + 1
1037+
# use in as exchanges can have a max amount of fetched elements
1038+
assert len(fetched_orders) in (len(previous_orders), len(previous_orders) + 1), \
1039+
f"{len(fetched_orders)} not in {len(previous_orders), len(previous_orders) + 1}"
10201040
return True
10211041
else:
10221042
# check order not in open orders
@@ -1039,7 +1059,7 @@ async def order_in_fetched_orders(self, method, previous_orders, order, symbol=N
10391059
f" in {len(fetched_orders)} {method.__name__} after after {time.time() - t0} seconds "
10401060
f"and {iterations} iterations. "
10411061
f"Order: [{order}].")
1042-
assert len(fetched_orders) == max(len(previous_orders) - 1, 0)
1062+
assert len(fetched_orders) <= len(previous_orders), f"{len(fetched_orders)} !<= {len(previous_orders)}"
10431063
# order not found
10441064
return True
10451065
await asyncio.sleep(1)

additional_tests/exchanges_tests/test_bingx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TestBingxAuthenticatedExchange(
3535
USE_ORDER_OPERATION_TO_CHECK_API_KEY_RIGHTS = True
3636
EXPECT_MISSING_FEE_IN_CANCELLED_ORDERS = False
3737

38-
VALID_ORDER_ID = "1777764898965454838"
38+
VALID_ORDER_ID = "1812980957928929280"
3939

4040
async def test_get_portfolio(self):
4141
await super().test_get_portfolio()

octobot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
PROJECT_NAME = "OctoBot"
1818
AUTHOR = "Drakkar-Software"
19-
VERSION = "2.0.1" # major.minor.revision
19+
VERSION = "2.0.2" # major.minor.revision
2020
LONG_VERSION = f"{VERSION}"

octobot/community/authentication.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ async def update_orders(self, orders: list, exchange_name: str):
716716
"""
717717
formatted_orders = formatters.format_orders(orders, exchange_name)
718718
await self.supabase_client.update_bot_orders(self.user_account.bot_id, formatted_orders)
719+
self.logger.info(f"Bot orders updated: using {len(orders)} orders")
719720

720721
@_bot_data_update
721722
async def update_portfolio(self, current_value: dict, initial_value: dict, profitability: float,
@@ -729,16 +730,24 @@ async def update_portfolio(self, current_value: dict, initial_value: dict, profi
729730
current_value, initial_value, profitability, unit, content, price_by_asset, self.user_account.bot_id
730731
)
731732
if reset or self.user_account.get_selected_bot_current_portfolio_id() is None:
733+
self.logger.info(f"Switching bot portfolio")
732734
await self.supabase_client.switch_portfolio(formatted_portfolio)
733735
await self.refresh_selected_bot()
734736

735737
formatted_portfolio[backend_enums.PortfolioKeys.ID.value] = \
736738
self.user_account.get_selected_bot_current_portfolio_id()
737739
await self.supabase_client.update_portfolio(formatted_portfolio)
740+
self.logger.info(
741+
f"Bot portfolio [{formatted_portfolio[backend_enums.PortfolioKeys.ID.value]}] "
742+
f"updated with content: {formatted_portfolio[backend_enums.PortfolioKeys.CONTENT.value]}"
743+
)
738744
if formatted_histories := formatters.format_portfolio_history(
739745
history, unit, self.user_account.get_selected_bot_current_portfolio_id()
740746
):
741747
await self.supabase_client.upsert_portfolio_history(formatted_histories)
748+
self.logger.info(
749+
f"Bot portfolio [{formatted_portfolio[backend_enums.PortfolioKeys.ID.value]}] history updated"
750+
)
742751
except KeyError as err:
743752
self.logger.debug(f"Error when updating community portfolio {err} (missing reference market value)")
744753

octobot/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
# system
165165
ENABLE_CLOCK_SYNCH = os_util.parse_boolean_environment_var("ENABLE_CLOCK_SYNCH", "True")
166166
ENABLE_SYSTEM_WATCHER = os_util.parse_boolean_environment_var("ENABLE_SYSTEM_WATCHER", "True")
167+
WATCH_RAM = os_util.parse_boolean_environment_var("WATCH_RAM", "False")
167168
DUMP_USED_RESOURCES = os_util.parse_boolean_environment_var("DUMP_USED_RESOURCES", "False")
168169
USED_RESOURCES_OUTPUT = os.getenv("USED_RESOURCES_OUTPUT", "system_resources.csv")
169170

octobot/octobot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ async def _ensure_watchers(self):
262262
if constants.ENABLE_SYSTEM_WATCHER:
263263
await system_resources_watcher.start_system_resources_watcher(
264264
constants.DUMP_USED_RESOURCES,
265+
constants.WATCH_RAM,
265266
constants.USED_RESOURCES_OUTPUT
266267
)
267268

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Drakkar-Software requirements
2-
OctoBot-Commons==1.9.49
3-
OctoBot-Trading==2.4.91
2+
OctoBot-Commons==1.9.50
3+
OctoBot-Trading==2.4.92
44
OctoBot-Evaluators==1.9.5
55
OctoBot-Tentacles-Manager==2.9.15
66
OctoBot-Services==1.6.15

0 commit comments

Comments
 (0)