DogsTailFarmer/exchanges-wrapper

View on GitHub

Showing 6 of 6 total issues

Consider simplifying this complex logical expression.
Open

        if self.exchange == 'bybit' and payload:
            if payload.get('retCode') == 0:
                return payload.get('result'), payload.get('time')
            elif payload.get('retCode') == 10002:
                raise ExchangeError(ERR_TIMESTAMP_OUTSIDE_RECV_WINDOW)
Severity: Critical
Found in exchanges_wrapper/http_client.py - About 2 hrs to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class OrderType(Enum):
        LIMIT = "LIMIT"
        MARKET = "MARKET"
        STOP_LOSS = "STOP_LOSS"
        STOP_LOSS_LIMIT = "STOP_LOSS_LIMIT"
    Severity: Major
    Found in exchanges_wrapper/definitions.py and 2 other locations - About 1 hr to fix
    exchanges_wrapper/definitions.py on lines 16..23
    exchanges_wrapper/definitions.py on lines 32..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class SymbolStatus(Enum):
        PRE_TRADING = "PRE_TRADING"
        TRADING = "TRADING"
        POST_TRADING = "POST_TRADING"
        END_OF_DAY = "END_OF_DAY"
    Severity: Major
    Found in exchanges_wrapper/definitions.py and 2 other locations - About 1 hr to fix
    exchanges_wrapper/definitions.py on lines 32..39
    exchanges_wrapper/definitions.py on lines 65..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class OrderStatus(Enum):
        NEW = "NEW"  # The order has been accepted by the engine.
        PARTIALLY_FILLED = "PARTIALLY_FILLED"  # A part of the order has been filled.
        FILLED = "FILLED"  # The order has been completely filled.
        CANCELED = "CANCELED"  # The order has been canceled by the user.
    Severity: Major
    Found in exchanges_wrapper/definitions.py and 2 other locations - About 1 hr to fix
    exchanges_wrapper/definitions.py on lines 16..23
    exchanges_wrapper/definitions.py on lines 65..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Consider simplifying this complex logical expression.
    Open

                if _data := msg_data.get('data'):
                    if ch_type == 'depth5':
                        if msg_data["type"] == 'snapshot' or _data["u"] == 1:
                            self._order_book = bbt.OrderBook(_data)
                    elif ch_type == 'miniTicker':
    Severity: Major
    Found in exchanges_wrapper/web_sockets.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if (not ch_type and
                          msg_data.get('arg', {}).get('channel') in ('account', 'orders', 'balance_and_position')
                          and msg_data.get('data')):
                      await self._handle_event(msg_data)
                  elif ch_type and msg_data.get('data'):
      Severity: Major
      Found in exchanges_wrapper/web_sockets.py - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language