Skip to content

Conversation

@techfreaque
Copy link
Contributor

@techfreaque techfreaque commented Jan 15, 2023

properly handle MissingMinimalExchangeTradeVolume

import octobot_trading.exchanges.connectors.ccxt.enums
import octobot_trading.exchanges.connectors.ccxt.enums as ccxt_enums
import octobot_trading.exchanges as exchanges
import octobot_trading.exchanges.exchange_builder as exchange_builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import philosophy is to import high level module (exchanges, personal_data) when not importing from within the module. The idea here is to prevent changing all imports when we update internal module architecture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, I removed those changes

"""


class MinimumOrderCostNotReachedError(Exception):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand why we need both MinimumOrderCostNotReachedError and MissingMinimalExchangeTradeVolume. MissingMinimalExchangeTradeVolume is not doing the same thing ? Should we raise it where you are raising MinimumOrderCostNotReachedError or you need another exception ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it so its using MissingMinimalExchangeTradeVolume, didnt notice that one

enums.ExchangeConstantsMarketPropertyColumns.TAKER.value:
market_status.get(enums.ExchangeConstantsMarketPropertyColumns.TAKER.value,
constants.CONFIG_DEFAULT_FEES),
) or constants.CONFIG_DEFAULT_FEES,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When market_status[ExchangeConstantsMarketPropertyColumns.TAKER.value], market_status[ExchangeConstantsMarketPropertyColumns.MAKER.value] or market_status[ExchangeConstantsMarketPropertyColumns.FEE.value] is None, it will now properly use the fallback fees. Before my changes it would set them to None

if not personal_data.check_cost(float(total_order_price), min_cost):
return []
symbol = f"{symbol_market['symbol']} - " if 'symbol' in symbol_market else ""
raise errors.MinimumOrderCostNotReachedError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should be catch if necessary everywhere this method is called

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added exceptions, also in the PR in octobot tentacles -> [Order] handle MinimumOrderCostNotReachedError

return side, parsed_order_type
except (KeyError, ValueError):
return None, None
return side, enums.TraderOrderType.UNKNOWN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was an accident, I removed it

@GuillaumeDSM
Copy link
Member

to reopen of relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants