Showing 142 of 497 total issues

Function decodeMsg_PORTFOLIO_VALUE has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private decodeMsg_PORTFOLIO_VALUE(): void {
    const version = this.readInt();

    const contract: Contract = {};
    if (version >= 6) {
Severity: Minor
Found in src/core/io/decoder.ts - About 2 hrs to fix

    Function reqWshEventData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      reqWshEventData(reqId: number, wshEventData: WshEventData): void {
        if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
          return this.emitError(
            "It does not support WSHE Calendar API.",
            ErrorCode.UPDATE_TWS,
    Severity: Minor
    Found in src/core/io/encoder.ts - About 1 hr to fix

      Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(options?: IBApiNextCreationOptions) {
          this.logger = new IBApiNextLogger(options?.logger ?? new ConsoleLogger());
      
          // create the IBApiAutoConnection and subscription registry
      
      
      Severity: Minor
      Found in src/api-next/api-next.ts - About 1 hr to fix

        Function reqMktDepth has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          reqMktDepth(
            tickerId: number,
            contract: Contract,
            numRows: number,
            isSmartDepth: boolean,
        Severity: Minor
        Found in src/core/io/encoder.ts - About 1 hr to fix

        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

        Function onData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private onData(data: Buffer): void {
            if (this.useV100Plus) {
              let dataToParse = data;
              if (this._v100MessageBuffer.length > 0) {
                dataToParse = Buffer.concat([this._v100MessageBuffer, data]);
        Severity: Minor
        Found in src/core/io/socket.ts - About 1 hr to fix

        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

        Function decodeMsg_BOND_CONTRACT_DATA has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private decodeMsg_BOND_CONTRACT_DATA(): void {
            let version = 6;
            if (this.serverVersion < MIN_SERVER_VER.SIZE_RULES) {
              version = this.readInt();
            }
        Severity: Minor
        Found in src/core/io/decoder.ts - About 1 hr to fix

        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

        Function decodeMsg_ORDER_STATUS has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private decodeMsg_ORDER_STATUS(): void {
            const version =
              this.serverVersion >= MIN_SERVER_VER.MARKET_CAP_PRICE
                ? Number.MAX_SAFE_INTEGER
                : this.readInt();
        Severity: Minor
        Found in src/core/io/decoder.ts - About 1 hr to fix

          Function process has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            process(): void {
              while (true) {
                // verify there is data to process
          
                if (!this.dataQueue.length) {
          Severity: Minor
          Found in src/core/io/decoder.ts - About 1 hr to fix

            Function start has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              start(): void {
                super.start();
            
                this.subscription$ = this.api
                  .getMarketData(
            Severity: Minor
            Found in src/tools/market-data.ts - About 1 hr to fix

              Function reqRealTimeBars has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                reqRealTimeBars(
                  tickerId: number,
                  contract: Contract,
                  barSize: number,
                  whatToShow: WhatToShow,
              Severity: Minor
              Found in src/core/io/encoder.ts - About 1 hr to fix

                Function start has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  start(): void {
                    super.start();
                
                    if (!this.cmdLineArgs.conid) {
                      this.error("-conid argument missing.");
                Severity: Minor
                Found in src/tools/historical-data.ts - About 1 hr to fix

                  Function decodeMsg_EXECUTION_DATA has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private decodeMsg_EXECUTION_DATA(): void {
                      let version = this.serverVersion;
                      if (version < MIN_SERVER_VER.LAST_LIQUIDITY) {
                        version = this.readInt();
                      }
                  Severity: Minor
                  Found in src/core/io/decoder.ts - About 1 hr to fix

                  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

                  Function readLastTradeDate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private readLastTradeDate(contract: ContractDetails, isBond: boolean): void {
                      const lastTradeDateOrContractMonth = this.readStr();
                      if (lastTradeDateOrContractMonth?.length) {
                        const tokens =
                          lastTradeDateOrContractMonth.indexOf("-") > 0
                  Severity: Minor
                  Found in src/core/io/decoder.ts - About 1 hr to fix

                  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

                  Function decodeMsg_SCANNER_DATA has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private decodeMsg_SCANNER_DATA(): void {
                      const version = this.readInt();
                      const reqId = this.readInt();
                      let numberOfElements = this.readInt();
                  
                  
                  Severity: Minor
                  Found in src/core/io/decoder.ts - About 1 hr to fix

                    Function calculateOptionPrice has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      calculateOptionPrice(
                        reqId: number,
                        contract: Contract,
                        volatility: number,
                        underPrice: number,
                    Severity: Minor
                    Found in src/core/io/encoder.ts - About 1 hr to fix

                      Function calculateImpliedVolatility has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        calculateImpliedVolatility(
                          reqId: number,
                          contract: Contract,
                          optionPrice: number,
                          underPrice: number,
                      Severity: Minor
                      Found in src/core/io/encoder.ts - About 1 hr to fix

                        Function readVolOrderParams has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          readVolOrderParams(readOpenOrderAttribs: boolean): void {
                            if (this.version >= 11) {
                              this.order.volatility = this.decoder.readDoubleOrUndefined();
                              this.order.volatilityType = this.decoder.readInt();
                              if (this.version == 11) {
                        Severity: Minor
                        Found in src/core/io/decoder.ts - About 1 hr to fix

                          Function onData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private onData(data: Buffer): void {
                              if (this.useV100Plus) {
                                let dataToParse = data;
                                if (this._v100MessageBuffer.length > 0) {
                                  dataToParse = Buffer.concat([this._v100MessageBuffer, data]);
                          Severity: Minor
                          Found in src/core/io/socket.ts - About 1 hr to fix

                            Function decodeMsg_TICK_PRICE has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private decodeMsg_TICK_PRICE(): void {
                                // read from input queue
                            
                                const version = this.readInt();
                                const tickerId = this.readInt();
                            Severity: Minor
                            Found in src/core/io/decoder.ts - About 1 hr to fix

                              Function readComboLegs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                readComboLegs(): void {
                                  if (this.version >= 14) {
                                    this.contract.comboLegsDescription = this.decoder.readStr();
                                  }
                              
                              
                              Severity: Minor
                              Found in src/core/io/decoder.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language