jnidzwetzki/bitfinex-v2-wss-api-java

View on GitHub

Showing 81 of 126 total issues

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

    public BitfinexOrderBookEntry(Long orderId, BigDecimal price, BigDecimal amount, Integer count) {
        this.orderId = orderId;
        this.price = price;
        this.amount = amount;
        this.count = count;
src/main/java/com/github/jnidzwetzki/bitfinex/v2/WebsocketClientEndpoint.java on lines 81..88
src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java on lines 215..222

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 49.

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

Method orderBook has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static BitfinexOrderBookSymbol orderBook(final String currency, final String profitCurrency, 
            final BitfinexOrderBookSymbol.Precision precision,
            final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) {

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            return Objects.equals(tradeId, that.tradeId) &&
                    Objects.equals(timestamp, that.timestamp) &&
                    Objects.equals(amount, that.amount) &&
                    Objects.equals(price, that.price) &&
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/BitfinexMyExecutedTrade.java on lines 152..155

    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 46.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            return Objects.equals(update, that.update) &&
                    Objects.equals(apiKey, that.apiKey) &&
                    Objects.equals(orderId, that.orderId) &&
                    Objects.equals(currencyPair, that.currencyPair) &&
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/BitfinexExecutedTrade.java on lines 111..114

    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 46.

    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

    Method jsonToBitfinexSubmittedOrder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private BitfinexSubmittedOrder jsonToBitfinexSubmittedOrder(final JSONArray json) {
            final BitfinexSubmittedOrder order = new BitfinexSubmittedOrder();
            order.setOrderId(json.getLong(0));
            final String gid = json.optString(1, null);
            if (gid != null) {

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        public static BitfinexExecutedTradeSymbol executedTrades(final String currency, 
                final String profitCurrency) {
            
            final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
            final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 118..123
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 182..188

    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 45.

    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

        public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
            
            final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
            final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
            
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 92..99
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 118..123

    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 45.

    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

    Method getCommand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public String getCommand(final BitfinexWebsocketClient client) throws BitfinexCommandException {
            final JSONObject orderJson = new JSONObject();
            orderJson.put("type", bitfinexOrder.getOrderType().getBifinexString());
            orderJson.put("symbol", bitfinexOrder.getCurrencyPair().toBitfinexString());

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        public static BitfinexOrderBookSymbol rawOrderBook(final String currency, final String profitCurrency) {
            final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
            final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
            
            return rawOrderBook(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull));
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 92..99
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java on lines 182..188

    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 45.

    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 4 locations. Consider refactoring.
    Open

        public FutureOperation unsubscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
            final FutureOperation future = new FutureOperation(tradeSymbol);
            pendingUnsubscribes.registerFuture(future);
    
            final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(tradeSymbol);
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 178..188
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 259..268
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 321..332

    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 44.

    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 4 locations. Consider refactoring.
    Open

        public FutureOperation subscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
    
            final FutureOperation future = new FutureOperation(tradeSymbol);
            pendingSubscribes.registerFuture(future);
            
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 178..188
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 259..268
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 342..350

    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 44.

    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 4 locations. Consider refactoring.
    Open

        public FutureOperation subscribeTicker(final BitfinexTickerSymbol tickerSymbol) 
                throws BitfinexClientException {
            
            final FutureOperation future = new FutureOperation(tickerSymbol);
            pendingSubscribes.registerFuture(future);
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 259..268
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 321..332
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 342..350

    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 44.

    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 4 locations. Consider refactoring.
    Open

        public FutureOperation subscribeCandles(final BitfinexCandlestickSymbol symbol) throws BitfinexClientException {
            
            final FutureOperation future = new FutureOperation(symbol);
            pendingSubscribes.registerFuture(future);
            
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 178..188
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 321..332
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java on lines 342..350

    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 44.

    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

        public static BitfinexCurrencyPair fromSymbolString(final String symbolString) {
            for (final BitfinexCurrencyPair currency : BitfinexCurrencyPair.values()) {
                if (currency.toBitfinexString().equalsIgnoreCase(symbolString)) {
                    return currency;
                }
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/BitfinexCandleTimeFrame.java on lines 58..65
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/BitfinexOrderType.java on lines 45..52

    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 42.

    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

        public static BitfinexCandleTimeFrame fromSymbolString(final String symbolString) {
            for (final BitfinexCandleTimeFrame timeframe : BitfinexCandleTimeFrame.values()) {
                if (timeframe.getBitfinexString().equals(symbolString)) {
                    return timeframe;
                }
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/BitfinexOrderType.java on lines 45..52
    src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java on lines 253..260

    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 42.

    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

    Avoid too many return statements within this method.
    Open

                    return false;

      Avoid too many return statements within this method.
      Open

                      return false;

        Avoid too many return statements within this method.
        Open

                    return false;

          Avoid too many return statements within this method.
          Open

                      return false;

            Avoid too many return statements within this method.
            Open

                            return false;
              Severity
              Category
              Status
              Source
              Language