diff --git a/.eslintrc.js b/.eslintrc.js index 495973b..b1d5723 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,28 +1,18 @@ module.exports = { - 'env': { - 'browser': true, - 'es2021': true, + env: { + browser: true, + es2021: true, }, - 'extends': [ - 'google', - 'plugin:@typescript-eslint/eslint-recommended', + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', ], - 'parser': '@typescript-eslint/parser', - 'parserOptions': { - 'ecmaVersion': 13, - 'sourceType': 'module', - }, - 'plugins': [ - '@typescript-eslint', - ], - 'rules': { - 'max-len': 'off', - 'no-unused-vars': 'off', - 'valid-jsdoc': ['error', { - 'requireReturnType': false, - 'requireParamType': false, - 'requireReturn': false, - }], - '@typescript-eslint/no-unused-vars': 'error', + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 13, + sourceType: 'module', }, + plugins: ['@typescript-eslint'], + rules: {}, }; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..b5c68e5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: '' assignees: '' - --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7..2f28cea 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,7 +4,6 @@ about: Suggest an idea for this project title: '' labels: '' assignees: '' - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e66a9c6..1ac4ab4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,14 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - cron: '35 21 * * 1' @@ -32,39 +32,39 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/.travis.yml b/.travis.yml index df3e6fd..794673b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: node_js node_js: -- 16 + - 16 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index be24f05..a851452 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/README.md b/README.md index 6d04af5..632181f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Indicator is a TypeScript module providing various stock technical analysis indicators, strategies, and a backtest framework for trading. -*This is a clone of my [Indicator Go](https://github.com/cinar/indicator) Golang module.* +_This is a clone of my [Indicator Go](https://github.com/cinar/indicator) Golang module._ ## Indicators Provided diff --git a/jest.config.cjs b/jest.config.cjs index 21cde07..e1369d5 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -2,7 +2,5 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', - testMatch: [ - '**/*.test.ts', - ], -}; \ No newline at end of file + testMatch: ['**/*.test.ts'], +}; diff --git a/package-lock.json b/package-lock.json index 8c28dcd..b3b4b0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,12 @@ "license": "MIT", "devDependencies": { "@types/jest": "^27.0.3", - "@typescript-eslint/eslint-plugin": "^5.9.0", - "@typescript-eslint/parser": "^5.9.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "eslint": "^8.6.0", - "eslint-config-google": "^0.14.0", + "eslint-config-prettier": "^8.3.0", "jest": "^27.4.5", + "prettier": "^2.5.1", "rollup": "^2.63.0", "rollup-plugin-ts": "^2.0.5", "ts-jest": "^27.1.2", @@ -1224,14 +1225,14 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.0.tgz", - "integrity": "sha512-qT4lr2jysDQBQOPsCCvpPUZHjbABoTJW8V9ZzIYKHMfppJtpdtzszDYsldwhFxlhvrp7aCHeXD1Lb9M1zhwWwQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "5.9.0", - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/type-utils": "5.9.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1265,61 +1266,15 @@ "node": ">= 4" } }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.0.tgz", - "integrity": "sha512-ZnLVjBrf26dn7ElyaSKa6uDhqwvAi4jBBmHK1VxuFGPRAxhdi18ubQYSGA7SRiFiES3q9JiBOBHEBStOFkwD2g==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/typescript-estree": "5.9.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/experimental-utils/node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@typescript-eslint/experimental-utils/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/@typescript-eslint/parser": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.0.tgz", - "integrity": "sha512-/6pOPz8yAxEt4PLzgbFRDpZmHnXCeZgPDrh/1DaVKOjvn/UPMlWhbx/gA96xRi2JxY1kBl2AmwVbyROUqys5xQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/typescript-estree": "5.9.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", "debug": "^4.3.2" }, "engines": { @@ -1339,13 +1294,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.9.0.tgz", - "integrity": "sha512-DKtdIL49Qxk2a8icF6whRk7uThuVz4A6TCXfjdJSwOsf+9ree7vgQWcx0KOyCdk0i9ETX666p4aMhrRhxhUkyg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/visitor-keys": "5.9.0" + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1356,12 +1311,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.9.0.tgz", - "integrity": "sha512-uVCb9dJXpBrK1071ri5aEW7ZHdDHAiqEjYznF3HSSvAJXyrkxGOw2Ejibz/q6BXdT8lea8CMI0CzKNFTNI6TEQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", "dev": true, "dependencies": { - "@typescript-eslint/experimental-utils": "5.9.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1382,9 +1337,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.9.0.tgz", - "integrity": "sha512-mWp6/b56Umo1rwyGCk8fPIzb9Migo8YOniBGPAQDNC6C52SeyNGN4gsVwQTAR+RS2L5xyajON4hOLwAGwPtUwg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1395,13 +1350,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.0.tgz", - "integrity": "sha512-kxo3xL2mB7XmiVZcECbaDwYCt3qFXz99tBSuVJR4L/sR7CJ+UNAPrYILILktGj1ppfZ/jNt/cWYbziJUlHl1Pw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/visitor-keys": "5.9.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1421,13 +1376,59 @@ } } }, + "node_modules/@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.0.tgz", - "integrity": "sha512-6zq0mb7LV0ThExKlecvpfepiB+XEtFv/bzx7/jKSgyXTFD7qjmSu1FoiS0x3OZaiS+UIXpH2vd9O89f02RCtgw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.9.0", + "@typescript-eslint/types": "5.10.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -2426,16 +2427,16 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-google": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", - "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", + "node_modules/eslint-config-prettier": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", + "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", "dev": true, - "engines": { - "node": ">=0.10.0" + "bin": { + "eslint-config-prettier": "bin/cli.js" }, "peerDependencies": { - "eslint": ">=5.16.0" + "eslint": ">=7.0.0" } }, "node_modules/eslint-scope": { @@ -2630,9 +2631,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.9.tgz", - "integrity": "sha512-MBwILhhD92sziIrMQwpqcuGERF+BH99ei2a3XsGJuqEKcSycAL+w0HWokFenZXona+kjFr82Lf71eTxNRC06XQ==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -4409,6 +4410,18 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/pretty-format": { "version": "27.4.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.2.tgz", @@ -6477,14 +6490,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.0.tgz", - "integrity": "sha512-qT4lr2jysDQBQOPsCCvpPUZHjbABoTJW8V9ZzIYKHMfppJtpdtzszDYsldwhFxlhvrp7aCHeXD1Lb9M1zhwWwQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.9.0", - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/type-utils": "5.9.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -6501,85 +6514,53 @@ } } }, - "@typescript-eslint/experimental-utils": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.0.tgz", - "integrity": "sha512-ZnLVjBrf26dn7ElyaSKa6uDhqwvAi4jBBmHK1VxuFGPRAxhdi18ubQYSGA7SRiFiES3q9JiBOBHEBStOFkwD2g==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/typescript-estree": "5.9.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" - }, - "dependencies": { - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - } - } - }, "@typescript-eslint/parser": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.9.0.tgz", - "integrity": "sha512-/6pOPz8yAxEt4PLzgbFRDpZmHnXCeZgPDrh/1DaVKOjvn/UPMlWhbx/gA96xRi2JxY1kBl2AmwVbyROUqys5xQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.9.0", - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/typescript-estree": "5.9.0", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.9.0.tgz", - "integrity": "sha512-DKtdIL49Qxk2a8icF6whRk7uThuVz4A6TCXfjdJSwOsf+9ree7vgQWcx0KOyCdk0i9ETX666p4aMhrRhxhUkyg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/visitor-keys": "5.9.0" + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" } }, "@typescript-eslint/type-utils": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.9.0.tgz", - "integrity": "sha512-uVCb9dJXpBrK1071ri5aEW7ZHdDHAiqEjYznF3HSSvAJXyrkxGOw2Ejibz/q6BXdT8lea8CMI0CzKNFTNI6TEQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "5.9.0", + "@typescript-eslint/utils": "5.10.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.9.0.tgz", - "integrity": "sha512-mWp6/b56Umo1rwyGCk8fPIzb9Migo8YOniBGPAQDNC6C52SeyNGN4gsVwQTAR+RS2L5xyajON4hOLwAGwPtUwg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.0.tgz", - "integrity": "sha512-kxo3xL2mB7XmiVZcECbaDwYCt3qFXz99tBSuVJR4L/sR7CJ+UNAPrYILILktGj1ppfZ/jNt/cWYbziJUlHl1Pw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.9.0", - "@typescript-eslint/visitor-keys": "5.9.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -6587,13 +6568,45 @@ "tsutils": "^3.21.0" } }, + "@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, "@typescript-eslint/visitor-keys": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.0.tgz", - "integrity": "sha512-6zq0mb7LV0ThExKlecvpfepiB+XEtFv/bzx7/jKSgyXTFD7qjmSu1FoiS0x3OZaiS+UIXpH2vd9O89f02RCtgw==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.9.0", + "@typescript-eslint/types": "5.10.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -7354,10 +7367,10 @@ "v8-compile-cache": "^2.0.3" } }, - "eslint-config-google": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", - "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", + "eslint-config-prettier": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", + "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", "dev": true, "requires": {} }, @@ -7499,9 +7512,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.9.tgz", - "integrity": "sha512-MBwILhhD92sziIrMQwpqcuGERF+BH99ei2a3XsGJuqEKcSycAL+w0HWokFenZXona+kjFr82Lf71eTxNRC06XQ==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -8870,6 +8883,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true + }, "pretty-format": { "version": "27.4.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.2.tgz", diff --git a/package.json b/package.json index ac12020..36bfcd1 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "build": "rollup -c", "lint": "eslint --ignore-path .gitignore .", - "fix": "eslint --fix --ext .ts src", + "fix": "prettier --ignore-path .gitignore --write . ; eslint --fix --ext .ts src", "test": "jest" }, "repository": { @@ -32,11 +32,12 @@ "homepage": "https://github.com/cinar/indicatorts#readme", "devDependencies": { "@types/jest": "^27.0.3", - "@typescript-eslint/eslint-plugin": "^5.9.0", - "@typescript-eslint/parser": "^5.9.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "eslint": "^8.6.0", - "eslint-config-google": "^0.14.0", + "eslint-config-prettier": "^8.3.0", "jest": "^27.4.5", + "prettier": "^2.5.1", "rollup": "^2.63.0", "rollup-plugin-ts": "^2.0.5", "ts-jest": "^27.1.2", diff --git a/rollup.config.js b/rollup.config.js index fd7c8e5..48e55e0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,8 +12,5 @@ export default { format: 'es', }, ], - plugins: [ - ts(), - ], + plugins: [ts()], }; - diff --git a/src/backtest/backtest.ts b/src/backtest/backtest.ts index fd9842f..034771b 100644 --- a/src/backtest/backtest.ts +++ b/src/backtest/backtest.ts @@ -1,10 +1,10 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {applyActions} from '../strategy/action'; -import {Asset} from '../strategy/asset'; -import {StrategyInfo} from './strategyInfo'; -import {StrategyResult} from './strategyResult'; +import { applyActions } from '../strategy/action'; +import { Asset } from '../strategy/asset'; +import { StrategyInfo } from './strategyInfo'; +import { StrategyResult } from './strategyResult'; /** * Backtests the given strategies. @@ -13,7 +13,10 @@ import {StrategyResult} from './strategyResult'; * @param infos strategy infos. * @return strategy results. */ -export function backtest(asset: Asset, infos: StrategyInfo[]): StrategyResult[] { +export function backtest( + asset: Asset, + infos: StrategyInfo[] +): StrategyResult[] { const result = new Array(infos.length); for (let i = 0; i < result.length; i++) { diff --git a/src/backtest/companyResult.ts b/src/backtest/companyResult.ts index 4ac3842..a97c0f5 100644 --- a/src/backtest/companyResult.ts +++ b/src/backtest/companyResult.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {StrategyResult} from './strategyResult'; -import {CompanyInfo} from '../company/companyInfo'; +import { StrategyResult } from './strategyResult'; +import { CompanyInfo } from '../company/companyInfo'; /** * Company result. @@ -32,33 +32,29 @@ export enum CompanyResultSortBy { * @return sorted results. */ export function sortCompanyResults( - companyResults: CompanyResult[], - sortBy: CompanyResultSortBy, - ascending: boolean, + companyResults: CompanyResult[], + sortBy: CompanyResultSortBy, + ascending: boolean ): CompanyResult[] { let sorted: CompanyResult[] = []; switch (sortBy) { case CompanyResultSortBy.SYMBOL: sorted = companyResults.sort((a, b) => { - return a.companyInfo.symbol.localeCompare( - b.companyInfo.symbol, - ); + return a.companyInfo.symbol.localeCompare(b.companyInfo.symbol); }); break; case CompanyResultSortBy.NAME: sorted = companyResults.sort((a, b) => { - return a.companyInfo.name.localeCompare( - b.companyInfo.name, - ); + return a.companyInfo.name.localeCompare(b.companyInfo.name); }); break; case CompanyResultSortBy.STRATEGY: sorted = companyResults.sort((a, b) => { return a.strategyResults[0].info.name.localeCompare( - b.strategyResults[0].info.name, + b.strategyResults[0].info.name ); }); break; @@ -71,7 +67,9 @@ export function sortCompanyResults( case CompanyResultSortBy.ACTION: sorted = companyResults.sort((a, b) => { - return a.strategyResults[0].lastAction - b.strategyResults[0].lastAction; + return ( + a.strategyResults[0].lastAction - b.strategyResults[0].lastAction + ); }); break; } diff --git a/src/backtest/strategyInfo.ts b/src/backtest/strategyInfo.ts index 572d92e..570a69a 100644 --- a/src/backtest/strategyInfo.ts +++ b/src/backtest/strategyInfo.ts @@ -1,34 +1,34 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {buyAndHoldStrategy} from '../strategy/buyAndHoldStrategy'; -import {awesomeOscillatorStrategy} from '../strategy/momentum/awesomeOscillatorStrategy'; -import {ichimokuCloudStrategy} from '../strategy/momentum/ichimokuCloudStrategy'; -import {stochasticOscillatorStrategy} from '../strategy/momentum/stochasticOscillatorStrategy'; -import {williamsRStrategy} from '../strategy/momentum/williamsRStrategy'; -import {StrategyFunction} from '../strategy/strategyFunction'; -import {defaultAbsolutePriceOscillatorStrategy} from '../strategy/trend/absolutePriceOscillatorStrategy'; -import {aroonStrategy} from '../strategy/trend/aroonStrategy'; -import {balanceOfPowerStrategy} from '../strategy/trend/balanceOfPowerStrategy'; -import {chandeForecastOscillatorStrategy} from '../strategy/trend/chandeForecastOscillatorStrategy'; -import {kdjStrategy} from '../strategy/trend/kdjStrategy'; -import {macdStrategy} from '../strategy/trend/macdStrategy'; -import {parabolicSarStrategy} from '../strategy/trend/parabolicSarStrategy'; -import {typicalPriceStrategy} from '../strategy/trend/typicalPriceStrategy'; -import {vortexStrategy} from '../strategy/trend/vortexStrategy'; -import {accelerationBandsStrategy} from '../strategy/volatility/accelerationBandsStrategy'; -import {bollingerBandsStrategy} from '../strategy/volatility/bollingerBandsStrategy'; -import {projectionOscillatorStrategy} from '../strategy/volatility/projectionOscillatorStrategy'; -import {chaikinMoneyFlowStrategy} from '../strategy/volume/chaikinMoneyFlowStrategy'; -import {easeOfMovementStrategy} from '../strategy/volume/easeOfMovementStrategy'; -import {forceIndexStrategy} from '../strategy/volume/forceIndexStrategy'; -import {moneyFlowIndexStrategy} from '../strategy/volume/moneyFlowIndexStrategy'; -import {negativeVolumeIndexStrategy} from '../strategy/volume/negativeVolumeIndexStrategy'; -import {volumeWeightedAveragePriceStrategy} from '../strategy/volume/volumeWeightedAveragePriceStrategy'; +import { buyAndHoldStrategy } from '../strategy/buyAndHoldStrategy'; +import { awesomeOscillatorStrategy } from '../strategy/momentum/awesomeOscillatorStrategy'; +import { ichimokuCloudStrategy } from '../strategy/momentum/ichimokuCloudStrategy'; +import { stochasticOscillatorStrategy } from '../strategy/momentum/stochasticOscillatorStrategy'; +import { williamsRStrategy } from '../strategy/momentum/williamsRStrategy'; +import { StrategyFunction } from '../strategy/strategyFunction'; +import { defaultAbsolutePriceOscillatorStrategy } from '../strategy/trend/absolutePriceOscillatorStrategy'; +import { aroonStrategy } from '../strategy/trend/aroonStrategy'; +import { balanceOfPowerStrategy } from '../strategy/trend/balanceOfPowerStrategy'; +import { chandeForecastOscillatorStrategy } from '../strategy/trend/chandeForecastOscillatorStrategy'; +import { kdjStrategy } from '../strategy/trend/kdjStrategy'; +import { macdStrategy } from '../strategy/trend/macdStrategy'; +import { parabolicSarStrategy } from '../strategy/trend/parabolicSarStrategy'; +import { typicalPriceStrategy } from '../strategy/trend/typicalPriceStrategy'; +import { vortexStrategy } from '../strategy/trend/vortexStrategy'; +import { accelerationBandsStrategy } from '../strategy/volatility/accelerationBandsStrategy'; +import { bollingerBandsStrategy } from '../strategy/volatility/bollingerBandsStrategy'; +import { projectionOscillatorStrategy } from '../strategy/volatility/projectionOscillatorStrategy'; +import { chaikinMoneyFlowStrategy } from '../strategy/volume/chaikinMoneyFlowStrategy'; +import { easeOfMovementStrategy } from '../strategy/volume/easeOfMovementStrategy'; +import { forceIndexStrategy } from '../strategy/volume/forceIndexStrategy'; +import { moneyFlowIndexStrategy } from '../strategy/volume/moneyFlowIndexStrategy'; +import { negativeVolumeIndexStrategy } from '../strategy/volume/negativeVolumeIndexStrategy'; +import { volumeWeightedAveragePriceStrategy } from '../strategy/volume/volumeWeightedAveragePriceStrategy'; /** - * Strategy info. - */ + * Strategy info. + */ export interface StrategyInfo { name: string; strategy: StrategyFunction; diff --git a/src/backtest/strategyResult.ts b/src/backtest/strategyResult.ts index 75cb3e2..74fcf66 100644 --- a/src/backtest/strategyResult.ts +++ b/src/backtest/strategyResult.ts @@ -1,12 +1,12 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Action} from '../strategy/action'; -import {StrategyInfo} from './strategyInfo'; +import { Action } from '../strategy/action'; +import { StrategyInfo } from './strategyInfo'; /** - * Strategy result. - */ + * Strategy result. + */ export interface StrategyResult { info: StrategyInfo; gain: number; diff --git a/src/backtest/strategyStats.ts b/src/backtest/strategyStats.ts index 2417742..7634b81 100644 --- a/src/backtest/strategyStats.ts +++ b/src/backtest/strategyStats.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {CompanyResult} from './companyResult'; -import {StrategyInfo} from './strategyInfo'; -import {StrategyResult} from './strategyResult'; +import { CompanyResult } from './companyResult'; +import { StrategyInfo } from './strategyInfo'; +import { StrategyResult } from './strategyResult'; /** * Strategy stats. @@ -51,7 +51,9 @@ function updateStrategyStats(stats: StrategyStats, result: StrategyResult) { * @param companyResults company results. * @return stats array. */ -export function computeStrategyStats(companyResults: CompanyResult[]): StrategyStats[] { +export function computeStrategyStats( + companyResults: CompanyResult[] +): StrategyStats[] { const statsMap = new Map(); for (const companyResult of companyResults) { @@ -61,8 +63,7 @@ export function computeStrategyStats(companyResults: CompanyResult[]): StrategyS if (strategyStats !== undefined) { updateStrategyStats(strategyStats, strategyResult); } else { - statsMap.set(strategyResult.info.name, - newStrategyStats(strategyResult)); + statsMap.set(strategyResult.info.name, newStrategyStats(strategyResult)); } } @@ -80,7 +81,7 @@ export enum StrategyStatsSortBy { SCORE, MIN, MAX, - AVERAGE + AVERAGE, } /** @@ -92,15 +93,17 @@ export enum StrategyStatsSortBy { * @return sorted stats. */ export function sortStrategyStats( - strategyStats: StrategyStats[], - sortBy: StrategyStatsSortBy, - ascending: boolean, + strategyStats: StrategyStats[], + sortBy: StrategyStatsSortBy, + ascending: boolean ): StrategyStats[] { let sorted: StrategyStats[] = []; switch (sortBy) { case StrategyStatsSortBy.STRATEGY: - sorted = strategyStats.sort((a, b) => a.strategyInfo.name.localeCompare(b.strategyInfo.name)); + sorted = strategyStats.sort((a, b) => + a.strategyInfo.name.localeCompare(b.strategyInfo.name) + ); break; case StrategyStatsSortBy.SCORE: diff --git a/src/chart/chart.ts b/src/chart/chart.ts index c79edaa..a45c395 100644 --- a/src/chart/chart.ts +++ b/src/chart/chart.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigits} from '../helper/numArray'; -import {NumRange} from './numRange'; -import {NumScaler} from './numScaler'; +import { roundDigits } from '../helper/numArray'; +import { NumRange } from './numRange'; +import { NumScaler } from './numScaler'; const DEFAULT_STYLE = 'black'; const DEFAULT_WIDTH = 1; @@ -19,10 +19,10 @@ const DEFAULT_RANGE = new NumRange(0, 1); * Data set. */ export interface DataSet { - legend: string, - values: number[], - style?: string | string[], - width?: number, + legend: string; + values: number[]; + style?: string | string[]; + width?: number; } /** @@ -184,14 +184,16 @@ export class Chart { this.context.textBaseline = 'bottom'; for (const dataSet of this.dataSets.values()) { - if ((index >= 0) && (index < dataSet.values.length)) { - const text = dataSet.legend + ' ' + roundDigits(2, dataSet.values[index]).toString(); + if (index >= 0 && index < dataSet.values.length) { + const text = + dataSet.legend + + ' ' + + roundDigits(2, dataSet.values[index]).toString(); this.context.fillStyle = this.styleAtIndex(dataSet, index); - this.context.fillText(text, xOffset, - this.canvas.height - LEGEND_GAP); + this.context.fillText(text, xOffset, this.canvas.height - LEGEND_GAP); - xOffset += (this.context.measureText(text).width + LEGEND_GAP); + xOffset += this.context.measureText(text).width + LEGEND_GAP; } } } @@ -213,17 +215,18 @@ export class Chart { } this.xScaler = new NumScaler( - new NumRange(0, Math.max( - ...Array.from(this.dataSets.values(), (d) => d.values.length)), - ), - new NumRange(0, this.canvas.width), + new NumRange( + 0, + Math.max(...Array.from(this.dataSets.values(), (d) => d.values.length)) + ), + new NumRange(0, this.canvas.width) ); this.yScaler = new NumScaler( - NumRange.merge( - Array.from(this.dataSets.values(), (d) => NumRange.from(d.values)), - ), - new NumRange(0, this.chartHeight()), + NumRange.merge( + Array.from(this.dataSets.values(), (d) => NumRange.from(d.values)) + ), + new NumRange(0, this.chartHeight()) ); } diff --git a/src/chart/numRange.ts b/src/chart/numRange.ts index 8840b1d..bb45c24 100644 --- a/src/chart/numRange.ts +++ b/src/chart/numRange.ts @@ -48,10 +48,9 @@ export class NumRange { * @return merged ranges. */ static merge(ranges: NumRange[]): NumRange { - return ranges.reduce((p, c) => new NumRange( - Math.min(p.min, c.min), - Math.max(p.max, c.max), - )); + return ranges.reduce( + (p, c) => new NumRange(Math.min(p.min, c.min), Math.max(p.max, c.max)) + ); } /** @@ -60,10 +59,6 @@ export class NumRange { * @return range of the values. */ static from(values: number[]): NumRange { - return new NumRange( - Math.min(...values), - Math.max(...values), - ); + return new NumRange(Math.min(...values), Math.max(...values)); } } - diff --git a/src/chart/numScaler.ts b/src/chart/numScaler.ts index fcbc6a8..92a642d 100644 --- a/src/chart/numScaler.ts +++ b/src/chart/numScaler.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {NumRange} from './numRange'; +import { NumRange } from './numRange'; /** * Numeric scaler. @@ -28,7 +28,7 @@ export class NumScaler { * @return scaled value. */ scale(n: number): number { - return ((n - this.fromDelta) * this.multiplier) + this.toDelta; + return (n - this.fromDelta) * this.multiplier + this.toDelta; } /** @@ -37,6 +37,6 @@ export class NumScaler { * @return descaled value. */ descale(n: number): number { - return ((n - this.toDelta) / this.multiplier) + this.fromDelta; + return (n - this.toDelta) / this.multiplier + this.fromDelta; } } diff --git a/src/company/companyInfo.ts b/src/company/companyInfo.ts index 454a0e5..cae28b6 100644 --- a/src/company/companyInfo.ts +++ b/src/company/companyInfo.ts @@ -15,510 +15,3030 @@ export interface CompanyInfo { * SP500 companies. */ export const SP500_COMPANIES: CompanyInfo[] = [ - {symbol: 'SPY', name: 'S&P 500 Composite Index', sector: 'Composite Index', subIndustry: 'Composite Index'}, - {symbol: 'A', name: 'Agilent Technologies', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'AAL', name: 'American Airlines Group', sector: 'Industrials', subIndustry: 'Airlines'}, - {symbol: 'AAP', name: 'Advance Auto Parts', sector: 'Consumer Discretionary', subIndustry: 'Automotive Retail'}, - {symbol: 'AAPL', name: 'Apple', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'ABBV', name: 'AbbVie', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'ABC', name: 'AmerisourceBergen', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'ABMD', name: 'Abiomed', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'ABT', name: 'Abbott Laboratories', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'ACN', name: 'Accenture', sector: 'Information Technology', subIndustry: 'IT Consulting & Other Services'}, - {symbol: 'ADBE', name: 'Adobe', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'ADI', name: 'Analog Devices', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'ADM', name: 'ADM', sector: 'Consumer Staples', subIndustry: 'Agricultural Products'}, - {symbol: 'ADP', name: 'Automatic Data Processing', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'ADSK', name: 'Autodesk', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'AEE', name: 'Ameren Corp', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'AEP', name: 'American Electric Power', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'AES', name: 'AES Corp', sector: 'Utilities', subIndustry: 'Independent Power Producers & Energy Traders'}, - {symbol: 'AFL', name: 'Aflac', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'AIG', name: 'American International Group', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'AIZ', name: 'Assurant', sector: 'Financials', subIndustry: 'Multi-line Insurance'}, - {symbol: 'AJG', name: 'Arthur J. Gallagher & Co.', sector: 'Financials', subIndustry: 'Insurance Brokers'}, - {symbol: 'AKAM', name: 'Akamai Technologies', sector: 'Information Technology', subIndustry: 'Internet Services & Infrastructure'}, - {symbol: 'ALB', name: 'Albemarle Corporation', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'ALGN', name: 'Align Technology', sector: 'Health Care', subIndustry: 'Health Care Supplies'}, - {symbol: 'ALK', name: 'Alaska Air Group', sector: 'Industrials', subIndustry: 'Airlines'}, - {symbol: 'ALL', name: 'Allstate Corp', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'ALLE', name: 'Allegion', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'AMAT', name: 'Applied Materials', sector: 'Information Technology', subIndustry: 'Semiconductor Equipment'}, - {symbol: 'AMCR', name: 'Amcor', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'AMD', name: 'Advanced Micro Devices', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'AME', name: 'Ametek', sector: 'Industrials', subIndustry: 'Electrical Components & Equipment'}, - {symbol: 'AMGN', name: 'Amgen', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'AMP', name: 'Ameriprise Financial', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'AMT', name: 'American Tower', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'AMZN', name: 'Amazon', sector: 'Consumer Discretionary', subIndustry: 'Internet & Direct Marketing Retail'}, - {symbol: 'ANET', name: 'Arista Networks', sector: 'Information Technology', subIndustry: 'Communications Equipment'}, - {symbol: 'ANSS', name: 'Ansys', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'ANTM', name: 'Anthem', sector: 'Health Care', subIndustry: 'Managed Health Care'}, - {symbol: 'AON', name: 'Aon', sector: 'Financials', subIndustry: 'Insurance Brokers'}, - {symbol: 'AOS', name: 'A. O. Smith', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'APA', name: 'APA Corporation', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'APD', name: 'Air Products & Chemicals', sector: 'Materials', subIndustry: 'Industrial Gases'}, - {symbol: 'APH', name: 'Amphenol Corp', sector: 'Information Technology', subIndustry: 'Electronic Components'}, - {symbol: 'APTV', name: 'Aptiv', sector: 'Consumer Discretionary', subIndustry: 'Auto Parts & Equipment'}, - {symbol: 'ARE', name: 'Alexandria Real Estate Equities', sector: 'Real Estate', subIndustry: 'Office REITs'}, - {symbol: 'ATO', name: 'Atmos Energy', sector: 'Utilities', subIndustry: 'Gas Utilities'}, - {symbol: 'ATVI', name: 'Activision Blizzard', sector: 'Communication Services', subIndustry: 'Interactive Home Entertainment'}, - {symbol: 'AVB', name: 'AvalonBay Communities', sector: 'Real Estate', subIndustry: 'Residential REITs'}, - {symbol: 'AVGO', name: 'Broadcom', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'AVY', name: 'Avery Dennison', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'AWK', name: 'American Water Works', sector: 'Utilities', subIndustry: 'Water Utilities'}, - {symbol: 'AXP', name: 'American Express', sector: 'Financials', subIndustry: 'Consumer Finance'}, - {symbol: 'AZO', name: 'AutoZone', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'BA', name: 'Boeing Company', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'BAC', name: 'Bank of America', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'BAX', name: 'Baxter International', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'BBWI', name: 'Bath & Body Works, Inc.', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'BBY', name: 'Best Buy', sector: 'Consumer Discretionary', subIndustry: 'Computer & Electronics Retail'}, - {symbol: 'BDX', name: 'Becton Dickinson', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'BEN', name: 'Franklin Resources', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'BF.B', name: 'Brown–Forman', sector: 'Consumer Staples', subIndustry: 'Distillers & Vintners'}, - {symbol: 'BIIB', name: 'Biogen', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'BIO', name: 'Bio-Rad Laboratories', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'BK', name: 'BNY Mellon', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'BKNG', name: 'Booking Holdings', sector: 'Consumer Discretionary', subIndustry: 'Internet & Direct Marketing Retail'}, - {symbol: 'BKR', name: 'Baker Hughes', sector: 'Energy', subIndustry: 'Oil & Gas Equipment & Services'}, - {symbol: 'BLK', name: 'BlackRock', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'BLL', name: 'Ball Corp', sector: 'Materials', subIndustry: 'Metal & Glass Containers'}, - {symbol: 'BMY', name: 'Bristol-Myers Squibb', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'BR', name: 'Broadridge Financial Solutions', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'BRK.B', name: 'Berkshire Hathaway', sector: 'Financials', subIndustry: 'Multi-Sector Holdings'}, - {symbol: 'BSX', name: 'Boston Scientific', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'BWA', name: 'BorgWarner', sector: 'Consumer Discretionary', subIndustry: 'Auto Parts & Equipment'}, - {symbol: 'BXP', name: 'Boston Properties', sector: 'Real Estate', subIndustry: 'Office REITs'}, - {symbol: 'C', name: 'Citigroup', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'CAG', name: 'Conagra Brands', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'CAH', name: 'Cardinal Health', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'CARR', name: 'Carrier Global', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'CAT', name: 'Caterpillar', sector: 'Industrials', subIndustry: 'Construction Machinery & Heavy Trucks'}, - {symbol: 'CB', name: 'Chubb', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'CBOE', name: 'Cboe Global Markets', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'CBRE', name: 'CBRE', sector: 'Real Estate', subIndustry: 'Real Estate Services'}, - {symbol: 'CCI', name: 'Crown Castle', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'CCL', name: 'Carnival Corporation', sector: 'Consumer Discretionary', subIndustry: 'Hotels, Resorts & Cruise Lines'}, - {symbol: 'CDNS', name: 'Cadence Design Systems', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'CDW', name: 'CDW', sector: 'Information Technology', subIndustry: 'Technology Distributors'}, - {symbol: 'CE', name: 'Celanese', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'CERN', name: 'Cerner', sector: 'Health Care', subIndustry: 'Health Care Technology'}, - {symbol: 'CF', name: 'CF Industries', sector: 'Materials', subIndustry: 'Fertilizers & Agricultural Chemicals'}, - {symbol: 'CFG', name: 'Citizens Financial Group', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'CHD', name: 'Church & Dwight', sector: 'Consumer Staples', subIndustry: 'Household Products'}, - {symbol: 'CHRW', name: 'C. H. Robinson', sector: 'Industrials', subIndustry: 'Air Freight & Logistics'}, - {symbol: 'CHTR', name: 'Charter Communications', sector: 'Communication Services', subIndustry: 'Cable & Satellite'}, - {symbol: 'CI', name: 'Cigna', sector: 'Health Care', subIndustry: 'Managed Health Care'}, - {symbol: 'CINF', name: 'Cincinnati Financial', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'CL', name: 'Colgate-Palmolive', sector: 'Consumer Staples', subIndustry: 'Household Products'}, - {symbol: 'CLX', name: 'Clorox', sector: 'Consumer Staples', subIndustry: 'Household Products'}, - {symbol: 'CMA', name: 'Comerica', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'CMCSA', name: 'Comcast', sector: 'Communication Services', subIndustry: 'Cable & Satellite'}, - {symbol: 'CME', name: 'CME Group', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'CMG', name: 'Chipotle Mexican Grill', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'CMI', name: 'Cummins', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'CMS', name: 'CMS Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'CNC', name: 'Centene Corporation', sector: 'Health Care', subIndustry: 'Managed Health Care'}, - {symbol: 'CNP', name: 'CenterPoint Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'COF', name: 'Capital One Financial', sector: 'Financials', subIndustry: 'Consumer Finance'}, - {symbol: 'COG', name: 'Cabot Oil & Gas', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'COO', name: 'The Cooper Companies', sector: 'Health Care', subIndustry: 'Health Care Supplies'}, - {symbol: 'COP', name: 'ConocoPhillips', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'COST', name: 'Costco', sector: 'Consumer Staples', subIndustry: 'Hypermarkets & Super Centers'}, - {symbol: 'CPB', name: 'Campbell Soup', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'CPRT', name: 'Copart', sector: 'Industrials', subIndustry: 'Diversified Support Services'}, - {symbol: 'CRL', name: 'Charles River Laboratories', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'CRM', name: 'Salesforce', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'CSCO', name: 'Cisco Systems', sector: 'Information Technology', subIndustry: 'Communications Equipment'}, - {symbol: 'CSX', name: 'CSX', sector: 'Industrials', subIndustry: 'Railroads'}, - {symbol: 'CTAS', name: 'Cintas Corporation', sector: 'Industrials', subIndustry: 'Diversified Support Services'}, - {symbol: 'CTLT', name: 'Catalent', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'CTSH', name: 'Cognizant Technology Solutions', sector: 'Information Technology', subIndustry: 'IT Consulting & Other Services'}, - {symbol: 'CTVA', name: 'Corteva', sector: 'Materials', subIndustry: 'Fertilizers & Agricultural Chemicals'}, - {symbol: 'CTXS', name: 'Citrix Systems', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'CVS', name: 'CVS Health', sector: 'Health Care', subIndustry: 'Health Care Services'}, - {symbol: 'CVX', name: 'Chevron Corporation', sector: 'Energy', subIndustry: 'Integrated Oil & Gas'}, - {symbol: 'CZR', name: 'Caesars Entertainment', sector: 'Consumer Discretionary', subIndustry: 'Casinos & Gaming'}, - {symbol: 'D', name: 'Dominion Energy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'DAL', name: 'Delta Air Lines', sector: 'Industrials', subIndustry: 'Airlines'}, - {symbol: 'DD', name: 'DuPont', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'DE', name: 'Deere & Co.', sector: 'Industrials', subIndustry: 'Agricultural & Farm Machinery'}, - {symbol: 'DFS', name: 'Discover Financial Services', sector: 'Financials', subIndustry: 'Consumer Finance'}, - {symbol: 'DG', name: 'Dollar General', sector: 'Consumer Discretionary', subIndustry: 'General Merchandise Stores'}, - {symbol: 'DGX', name: 'Quest Diagnostics', sector: 'Health Care', subIndustry: 'Health Care Services'}, - {symbol: 'DHI', name: 'D. R. Horton', sector: 'Consumer Discretionary', subIndustry: 'Homebuilding'}, - {symbol: 'DHR', name: 'Danaher Corporation', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'DIS', name: 'The Walt Disney Company', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'DISCA', name: 'Discovery (Series A)', sector: 'Communication Services', subIndustry: 'Broadcasting'}, - {symbol: 'DISCK', name: 'Discovery (Series C)', sector: 'Communication Services', subIndustry: 'Broadcasting'}, - {symbol: 'DISH', name: 'Dish Network', sector: 'Communication Services', subIndustry: 'Cable & Satellite'}, - {symbol: 'DLR', name: 'Digital Realty Trust', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'DLTR', name: 'Dollar Tree', sector: 'Consumer Discretionary', subIndustry: 'General Merchandise Stores'}, - {symbol: 'DOV', name: 'Dover Corporation', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'DOW', name: 'Dow', sector: 'Materials', subIndustry: 'Commodity Chemicals'}, - {symbol: 'DPZ', name: 'Domino\'s Pizza', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'DRE', name: 'Duke Realty Corp', sector: 'Real Estate', subIndustry: 'Industrial REITs'}, - {symbol: 'DRI', name: 'Darden Restaurants', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'DTE', name: 'DTE Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'DUK', name: 'Duke Energy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'DVA', name: 'DaVita', sector: 'Health Care', subIndustry: 'Health Care Facilities'}, - {symbol: 'DVN', name: 'Devon Energy', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'DXC', name: 'DXC Technology', sector: 'Information Technology', subIndustry: 'IT Consulting & Other Services'}, - {symbol: 'DXCM', name: 'DexCom', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'EA', name: 'Electronic Arts', sector: 'Communication Services', subIndustry: 'Interactive Home Entertainment'}, - {symbol: 'EBAY', name: 'eBay', sector: 'Consumer Discretionary', subIndustry: 'Internet & Direct Marketing Retail'}, - {symbol: 'ECL', name: 'Ecolab', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'ED', name: 'Consolidated Edison', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'EFX', name: 'Equifax', sector: 'Industrials', subIndustry: 'Research & Consulting Services'}, - {symbol: 'EIX', name: 'Edison International', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'EL', name: 'Estée Lauder Companies', sector: 'Consumer Staples', subIndustry: 'Personal Products'}, - {symbol: 'EMN', name: 'Eastman Chemical', sector: 'Materials', subIndustry: 'Diversified Chemicals'}, - {symbol: 'EMR', name: 'Emerson Electric Company', sector: 'Industrials', subIndustry: 'Electrical Components & Equipment'}, - {symbol: 'ENPH', name: 'Enphase Energy', sector: 'Information Technology', subIndustry: 'Electronic Components'}, - {symbol: 'EOG', name: 'EOG Resources', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'EQIX', name: 'Equinix', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'EQR', name: 'Equity Residential', sector: 'Real Estate', subIndustry: 'Residential REITs'}, - {symbol: 'ES', name: 'Eversource Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'ESS', name: 'Essex Property Trust', sector: 'Real Estate', subIndustry: 'Residential REITs'}, - {symbol: 'ETN', name: 'Eaton Corporation', sector: 'Industrials', subIndustry: 'Electrical Components & Equipment'}, - {symbol: 'ETR', name: 'Entergy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'ETSY', name: 'Etsy', sector: 'Consumer Discretionary', subIndustry: 'Internet & Direct Marketing Retail'}, - {symbol: 'EVRG', name: 'Evergy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'EW', name: 'Edwards Lifesciences', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'EXC', name: 'Exelon', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'EXPD', name: 'Expeditors', sector: 'Industrials', subIndustry: 'Air Freight & Logistics'}, - {symbol: 'EXPE', name: 'Expedia Group', sector: 'Consumer Discretionary', subIndustry: 'Internet & Direct Marketing Retail'}, - {symbol: 'EXR', name: 'Extra Space Storage', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'F', name: 'Ford', sector: 'Consumer Discretionary', subIndustry: 'Automobile Manufacturers'}, - {symbol: 'FANG', name: 'Diamondback Energy', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'FAST', name: 'Fastenal', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'FB', name: 'Facebook', sector: 'Communication Services', subIndustry: 'Interactive Media & Services'}, - {symbol: 'FBHS', name: 'Fortune Brands Home & Security', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'FCX', name: 'Freeport-McMoRan', sector: 'Materials', subIndustry: 'Copper'}, - {symbol: 'FDX', name: 'FedEx', sector: 'Industrials', subIndustry: 'Air Freight & Logistics'}, - {symbol: 'FE', name: 'FirstEnergy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'FFIV', name: 'F5 Networks', sector: 'Information Technology', subIndustry: 'Communications Equipment'}, - {symbol: 'FIS', name: 'Fidelity National Information Services', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'FISV', name: 'Fiserv', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'FITB', name: 'Fifth Third Bancorp', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'FLT', name: 'Fleetcor', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'FMC', name: 'FMC Corporation', sector: 'Materials', subIndustry: 'Fertilizers & Agricultural Chemicals'}, - {symbol: 'FOX', name: 'Fox Corporation (Class B)', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'FOXA', name: 'Fox Corporation (Class A)', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'FRC', name: 'First Republic Bank', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'FRT', name: 'Federal Realty Investment Trust', sector: 'Real Estate', subIndustry: 'Retail REITs'}, - {symbol: 'FTNT', name: 'Fortinet', sector: 'Information Technology', subIndustry: 'Systems Software'}, - {symbol: 'FTV', name: 'Fortive', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'GD', name: 'General Dynamics', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'GE', name: 'General Electric', sector: 'Industrials', subIndustry: 'Industrial Conglomerates'}, - {symbol: 'GILD', name: 'Gilead Sciences', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'GIS', name: 'General Mills', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'GL', name: 'Globe Life', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'GLW', name: 'Corning', sector: 'Information Technology', subIndustry: 'Electronic Components'}, - {symbol: 'GM', name: 'General Motors', sector: 'Consumer Discretionary', subIndustry: 'Automobile Manufacturers'}, - {symbol: 'GNRC', name: 'Generac Holdings', sector: 'Industrials', subIndustry: 'Electrical Components & Equipment'}, - {symbol: 'GOOG', name: 'Alphabet (Class C)', sector: 'Communication Services', subIndustry: 'Interactive Media & Services'}, - {symbol: 'GOOGL', name: 'Alphabet (Class A)', sector: 'Communication Services', subIndustry: 'Interactive Media & Services'}, - {symbol: 'GPC', name: 'Genuine Parts', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'GPN', name: 'Global Payments', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'GPS', name: 'Gap', sector: 'Consumer Discretionary', subIndustry: 'Apparel Retail'}, - {symbol: 'GRMN', name: 'Garmin', sector: 'Consumer Discretionary', subIndustry: 'Consumer Electronics'}, - {symbol: 'GS', name: 'Goldman Sachs', sector: 'Financials', subIndustry: 'Investment Banking & Brokerage'}, - {symbol: 'GWW', name: 'W. W. Grainger', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'HAL', name: 'Halliburton', sector: 'Energy', subIndustry: 'Oil & Gas Equipment & Services'}, - {symbol: 'HAS', name: 'Hasbro', sector: 'Consumer Discretionary', subIndustry: 'Leisure Products'}, - {symbol: 'HBAN', name: 'Huntington Bancshares', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'HBI', name: 'Hanesbrands', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'HCA', name: 'HCA Healthcare', sector: 'Health Care', subIndustry: 'Health Care Facilities'}, - {symbol: 'HD', name: 'Home Depot', sector: 'Consumer Discretionary', subIndustry: 'Home Improvement Retail'}, - {symbol: 'HES', name: 'Hess Corporation', sector: 'Energy', subIndustry: 'Integrated Oil & Gas'}, - {symbol: 'HIG', name: 'The Hartford', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'HII', name: 'Huntington Ingalls Industries', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'HLT', name: 'Hilton Worldwide', sector: 'Consumer Discretionary', subIndustry: 'Hotels, Resorts & Cruise Lines'}, - {symbol: 'HOLX', name: 'Hologic', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'HON', name: 'Honeywell', sector: 'Industrials', subIndustry: 'Industrial Conglomerates'}, - {symbol: 'HPE', name: 'Hewlett Packard Enterprise', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'HPQ', name: 'HP', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'HRL', name: 'Hormel', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'HSIC', name: 'Henry Schein', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'HST', name: 'Host Hotels & Resorts', sector: 'Real Estate', subIndustry: 'Hotel & Resort REITs'}, - {symbol: 'HSY', name: 'The Hershey Company', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'HUM', name: 'Humana', sector: 'Health Care', subIndustry: 'Managed Health Care'}, - {symbol: 'HWM', name: 'Howmet Aerospace', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'IBM', name: 'IBM', sector: 'Information Technology', subIndustry: 'IT Consulting & Other Services'}, - {symbol: 'ICE', name: 'Intercontinental Exchange', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'IDXX', name: 'Idexx Laboratories', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'IEX', name: 'IDEX Corporation', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'IFF', name: 'International Flavors & Fragrances', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'ILMN', name: 'Illumina', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'INCY', name: 'Incyte', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'INFO', name: 'IHS Markit', sector: 'Industrials', subIndustry: 'Research & Consulting Services'}, - {symbol: 'INTC', name: 'Intel', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'INTU', name: 'Intuit', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'IP', name: 'International Paper', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'IPG', name: 'Interpublic Group', sector: 'Communication Services', subIndustry: 'Advertising'}, - {symbol: 'IPGP', name: 'IPG Photonics', sector: 'Information Technology', subIndustry: 'Electronic Manufacturing Services'}, - {symbol: 'IQV', name: 'IQVIA', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'IR', name: 'Ingersoll Rand', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'IRM', name: 'Iron Mountain', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'ISRG', name: 'Intuitive Surgical', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'IT', name: 'Gartner', sector: 'Information Technology', subIndustry: 'IT Consulting & Other Services'}, - {symbol: 'ITW', name: 'Illinois Tool Works', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'IVZ', name: 'Invesco', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'J', name: 'Jacobs Engineering Group', sector: 'Industrials', subIndustry: 'Construction & Engineering'}, - {symbol: 'JBHT', name: 'J. B. Hunt', sector: 'Industrials', subIndustry: 'Trucking'}, - {symbol: 'JCI', name: 'Johnson Controls', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'JKHY', name: 'Jack Henry & Associates', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'JNJ', name: 'Johnson & Johnson', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'JNPR', name: 'Juniper Networks', sector: 'Information Technology', subIndustry: 'Communications Equipment'}, - {symbol: 'JPM', name: 'JPMorgan Chase', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'K', name: 'Kellogg\'s', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'KEY', name: 'KeyCorp', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'KEYS', name: 'Keysight Technologies', sector: 'Information Technology', subIndustry: 'Electronic Equipment & Instruments'}, - {symbol: 'KHC', name: 'Kraft Heinz', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'KIM', name: 'Kimco Realty', sector: 'Real Estate', subIndustry: 'Retail REITs'}, - {symbol: 'KLAC', name: 'KLA Corporation', sector: 'Information Technology', subIndustry: 'Semiconductor Equipment'}, - {symbol: 'KMB', name: 'Kimberly-Clark', sector: 'Consumer Staples', subIndustry: 'Household Products'}, - {symbol: 'KMI', name: 'Kinder Morgan', sector: 'Energy', subIndustry: 'Oil & Gas Storage & Transportation'}, - {symbol: 'KMX', name: 'CarMax', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'KO', name: 'Coca-Cola Company', sector: 'Consumer Staples', subIndustry: 'Soft Drinks'}, - {symbol: 'KR', name: 'Kroger', sector: 'Consumer Staples', subIndustry: 'Food Retail'}, - {symbol: 'KSU', name: 'Kansas City Southern', sector: 'Industrials', subIndustry: 'Railroads'}, - {symbol: 'L', name: 'Loews Corporation', sector: 'Financials', subIndustry: 'Multi-line Insurance'}, - {symbol: 'LDOS', name: 'Leidos', sector: 'Industrials', subIndustry: 'Diversified Support Services'}, - {symbol: 'LEG', name: 'Leggett & Platt', sector: 'Consumer Discretionary', subIndustry: 'Home Furnishings'}, - {symbol: 'LEN', name: 'Lennar', sector: 'Consumer Discretionary', subIndustry: 'Homebuilding'}, - {symbol: 'LH', name: 'LabCorp', sector: 'Health Care', subIndustry: 'Health Care Services'}, - {symbol: 'LHX', name: 'L3Harris Technologies', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'LIN', name: 'Linde', sector: 'Materials', subIndustry: 'Industrial Gases'}, - {symbol: 'LKQ', name: 'LKQ Corporation', sector: 'Consumer Discretionary', subIndustry: 'Distributors'}, - {symbol: 'LLY', name: 'Eli Lilly & Co', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'LMT', name: 'Lockheed Martin', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'LNC', name: 'Lincoln National', sector: 'Financials', subIndustry: 'Multi-line Insurance'}, - {symbol: 'LNT', name: 'Alliant Energy', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'LOW', name: 'Lowe\'s', sector: 'Consumer Discretionary', subIndustry: 'Home Improvement Retail'}, - {symbol: 'LRCX', name: 'Lam Research', sector: 'Information Technology', subIndustry: 'Semiconductor Equipment'}, - {symbol: 'LUMN', name: 'Lumen Technologies', sector: 'Communication Services', subIndustry: 'Alternative Carriers'}, - {symbol: 'LUV', name: 'Southwest Airlines', sector: 'Industrials', subIndustry: 'Airlines'}, - {symbol: 'LVS', name: 'Las Vegas Sands', sector: 'Consumer Discretionary', subIndustry: 'Casinos & Gaming'}, - {symbol: 'LW', name: 'Lamb Weston', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'LYB', name: 'LyondellBasell', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'LYV', name: 'Live Nation Entertainment', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'MA', name: 'Mastercard', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'MAA', name: 'Mid-America Apartments', sector: 'Real Estate', subIndustry: 'Residential REITs'}, - {symbol: 'MAR', name: 'Marriott International', sector: 'Consumer Discretionary', subIndustry: 'Hotels, Resorts & Cruise Lines'}, - {symbol: 'MAS', name: 'Masco', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'MCD', name: 'McDonald\'s', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'MCHP', name: 'Microchip Technology', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'MCK', name: 'McKesson Corporation', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'MCO', name: 'Moody\'s Corporation', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'MDLZ', name: 'Mondelez International', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'MDT', name: 'Medtronic', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'MET', name: 'MetLife', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'MGM', name: 'MGM Resorts International', sector: 'Consumer Discretionary', subIndustry: 'Casinos & Gaming'}, - {symbol: 'MHK', name: 'Mohawk Industries', sector: 'Consumer Discretionary', subIndustry: 'Home Furnishings'}, - {symbol: 'MKC', name: 'McCormick & Company', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'MKTX', name: 'MarketAxess', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'MLM', name: 'Martin Marietta Materials', sector: 'Materials', subIndustry: 'Construction Materials'}, - {symbol: 'MMC', name: 'Marsh & McLennan', sector: 'Financials', subIndustry: 'Insurance Brokers'}, - {symbol: 'MMM', name: '3M', sector: 'Industrials', subIndustry: 'Industrial Conglomerates'}, - {symbol: 'MNST', name: 'Monster Beverage', sector: 'Consumer Staples', subIndustry: 'Soft Drinks'}, - {symbol: 'MO', name: 'Altria Group', sector: 'Consumer Staples', subIndustry: 'Tobacco'}, - {symbol: 'MOS', name: 'The Mosaic Company', sector: 'Materials', subIndustry: 'Fertilizers & Agricultural Chemicals'}, - {symbol: 'MPC', name: 'Marathon Petroleum', sector: 'Energy', subIndustry: 'Oil & Gas Refining & Marketing'}, - {symbol: 'MPWR', name: 'Monolithic Power Systems', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'MRK', name: 'Merck & Co.', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'MRNA', name: 'Moderna', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'MRO', name: 'Marathon Oil', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'MS', name: 'Morgan Stanley', sector: 'Financials', subIndustry: 'Investment Banking & Brokerage'}, - {symbol: 'MSCI', name: 'MSCI', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'MSFT', name: 'Microsoft', sector: 'Information Technology', subIndustry: 'Systems Software'}, - {symbol: 'MSI', name: 'Motorola Solutions', sector: 'Information Technology', subIndustry: 'Communications Equipment'}, - {symbol: 'MTB', name: 'M&T Bank', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'MTD', name: 'Mettler Toledo', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'MU', name: 'Micron Technology', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'MXIM', name: 'Maxim Integrated', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'NCLH', name: 'Norwegian Cruise Line Holdings', sector: 'Consumer Discretionary', subIndustry: 'Hotels, Resorts & Cruise Lines'}, - {symbol: 'NDAQ', name: 'Nasdaq', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'NEE', name: 'NextEra Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'NEM', name: 'Newmont', sector: 'Materials', subIndustry: 'Gold'}, - {symbol: 'NFLX', name: 'Netflix', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'NI', name: 'NiSource', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'NKE', name: 'Nike', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'NLOK', name: 'NortonLifeLock', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'NLSN', name: 'Nielsen Holdings', sector: 'Industrials', subIndustry: 'Research & Consulting Services'}, - {symbol: 'NOC', name: 'Northrop Grumman', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'NOV', name: 'Nov', sector: 'Energy', subIndustry: 'Oil & Gas Equipment & Services'}, - {symbol: 'NOW', name: 'ServiceNow', sector: 'Information Technology', subIndustry: 'Systems Software'}, - {symbol: 'NRG', name: 'NRG Energy', sector: 'Utilities', subIndustry: 'Independent Power Producers & Energy Traders'}, - {symbol: 'NSC', name: 'Norfolk Southern', sector: 'Industrials', subIndustry: 'Railroads'}, - {symbol: 'NTAP', name: 'NetApp', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'NTRS', name: 'Northern Trust', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'NUE', name: 'Nucor', sector: 'Materials', subIndustry: 'Steel'}, - {symbol: 'NVDA', name: 'Nvidia', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'NVR', name: 'NVR', sector: 'Consumer Discretionary', subIndustry: 'Homebuilding'}, - {symbol: 'NWL', name: 'Newell Brands', sector: 'Consumer Discretionary', subIndustry: 'Housewares & Specialties'}, - {symbol: 'NWS', name: 'News Corp (Class B)', sector: 'Communication Services', subIndustry: 'Publishing'}, - {symbol: 'NWSA', name: 'News Corp (Class A)', sector: 'Communication Services', subIndustry: 'Publishing'}, - {symbol: 'NXPI', name: 'NXP', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'O', name: 'Realty Income Corporation', sector: 'Real Estate', subIndustry: 'Retail REITs'}, - {symbol: 'ODFL', name: 'Old Dominion Freight Line', sector: 'Industrials', subIndustry: 'Trucking'}, - {symbol: 'OGN', name: 'Organon & Co.', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'OKE', name: 'Oneok', sector: 'Energy', subIndustry: 'Oil & Gas Storage & Transportation'}, - {symbol: 'OMC', name: 'Omnicom Group', sector: 'Communication Services', subIndustry: 'Advertising'}, - {symbol: 'ORCL', name: 'Oracle', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'ORLY', name: 'O\'Reilly Automotive', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'OTIS', name: 'Otis Worldwide', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'OXY', name: 'Occidental Petroleum', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'PAYC', name: 'Paycom', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'PAYX', name: 'Paychex', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'PBCT', name: 'People\'s United Financial', sector: 'Financials', subIndustry: 'Thrifts & Mortgage Finance'}, - {symbol: 'PCAR', name: 'Paccar', sector: 'Industrials', subIndustry: 'Construction Machinery & Heavy Trucks'}, - {symbol: 'PEAK', name: 'Healthpeak Properties', sector: 'Real Estate', subIndustry: 'Health Care REITs'}, - {symbol: 'PEG', name: 'Public Service Enterprise Group', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'PENN', name: 'Penn National Gaming', sector: 'Consumer Discretionary', subIndustry: 'Casinos & Gaming'}, - {symbol: 'PEP', name: 'PepsiCo', sector: 'Consumer Staples', subIndustry: 'Soft Drinks'}, - {symbol: 'PFE', name: 'Pfizer', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'PFG', name: 'Principal Financial Group', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'PG', name: 'Procter & Gamble', sector: 'Consumer Staples', subIndustry: 'Personal Products'}, - {symbol: 'PGR', name: 'Progressive Corporation', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'PH', name: 'Parker-Hannifin', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'PHM', name: 'PulteGroup', sector: 'Consumer Discretionary', subIndustry: 'Homebuilding'}, - {symbol: 'PKG', name: 'Packaging Corporation of America', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'PKI', name: 'PerkinElmer', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'PLD', name: 'Prologis', sector: 'Real Estate', subIndustry: 'Industrial REITs'}, - {symbol: 'PM', name: 'Philip Morris International', sector: 'Consumer Staples', subIndustry: 'Tobacco'}, - {symbol: 'PNC', name: 'PNC Financial Services', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'PNR', name: 'Pentair', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'PNW', name: 'Pinnacle West Capital', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'POOL', name: 'Pool Corporation', sector: 'Consumer Discretionary', subIndustry: 'Distributors'}, - {symbol: 'PPG', name: 'PPG Industries', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'PPL', name: 'PPL', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'PRGO', name: 'Perrigo', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'PRU', name: 'Prudential Financial', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'PSA', name: 'Public Storage', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'PSX', name: 'Phillips 66', sector: 'Energy', subIndustry: 'Oil & Gas Refining & Marketing'}, - {symbol: 'PTC', name: 'PTC', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'PVH', name: 'PVH', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'PWR', name: 'Quanta Services', sector: 'Industrials', subIndustry: 'Construction & Engineering'}, - {symbol: 'PXD', name: 'Pioneer Natural Resources', sector: 'Energy', subIndustry: 'Oil & Gas Exploration & Production'}, - {symbol: 'PYPL', name: 'PayPal', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'QCOM', name: 'Qualcomm', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'QRVO', name: 'Qorvo', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'RCL', name: 'Royal Caribbean Group', sector: 'Consumer Discretionary', subIndustry: 'Hotels, Resorts & Cruise Lines'}, - {symbol: 'RE', name: 'Everest Re', sector: 'Financials', subIndustry: 'Reinsurance'}, - {symbol: 'REG', name: 'Regency Centers', sector: 'Real Estate', subIndustry: 'Retail REITs'}, - {symbol: 'REGN', name: 'Regeneron Pharmaceuticals', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'RF', name: 'Regions Financial Corporation', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'RHI', name: 'Robert Half International', sector: 'Industrials', subIndustry: 'Human Resource & Employment Services'}, - {symbol: 'RJF', name: 'Raymond James Financial', sector: 'Financials', subIndustry: 'Investment Banking & Brokerage'}, - {symbol: 'RL', name: 'Ralph Lauren Corporation', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'RMD', name: 'ResMed', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'ROK', name: 'Rockwell Automation', sector: 'Industrials', subIndustry: 'Electrical Components & Equipment'}, - {symbol: 'ROL', name: 'Rollins', sector: 'Industrials', subIndustry: 'Environmental & Facilities Services'}, - {symbol: 'ROP', name: 'Roper Technologies', sector: 'Industrials', subIndustry: 'Industrial Conglomerates'}, - {symbol: 'ROST', name: 'Ross Stores', sector: 'Consumer Discretionary', subIndustry: 'Apparel Retail'}, - {symbol: 'RSG', name: 'Republic Services', sector: 'Industrials', subIndustry: 'Environmental & Facilities Services'}, - {symbol: 'RTX', name: 'Raytheon Technologies', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'SBAC', name: 'SBA Communications', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'SBUX', name: 'Starbucks', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'SCHW', name: 'Charles Schwab Corporation', sector: 'Financials', subIndustry: 'Investment Banking & Brokerage'}, - {symbol: 'SEE', name: 'Sealed Air', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'SHW', name: 'Sherwin-Williams', sector: 'Materials', subIndustry: 'Specialty Chemicals'}, - {symbol: 'SIVB', name: 'SVB Financial', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'SJM', name: 'JM Smucker', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'SLB', name: 'Schlumberger', sector: 'Energy', subIndustry: 'Oil & Gas Equipment & Services'}, - {symbol: 'SNA', name: 'Snap-on', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'SNPS', name: 'Synopsys', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'SO', name: 'Southern Company', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'SPG', name: 'Simon Property Group', sector: 'Real Estate', subIndustry: 'Retail REITs'}, - {symbol: 'SPGI', name: 'S&P Global', sector: 'Financials', subIndustry: 'Financial Exchanges & Data'}, - {symbol: 'SRE', name: 'Sempra Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'STE', name: 'Steris', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'STT', name: 'State Street Corporation', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'STX', name: 'Seagate Technology', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'STZ', name: 'Constellation Brands', sector: 'Consumer Staples', subIndustry: 'Distillers & Vintners'}, - {symbol: 'SWK', name: 'Stanley Black & Decker', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'SWKS', name: 'Skyworks Solutions', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'SYF', name: 'Synchrony Financial', sector: 'Financials', subIndustry: 'Consumer Finance'}, - {symbol: 'SYK', name: 'Stryker Corporation', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'SYY', name: 'Sysco', sector: 'Consumer Staples', subIndustry: 'Food Distributors'}, - {symbol: 'T', name: 'AT&T', sector: 'Communication Services', subIndustry: 'Integrated Telecommunication Services'}, - {symbol: 'TAP', name: 'Molson Coors Beverage Company', sector: 'Consumer Staples', subIndustry: 'Brewers'}, - {symbol: 'TDG', name: 'TransDigm Group', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'TDY', name: 'Teledyne Technologies', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'TEL', name: 'TE Connectivity', sector: 'Information Technology', subIndustry: 'Electronic Manufacturing Services'}, - {symbol: 'TER', name: 'Teradyne', sector: 'Information Technology', subIndustry: 'Semiconductor Equipment'}, - {symbol: 'TFC', name: 'Truist Financial', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'TFX', name: 'Teleflex', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'TGT', name: 'Target Corporation', sector: 'Consumer Discretionary', subIndustry: 'General Merchandise Stores'}, - {symbol: 'TJX', name: 'TJX Companies', sector: 'Consumer Discretionary', subIndustry: 'Apparel Retail'}, - {symbol: 'TMO', name: 'Thermo Fisher Scientific', sector: 'Health Care', subIndustry: 'Life Sciences Tools & Services'}, - {symbol: 'TMUS', name: 'T-Mobile US', sector: 'Communication Services', subIndustry: 'Wireless Telecommunication Services'}, - {symbol: 'TPR', name: 'Tapestry', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'TRMB', name: 'Trimble', sector: 'Information Technology', subIndustry: 'Electronic Equipment & Instruments'}, - {symbol: 'TROW', name: 'T. Rowe Price', sector: 'Financials', subIndustry: 'Asset Management & Custody Banks'}, - {symbol: 'TRV', name: 'The Travelers Companies', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'TSCO', name: 'Tractor Supply Company', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'TSLA', name: 'Tesla', sector: 'Consumer Discretionary', subIndustry: 'Automobile Manufacturers'}, - {symbol: 'TSN', name: 'Tyson Foods', sector: 'Consumer Staples', subIndustry: 'Packaged Foods & Meats'}, - {symbol: 'TT', name: 'Trane Technologies', sector: 'Industrials', subIndustry: 'Building Products'}, - {symbol: 'TTWO', name: 'Take-Two Interactive', sector: 'Communication Services', subIndustry: 'Interactive Home Entertainment'}, - {symbol: 'TWTR', name: 'Twitter', sector: 'Communication Services', subIndustry: 'Interactive Media & Services'}, - {symbol: 'TXN', name: 'Texas Instruments', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'TXT', name: 'Textron', sector: 'Industrials', subIndustry: 'Aerospace & Defense'}, - {symbol: 'TYL', name: 'Tyler Technologies', sector: 'Information Technology', subIndustry: 'Application Software'}, - {symbol: 'UA', name: 'Under Armour (Class C)', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'UAA', name: 'Under Armour (Class A)', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'UAL', name: 'United Airlines', sector: 'Industrials', subIndustry: 'Airlines'}, - {symbol: 'UDR', name: 'UDR', sector: 'Real Estate', subIndustry: 'Residential REITs'}, - {symbol: 'UHS', name: 'Universal Health Services', sector: 'Health Care', subIndustry: 'Health Care Facilities'}, - {symbol: 'ULTA', name: 'Ulta Beauty', sector: 'Consumer Discretionary', subIndustry: 'Specialty Stores'}, - {symbol: 'UNH', name: 'UnitedHealth Group', sector: 'Health Care', subIndustry: 'Managed Health Care'}, - {symbol: 'UNM', name: 'Unum Group', sector: 'Financials', subIndustry: 'Life & Health Insurance'}, - {symbol: 'UNP', name: 'Union Pacific', sector: 'Industrials', subIndustry: 'Railroads'}, - {symbol: 'UPS', name: 'United Parcel Service', sector: 'Industrials', subIndustry: 'Air Freight & Logistics'}, - {symbol: 'URI', name: 'United Rentals', sector: 'Industrials', subIndustry: 'Trading Companies & Distributors'}, - {symbol: 'USB', name: 'U.S. Bancorp', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'V', name: 'Visa', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'VFC', name: 'VF Corporation', sector: 'Consumer Discretionary', subIndustry: 'Apparel, Accessories & Luxury Goods'}, - {symbol: 'VIAC', name: 'ViacomCBS', sector: 'Communication Services', subIndustry: 'Movies & Entertainment'}, - {symbol: 'VLO', name: 'Valero Energy', sector: 'Energy', subIndustry: 'Oil & Gas Refining & Marketing'}, - {symbol: 'VMC', name: 'Vulcan Materials', sector: 'Materials', subIndustry: 'Construction Materials'}, - {symbol: 'VNO', name: 'Vornado Realty Trust', sector: 'Real Estate', subIndustry: 'Office REITs'}, - {symbol: 'VRSK', name: 'Verisk Analytics', sector: 'Industrials', subIndustry: 'Research & Consulting Services'}, - {symbol: 'VRSN', name: 'Verisign', sector: 'Information Technology', subIndustry: 'Internet Services & Infrastructure'}, - {symbol: 'VRTX', name: 'Vertex Pharmaceuticals', sector: 'Health Care', subIndustry: 'Biotechnology'}, - {symbol: 'VTR', name: 'Ventas', sector: 'Real Estate', subIndustry: 'Health Care REITs'}, - {symbol: 'VTRS', name: 'Viatris', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, - {symbol: 'VZ', name: 'Verizon Communications', sector: 'Communication Services', subIndustry: 'Integrated Telecommunication Services'}, - {symbol: 'WAB', name: 'Wabtec', sector: 'Industrials', subIndustry: 'Construction Machinery & Heavy Trucks'}, - {symbol: 'WAT', name: 'Waters Corporation', sector: 'Health Care', subIndustry: 'Health Care Distributors'}, - {symbol: 'WBA', name: 'Walgreens Boots Alliance', sector: 'Consumer Staples', subIndustry: 'Drug Retail'}, - {symbol: 'WDC', name: 'Western Digital', sector: 'Information Technology', subIndustry: 'Technology Hardware, Storage & Peripherals'}, - {symbol: 'WEC', name: 'WEC Energy Group', sector: 'Utilities', subIndustry: 'Electric Utilities'}, - {symbol: 'WELL', name: 'Welltower', sector: 'Real Estate', subIndustry: 'Health Care REITs'}, - {symbol: 'WFC', name: 'Wells Fargo', sector: 'Financials', subIndustry: 'Diversified Banks'}, - {symbol: 'WHR', name: 'Whirlpool Corporation', sector: 'Consumer Discretionary', subIndustry: 'Household Appliances'}, - {symbol: 'WLTW', name: 'Willis Towers Watson', sector: 'Financials', subIndustry: 'Insurance Brokers'}, - {symbol: 'WM', name: 'Waste Management', sector: 'Industrials', subIndustry: 'Environmental & Facilities Services'}, - {symbol: 'WMB', name: 'Williams Companies', sector: 'Energy', subIndustry: 'Oil & Gas Storage & Transportation'}, - {symbol: 'WMT', name: 'Walmart', sector: 'Consumer Staples', subIndustry: 'Hypermarkets & Super Centers'}, - {symbol: 'WRB', name: 'W. R. Berkley Corporation', sector: 'Financials', subIndustry: 'Property & Casualty Insurance'}, - {symbol: 'WRK', name: 'WestRock', sector: 'Materials', subIndustry: 'Paper Packaging'}, - {symbol: 'WST', name: 'West Pharmaceutical Services', sector: 'Health Care', subIndustry: 'Health Care Supplies'}, - {symbol: 'WU', name: 'Western Union', sector: 'Information Technology', subIndustry: 'Data Processing & Outsourced Services'}, - {symbol: 'WY', name: 'Weyerhaeuser', sector: 'Real Estate', subIndustry: 'Specialized REITs'}, - {symbol: 'WYNN', name: 'Wynn Resorts', sector: 'Consumer Discretionary', subIndustry: 'Casinos & Gaming'}, - {symbol: 'XEL', name: 'Xcel Energy', sector: 'Utilities', subIndustry: 'Multi-Utilities'}, - {symbol: 'XLNX', name: 'Xilinx', sector: 'Information Technology', subIndustry: 'Semiconductors'}, - {symbol: 'XOM', name: 'ExxonMobil', sector: 'Energy', subIndustry: 'Integrated Oil & Gas'}, - {symbol: 'XRAY', name: 'Dentsply Sirona', sector: 'Health Care', subIndustry: 'Health Care Supplies'}, - {symbol: 'XYL', name: 'Xylem', sector: 'Industrials', subIndustry: 'Industrial Machinery'}, - {symbol: 'YUM', name: 'Yum! Brands', sector: 'Consumer Discretionary', subIndustry: 'Restaurants'}, - {symbol: 'ZBH', name: 'Zimmer Biomet', sector: 'Health Care', subIndustry: 'Health Care Equipment'}, - {symbol: 'ZBRA', name: 'Zebra Technologies', sector: 'Information Technology', subIndustry: 'Electronic Equipment & Instruments'}, - {symbol: 'ZION', name: 'Zions Bancorp', sector: 'Financials', subIndustry: 'Regional Banks'}, - {symbol: 'ZTS', name: 'Zoetis', sector: 'Health Care', subIndustry: 'Pharmaceuticals'}, + { + symbol: 'SPY', + name: 'S&P 500 Composite Index', + sector: 'Composite Index', + subIndustry: 'Composite Index', + }, + { + symbol: 'A', + name: 'Agilent Technologies', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'AAL', + name: 'American Airlines Group', + sector: 'Industrials', + subIndustry: 'Airlines', + }, + { + symbol: 'AAP', + name: 'Advance Auto Parts', + sector: 'Consumer Discretionary', + subIndustry: 'Automotive Retail', + }, + { + symbol: 'AAPL', + name: 'Apple', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'ABBV', + name: 'AbbVie', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'ABC', + name: 'AmerisourceBergen', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'ABMD', + name: 'Abiomed', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'ABT', + name: 'Abbott Laboratories', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'ACN', + name: 'Accenture', + sector: 'Information Technology', + subIndustry: 'IT Consulting & Other Services', + }, + { + symbol: 'ADBE', + name: 'Adobe', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'ADI', + name: 'Analog Devices', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'ADM', + name: 'ADM', + sector: 'Consumer Staples', + subIndustry: 'Agricultural Products', + }, + { + symbol: 'ADP', + name: 'Automatic Data Processing', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'ADSK', + name: 'Autodesk', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'AEE', + name: 'Ameren Corp', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'AEP', + name: 'American Electric Power', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'AES', + name: 'AES Corp', + sector: 'Utilities', + subIndustry: 'Independent Power Producers & Energy Traders', + }, + { + symbol: 'AFL', + name: 'Aflac', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'AIG', + name: 'American International Group', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'AIZ', + name: 'Assurant', + sector: 'Financials', + subIndustry: 'Multi-line Insurance', + }, + { + symbol: 'AJG', + name: 'Arthur J. Gallagher & Co.', + sector: 'Financials', + subIndustry: 'Insurance Brokers', + }, + { + symbol: 'AKAM', + name: 'Akamai Technologies', + sector: 'Information Technology', + subIndustry: 'Internet Services & Infrastructure', + }, + { + symbol: 'ALB', + name: 'Albemarle Corporation', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'ALGN', + name: 'Align Technology', + sector: 'Health Care', + subIndustry: 'Health Care Supplies', + }, + { + symbol: 'ALK', + name: 'Alaska Air Group', + sector: 'Industrials', + subIndustry: 'Airlines', + }, + { + symbol: 'ALL', + name: 'Allstate Corp', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'ALLE', + name: 'Allegion', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'AMAT', + name: 'Applied Materials', + sector: 'Information Technology', + subIndustry: 'Semiconductor Equipment', + }, + { + symbol: 'AMCR', + name: 'Amcor', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'AMD', + name: 'Advanced Micro Devices', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'AME', + name: 'Ametek', + sector: 'Industrials', + subIndustry: 'Electrical Components & Equipment', + }, + { + symbol: 'AMGN', + name: 'Amgen', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'AMP', + name: 'Ameriprise Financial', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'AMT', + name: 'American Tower', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'AMZN', + name: 'Amazon', + sector: 'Consumer Discretionary', + subIndustry: 'Internet & Direct Marketing Retail', + }, + { + symbol: 'ANET', + name: 'Arista Networks', + sector: 'Information Technology', + subIndustry: 'Communications Equipment', + }, + { + symbol: 'ANSS', + name: 'Ansys', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'ANTM', + name: 'Anthem', + sector: 'Health Care', + subIndustry: 'Managed Health Care', + }, + { + symbol: 'AON', + name: 'Aon', + sector: 'Financials', + subIndustry: 'Insurance Brokers', + }, + { + symbol: 'AOS', + name: 'A. O. Smith', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'APA', + name: 'APA Corporation', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'APD', + name: 'Air Products & Chemicals', + sector: 'Materials', + subIndustry: 'Industrial Gases', + }, + { + symbol: 'APH', + name: 'Amphenol Corp', + sector: 'Information Technology', + subIndustry: 'Electronic Components', + }, + { + symbol: 'APTV', + name: 'Aptiv', + sector: 'Consumer Discretionary', + subIndustry: 'Auto Parts & Equipment', + }, + { + symbol: 'ARE', + name: 'Alexandria Real Estate Equities', + sector: 'Real Estate', + subIndustry: 'Office REITs', + }, + { + symbol: 'ATO', + name: 'Atmos Energy', + sector: 'Utilities', + subIndustry: 'Gas Utilities', + }, + { + symbol: 'ATVI', + name: 'Activision Blizzard', + sector: 'Communication Services', + subIndustry: 'Interactive Home Entertainment', + }, + { + symbol: 'AVB', + name: 'AvalonBay Communities', + sector: 'Real Estate', + subIndustry: 'Residential REITs', + }, + { + symbol: 'AVGO', + name: 'Broadcom', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'AVY', + name: 'Avery Dennison', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'AWK', + name: 'American Water Works', + sector: 'Utilities', + subIndustry: 'Water Utilities', + }, + { + symbol: 'AXP', + name: 'American Express', + sector: 'Financials', + subIndustry: 'Consumer Finance', + }, + { + symbol: 'AZO', + name: 'AutoZone', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'BA', + name: 'Boeing Company', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'BAC', + name: 'Bank of America', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'BAX', + name: 'Baxter International', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'BBWI', + name: 'Bath & Body Works, Inc.', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'BBY', + name: 'Best Buy', + sector: 'Consumer Discretionary', + subIndustry: 'Computer & Electronics Retail', + }, + { + symbol: 'BDX', + name: 'Becton Dickinson', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'BEN', + name: 'Franklin Resources', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'BF.B', + name: 'Brown–Forman', + sector: 'Consumer Staples', + subIndustry: 'Distillers & Vintners', + }, + { + symbol: 'BIIB', + name: 'Biogen', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'BIO', + name: 'Bio-Rad Laboratories', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'BK', + name: 'BNY Mellon', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'BKNG', + name: 'Booking Holdings', + sector: 'Consumer Discretionary', + subIndustry: 'Internet & Direct Marketing Retail', + }, + { + symbol: 'BKR', + name: 'Baker Hughes', + sector: 'Energy', + subIndustry: 'Oil & Gas Equipment & Services', + }, + { + symbol: 'BLK', + name: 'BlackRock', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'BLL', + name: 'Ball Corp', + sector: 'Materials', + subIndustry: 'Metal & Glass Containers', + }, + { + symbol: 'BMY', + name: 'Bristol-Myers Squibb', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'BR', + name: 'Broadridge Financial Solutions', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'BRK.B', + name: 'Berkshire Hathaway', + sector: 'Financials', + subIndustry: 'Multi-Sector Holdings', + }, + { + symbol: 'BSX', + name: 'Boston Scientific', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'BWA', + name: 'BorgWarner', + sector: 'Consumer Discretionary', + subIndustry: 'Auto Parts & Equipment', + }, + { + symbol: 'BXP', + name: 'Boston Properties', + sector: 'Real Estate', + subIndustry: 'Office REITs', + }, + { + symbol: 'C', + name: 'Citigroup', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'CAG', + name: 'Conagra Brands', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'CAH', + name: 'Cardinal Health', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'CARR', + name: 'Carrier Global', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'CAT', + name: 'Caterpillar', + sector: 'Industrials', + subIndustry: 'Construction Machinery & Heavy Trucks', + }, + { + symbol: 'CB', + name: 'Chubb', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'CBOE', + name: 'Cboe Global Markets', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'CBRE', + name: 'CBRE', + sector: 'Real Estate', + subIndustry: 'Real Estate Services', + }, + { + symbol: 'CCI', + name: 'Crown Castle', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'CCL', + name: 'Carnival Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Hotels, Resorts & Cruise Lines', + }, + { + symbol: 'CDNS', + name: 'Cadence Design Systems', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'CDW', + name: 'CDW', + sector: 'Information Technology', + subIndustry: 'Technology Distributors', + }, + { + symbol: 'CE', + name: 'Celanese', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'CERN', + name: 'Cerner', + sector: 'Health Care', + subIndustry: 'Health Care Technology', + }, + { + symbol: 'CF', + name: 'CF Industries', + sector: 'Materials', + subIndustry: 'Fertilizers & Agricultural Chemicals', + }, + { + symbol: 'CFG', + name: 'Citizens Financial Group', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'CHD', + name: 'Church & Dwight', + sector: 'Consumer Staples', + subIndustry: 'Household Products', + }, + { + symbol: 'CHRW', + name: 'C. H. Robinson', + sector: 'Industrials', + subIndustry: 'Air Freight & Logistics', + }, + { + symbol: 'CHTR', + name: 'Charter Communications', + sector: 'Communication Services', + subIndustry: 'Cable & Satellite', + }, + { + symbol: 'CI', + name: 'Cigna', + sector: 'Health Care', + subIndustry: 'Managed Health Care', + }, + { + symbol: 'CINF', + name: 'Cincinnati Financial', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'CL', + name: 'Colgate-Palmolive', + sector: 'Consumer Staples', + subIndustry: 'Household Products', + }, + { + symbol: 'CLX', + name: 'Clorox', + sector: 'Consumer Staples', + subIndustry: 'Household Products', + }, + { + symbol: 'CMA', + name: 'Comerica', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'CMCSA', + name: 'Comcast', + sector: 'Communication Services', + subIndustry: 'Cable & Satellite', + }, + { + symbol: 'CME', + name: 'CME Group', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'CMG', + name: 'Chipotle Mexican Grill', + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'CMI', + name: 'Cummins', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'CMS', + name: 'CMS Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'CNC', + name: 'Centene Corporation', + sector: 'Health Care', + subIndustry: 'Managed Health Care', + }, + { + symbol: 'CNP', + name: 'CenterPoint Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'COF', + name: 'Capital One Financial', + sector: 'Financials', + subIndustry: 'Consumer Finance', + }, + { + symbol: 'COG', + name: 'Cabot Oil & Gas', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'COO', + name: 'The Cooper Companies', + sector: 'Health Care', + subIndustry: 'Health Care Supplies', + }, + { + symbol: 'COP', + name: 'ConocoPhillips', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'COST', + name: 'Costco', + sector: 'Consumer Staples', + subIndustry: 'Hypermarkets & Super Centers', + }, + { + symbol: 'CPB', + name: 'Campbell Soup', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'CPRT', + name: 'Copart', + sector: 'Industrials', + subIndustry: 'Diversified Support Services', + }, + { + symbol: 'CRL', + name: 'Charles River Laboratories', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'CRM', + name: 'Salesforce', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'CSCO', + name: 'Cisco Systems', + sector: 'Information Technology', + subIndustry: 'Communications Equipment', + }, + { + symbol: 'CSX', + name: 'CSX', + sector: 'Industrials', + subIndustry: 'Railroads', + }, + { + symbol: 'CTAS', + name: 'Cintas Corporation', + sector: 'Industrials', + subIndustry: 'Diversified Support Services', + }, + { + symbol: 'CTLT', + name: 'Catalent', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'CTSH', + name: 'Cognizant Technology Solutions', + sector: 'Information Technology', + subIndustry: 'IT Consulting & Other Services', + }, + { + symbol: 'CTVA', + name: 'Corteva', + sector: 'Materials', + subIndustry: 'Fertilizers & Agricultural Chemicals', + }, + { + symbol: 'CTXS', + name: 'Citrix Systems', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'CVS', + name: 'CVS Health', + sector: 'Health Care', + subIndustry: 'Health Care Services', + }, + { + symbol: 'CVX', + name: 'Chevron Corporation', + sector: 'Energy', + subIndustry: 'Integrated Oil & Gas', + }, + { + symbol: 'CZR', + name: 'Caesars Entertainment', + sector: 'Consumer Discretionary', + subIndustry: 'Casinos & Gaming', + }, + { + symbol: 'D', + name: 'Dominion Energy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'DAL', + name: 'Delta Air Lines', + sector: 'Industrials', + subIndustry: 'Airlines', + }, + { + symbol: 'DD', + name: 'DuPont', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'DE', + name: 'Deere & Co.', + sector: 'Industrials', + subIndustry: 'Agricultural & Farm Machinery', + }, + { + symbol: 'DFS', + name: 'Discover Financial Services', + sector: 'Financials', + subIndustry: 'Consumer Finance', + }, + { + symbol: 'DG', + name: 'Dollar General', + sector: 'Consumer Discretionary', + subIndustry: 'General Merchandise Stores', + }, + { + symbol: 'DGX', + name: 'Quest Diagnostics', + sector: 'Health Care', + subIndustry: 'Health Care Services', + }, + { + symbol: 'DHI', + name: 'D. R. Horton', + sector: 'Consumer Discretionary', + subIndustry: 'Homebuilding', + }, + { + symbol: 'DHR', + name: 'Danaher Corporation', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'DIS', + name: 'The Walt Disney Company', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'DISCA', + name: 'Discovery (Series A)', + sector: 'Communication Services', + subIndustry: 'Broadcasting', + }, + { + symbol: 'DISCK', + name: 'Discovery (Series C)', + sector: 'Communication Services', + subIndustry: 'Broadcasting', + }, + { + symbol: 'DISH', + name: 'Dish Network', + sector: 'Communication Services', + subIndustry: 'Cable & Satellite', + }, + { + symbol: 'DLR', + name: 'Digital Realty Trust', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'DLTR', + name: 'Dollar Tree', + sector: 'Consumer Discretionary', + subIndustry: 'General Merchandise Stores', + }, + { + symbol: 'DOV', + name: 'Dover Corporation', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'DOW', + name: 'Dow', + sector: 'Materials', + subIndustry: 'Commodity Chemicals', + }, + { + symbol: 'DPZ', + name: "Domino's Pizza", + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'DRE', + name: 'Duke Realty Corp', + sector: 'Real Estate', + subIndustry: 'Industrial REITs', + }, + { + symbol: 'DRI', + name: 'Darden Restaurants', + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'DTE', + name: 'DTE Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'DUK', + name: 'Duke Energy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'DVA', + name: 'DaVita', + sector: 'Health Care', + subIndustry: 'Health Care Facilities', + }, + { + symbol: 'DVN', + name: 'Devon Energy', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'DXC', + name: 'DXC Technology', + sector: 'Information Technology', + subIndustry: 'IT Consulting & Other Services', + }, + { + symbol: 'DXCM', + name: 'DexCom', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'EA', + name: 'Electronic Arts', + sector: 'Communication Services', + subIndustry: 'Interactive Home Entertainment', + }, + { + symbol: 'EBAY', + name: 'eBay', + sector: 'Consumer Discretionary', + subIndustry: 'Internet & Direct Marketing Retail', + }, + { + symbol: 'ECL', + name: 'Ecolab', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'ED', + name: 'Consolidated Edison', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'EFX', + name: 'Equifax', + sector: 'Industrials', + subIndustry: 'Research & Consulting Services', + }, + { + symbol: 'EIX', + name: 'Edison International', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'EL', + name: 'Estée Lauder Companies', + sector: 'Consumer Staples', + subIndustry: 'Personal Products', + }, + { + symbol: 'EMN', + name: 'Eastman Chemical', + sector: 'Materials', + subIndustry: 'Diversified Chemicals', + }, + { + symbol: 'EMR', + name: 'Emerson Electric Company', + sector: 'Industrials', + subIndustry: 'Electrical Components & Equipment', + }, + { + symbol: 'ENPH', + name: 'Enphase Energy', + sector: 'Information Technology', + subIndustry: 'Electronic Components', + }, + { + symbol: 'EOG', + name: 'EOG Resources', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'EQIX', + name: 'Equinix', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'EQR', + name: 'Equity Residential', + sector: 'Real Estate', + subIndustry: 'Residential REITs', + }, + { + symbol: 'ES', + name: 'Eversource Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'ESS', + name: 'Essex Property Trust', + sector: 'Real Estate', + subIndustry: 'Residential REITs', + }, + { + symbol: 'ETN', + name: 'Eaton Corporation', + sector: 'Industrials', + subIndustry: 'Electrical Components & Equipment', + }, + { + symbol: 'ETR', + name: 'Entergy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'ETSY', + name: 'Etsy', + sector: 'Consumer Discretionary', + subIndustry: 'Internet & Direct Marketing Retail', + }, + { + symbol: 'EVRG', + name: 'Evergy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'EW', + name: 'Edwards Lifesciences', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'EXC', + name: 'Exelon', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'EXPD', + name: 'Expeditors', + sector: 'Industrials', + subIndustry: 'Air Freight & Logistics', + }, + { + symbol: 'EXPE', + name: 'Expedia Group', + sector: 'Consumer Discretionary', + subIndustry: 'Internet & Direct Marketing Retail', + }, + { + symbol: 'EXR', + name: 'Extra Space Storage', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'F', + name: 'Ford', + sector: 'Consumer Discretionary', + subIndustry: 'Automobile Manufacturers', + }, + { + symbol: 'FANG', + name: 'Diamondback Energy', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'FAST', + name: 'Fastenal', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'FB', + name: 'Facebook', + sector: 'Communication Services', + subIndustry: 'Interactive Media & Services', + }, + { + symbol: 'FBHS', + name: 'Fortune Brands Home & Security', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'FCX', + name: 'Freeport-McMoRan', + sector: 'Materials', + subIndustry: 'Copper', + }, + { + symbol: 'FDX', + name: 'FedEx', + sector: 'Industrials', + subIndustry: 'Air Freight & Logistics', + }, + { + symbol: 'FE', + name: 'FirstEnergy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'FFIV', + name: 'F5 Networks', + sector: 'Information Technology', + subIndustry: 'Communications Equipment', + }, + { + symbol: 'FIS', + name: 'Fidelity National Information Services', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'FISV', + name: 'Fiserv', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'FITB', + name: 'Fifth Third Bancorp', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'FLT', + name: 'Fleetcor', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'FMC', + name: 'FMC Corporation', + sector: 'Materials', + subIndustry: 'Fertilizers & Agricultural Chemicals', + }, + { + symbol: 'FOX', + name: 'Fox Corporation (Class B)', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'FOXA', + name: 'Fox Corporation (Class A)', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'FRC', + name: 'First Republic Bank', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'FRT', + name: 'Federal Realty Investment Trust', + sector: 'Real Estate', + subIndustry: 'Retail REITs', + }, + { + symbol: 'FTNT', + name: 'Fortinet', + sector: 'Information Technology', + subIndustry: 'Systems Software', + }, + { + symbol: 'FTV', + name: 'Fortive', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'GD', + name: 'General Dynamics', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'GE', + name: 'General Electric', + sector: 'Industrials', + subIndustry: 'Industrial Conglomerates', + }, + { + symbol: 'GILD', + name: 'Gilead Sciences', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'GIS', + name: 'General Mills', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'GL', + name: 'Globe Life', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'GLW', + name: 'Corning', + sector: 'Information Technology', + subIndustry: 'Electronic Components', + }, + { + symbol: 'GM', + name: 'General Motors', + sector: 'Consumer Discretionary', + subIndustry: 'Automobile Manufacturers', + }, + { + symbol: 'GNRC', + name: 'Generac Holdings', + sector: 'Industrials', + subIndustry: 'Electrical Components & Equipment', + }, + { + symbol: 'GOOG', + name: 'Alphabet (Class C)', + sector: 'Communication Services', + subIndustry: 'Interactive Media & Services', + }, + { + symbol: 'GOOGL', + name: 'Alphabet (Class A)', + sector: 'Communication Services', + subIndustry: 'Interactive Media & Services', + }, + { + symbol: 'GPC', + name: 'Genuine Parts', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'GPN', + name: 'Global Payments', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'GPS', + name: 'Gap', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel Retail', + }, + { + symbol: 'GRMN', + name: 'Garmin', + sector: 'Consumer Discretionary', + subIndustry: 'Consumer Electronics', + }, + { + symbol: 'GS', + name: 'Goldman Sachs', + sector: 'Financials', + subIndustry: 'Investment Banking & Brokerage', + }, + { + symbol: 'GWW', + name: 'W. W. Grainger', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'HAL', + name: 'Halliburton', + sector: 'Energy', + subIndustry: 'Oil & Gas Equipment & Services', + }, + { + symbol: 'HAS', + name: 'Hasbro', + sector: 'Consumer Discretionary', + subIndustry: 'Leisure Products', + }, + { + symbol: 'HBAN', + name: 'Huntington Bancshares', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'HBI', + name: 'Hanesbrands', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'HCA', + name: 'HCA Healthcare', + sector: 'Health Care', + subIndustry: 'Health Care Facilities', + }, + { + symbol: 'HD', + name: 'Home Depot', + sector: 'Consumer Discretionary', + subIndustry: 'Home Improvement Retail', + }, + { + symbol: 'HES', + name: 'Hess Corporation', + sector: 'Energy', + subIndustry: 'Integrated Oil & Gas', + }, + { + symbol: 'HIG', + name: 'The Hartford', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'HII', + name: 'Huntington Ingalls Industries', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'HLT', + name: 'Hilton Worldwide', + sector: 'Consumer Discretionary', + subIndustry: 'Hotels, Resorts & Cruise Lines', + }, + { + symbol: 'HOLX', + name: 'Hologic', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'HON', + name: 'Honeywell', + sector: 'Industrials', + subIndustry: 'Industrial Conglomerates', + }, + { + symbol: 'HPE', + name: 'Hewlett Packard Enterprise', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'HPQ', + name: 'HP', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'HRL', + name: 'Hormel', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'HSIC', + name: 'Henry Schein', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'HST', + name: 'Host Hotels & Resorts', + sector: 'Real Estate', + subIndustry: 'Hotel & Resort REITs', + }, + { + symbol: 'HSY', + name: 'The Hershey Company', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'HUM', + name: 'Humana', + sector: 'Health Care', + subIndustry: 'Managed Health Care', + }, + { + symbol: 'HWM', + name: 'Howmet Aerospace', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'IBM', + name: 'IBM', + sector: 'Information Technology', + subIndustry: 'IT Consulting & Other Services', + }, + { + symbol: 'ICE', + name: 'Intercontinental Exchange', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'IDXX', + name: 'Idexx Laboratories', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'IEX', + name: 'IDEX Corporation', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'IFF', + name: 'International Flavors & Fragrances', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'ILMN', + name: 'Illumina', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'INCY', + name: 'Incyte', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'INFO', + name: 'IHS Markit', + sector: 'Industrials', + subIndustry: 'Research & Consulting Services', + }, + { + symbol: 'INTC', + name: 'Intel', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'INTU', + name: 'Intuit', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'IP', + name: 'International Paper', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'IPG', + name: 'Interpublic Group', + sector: 'Communication Services', + subIndustry: 'Advertising', + }, + { + symbol: 'IPGP', + name: 'IPG Photonics', + sector: 'Information Technology', + subIndustry: 'Electronic Manufacturing Services', + }, + { + symbol: 'IQV', + name: 'IQVIA', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'IR', + name: 'Ingersoll Rand', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'IRM', + name: 'Iron Mountain', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'ISRG', + name: 'Intuitive Surgical', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'IT', + name: 'Gartner', + sector: 'Information Technology', + subIndustry: 'IT Consulting & Other Services', + }, + { + symbol: 'ITW', + name: 'Illinois Tool Works', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'IVZ', + name: 'Invesco', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'J', + name: 'Jacobs Engineering Group', + sector: 'Industrials', + subIndustry: 'Construction & Engineering', + }, + { + symbol: 'JBHT', + name: 'J. B. Hunt', + sector: 'Industrials', + subIndustry: 'Trucking', + }, + { + symbol: 'JCI', + name: 'Johnson Controls', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'JKHY', + name: 'Jack Henry & Associates', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'JNJ', + name: 'Johnson & Johnson', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'JNPR', + name: 'Juniper Networks', + sector: 'Information Technology', + subIndustry: 'Communications Equipment', + }, + { + symbol: 'JPM', + name: 'JPMorgan Chase', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'K', + name: "Kellogg's", + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'KEY', + name: 'KeyCorp', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'KEYS', + name: 'Keysight Technologies', + sector: 'Information Technology', + subIndustry: 'Electronic Equipment & Instruments', + }, + { + symbol: 'KHC', + name: 'Kraft Heinz', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'KIM', + name: 'Kimco Realty', + sector: 'Real Estate', + subIndustry: 'Retail REITs', + }, + { + symbol: 'KLAC', + name: 'KLA Corporation', + sector: 'Information Technology', + subIndustry: 'Semiconductor Equipment', + }, + { + symbol: 'KMB', + name: 'Kimberly-Clark', + sector: 'Consumer Staples', + subIndustry: 'Household Products', + }, + { + symbol: 'KMI', + name: 'Kinder Morgan', + sector: 'Energy', + subIndustry: 'Oil & Gas Storage & Transportation', + }, + { + symbol: 'KMX', + name: 'CarMax', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'KO', + name: 'Coca-Cola Company', + sector: 'Consumer Staples', + subIndustry: 'Soft Drinks', + }, + { + symbol: 'KR', + name: 'Kroger', + sector: 'Consumer Staples', + subIndustry: 'Food Retail', + }, + { + symbol: 'KSU', + name: 'Kansas City Southern', + sector: 'Industrials', + subIndustry: 'Railroads', + }, + { + symbol: 'L', + name: 'Loews Corporation', + sector: 'Financials', + subIndustry: 'Multi-line Insurance', + }, + { + symbol: 'LDOS', + name: 'Leidos', + sector: 'Industrials', + subIndustry: 'Diversified Support Services', + }, + { + symbol: 'LEG', + name: 'Leggett & Platt', + sector: 'Consumer Discretionary', + subIndustry: 'Home Furnishings', + }, + { + symbol: 'LEN', + name: 'Lennar', + sector: 'Consumer Discretionary', + subIndustry: 'Homebuilding', + }, + { + symbol: 'LH', + name: 'LabCorp', + sector: 'Health Care', + subIndustry: 'Health Care Services', + }, + { + symbol: 'LHX', + name: 'L3Harris Technologies', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'LIN', + name: 'Linde', + sector: 'Materials', + subIndustry: 'Industrial Gases', + }, + { + symbol: 'LKQ', + name: 'LKQ Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Distributors', + }, + { + symbol: 'LLY', + name: 'Eli Lilly & Co', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'LMT', + name: 'Lockheed Martin', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'LNC', + name: 'Lincoln National', + sector: 'Financials', + subIndustry: 'Multi-line Insurance', + }, + { + symbol: 'LNT', + name: 'Alliant Energy', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'LOW', + name: "Lowe's", + sector: 'Consumer Discretionary', + subIndustry: 'Home Improvement Retail', + }, + { + symbol: 'LRCX', + name: 'Lam Research', + sector: 'Information Technology', + subIndustry: 'Semiconductor Equipment', + }, + { + symbol: 'LUMN', + name: 'Lumen Technologies', + sector: 'Communication Services', + subIndustry: 'Alternative Carriers', + }, + { + symbol: 'LUV', + name: 'Southwest Airlines', + sector: 'Industrials', + subIndustry: 'Airlines', + }, + { + symbol: 'LVS', + name: 'Las Vegas Sands', + sector: 'Consumer Discretionary', + subIndustry: 'Casinos & Gaming', + }, + { + symbol: 'LW', + name: 'Lamb Weston', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'LYB', + name: 'LyondellBasell', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'LYV', + name: 'Live Nation Entertainment', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'MA', + name: 'Mastercard', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'MAA', + name: 'Mid-America Apartments', + sector: 'Real Estate', + subIndustry: 'Residential REITs', + }, + { + symbol: 'MAR', + name: 'Marriott International', + sector: 'Consumer Discretionary', + subIndustry: 'Hotels, Resorts & Cruise Lines', + }, + { + symbol: 'MAS', + name: 'Masco', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'MCD', + name: "McDonald's", + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'MCHP', + name: 'Microchip Technology', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'MCK', + name: 'McKesson Corporation', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'MCO', + name: "Moody's Corporation", + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'MDLZ', + name: 'Mondelez International', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'MDT', + name: 'Medtronic', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'MET', + name: 'MetLife', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'MGM', + name: 'MGM Resorts International', + sector: 'Consumer Discretionary', + subIndustry: 'Casinos & Gaming', + }, + { + symbol: 'MHK', + name: 'Mohawk Industries', + sector: 'Consumer Discretionary', + subIndustry: 'Home Furnishings', + }, + { + symbol: 'MKC', + name: 'McCormick & Company', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'MKTX', + name: 'MarketAxess', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'MLM', + name: 'Martin Marietta Materials', + sector: 'Materials', + subIndustry: 'Construction Materials', + }, + { + symbol: 'MMC', + name: 'Marsh & McLennan', + sector: 'Financials', + subIndustry: 'Insurance Brokers', + }, + { + symbol: 'MMM', + name: '3M', + sector: 'Industrials', + subIndustry: 'Industrial Conglomerates', + }, + { + symbol: 'MNST', + name: 'Monster Beverage', + sector: 'Consumer Staples', + subIndustry: 'Soft Drinks', + }, + { + symbol: 'MO', + name: 'Altria Group', + sector: 'Consumer Staples', + subIndustry: 'Tobacco', + }, + { + symbol: 'MOS', + name: 'The Mosaic Company', + sector: 'Materials', + subIndustry: 'Fertilizers & Agricultural Chemicals', + }, + { + symbol: 'MPC', + name: 'Marathon Petroleum', + sector: 'Energy', + subIndustry: 'Oil & Gas Refining & Marketing', + }, + { + symbol: 'MPWR', + name: 'Monolithic Power Systems', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'MRK', + name: 'Merck & Co.', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'MRNA', + name: 'Moderna', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'MRO', + name: 'Marathon Oil', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'MS', + name: 'Morgan Stanley', + sector: 'Financials', + subIndustry: 'Investment Banking & Brokerage', + }, + { + symbol: 'MSCI', + name: 'MSCI', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'MSFT', + name: 'Microsoft', + sector: 'Information Technology', + subIndustry: 'Systems Software', + }, + { + symbol: 'MSI', + name: 'Motorola Solutions', + sector: 'Information Technology', + subIndustry: 'Communications Equipment', + }, + { + symbol: 'MTB', + name: 'M&T Bank', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'MTD', + name: 'Mettler Toledo', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'MU', + name: 'Micron Technology', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'MXIM', + name: 'Maxim Integrated', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'NCLH', + name: 'Norwegian Cruise Line Holdings', + sector: 'Consumer Discretionary', + subIndustry: 'Hotels, Resorts & Cruise Lines', + }, + { + symbol: 'NDAQ', + name: 'Nasdaq', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'NEE', + name: 'NextEra Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { symbol: 'NEM', name: 'Newmont', sector: 'Materials', subIndustry: 'Gold' }, + { + symbol: 'NFLX', + name: 'Netflix', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'NI', + name: 'NiSource', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'NKE', + name: 'Nike', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'NLOK', + name: 'NortonLifeLock', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'NLSN', + name: 'Nielsen Holdings', + sector: 'Industrials', + subIndustry: 'Research & Consulting Services', + }, + { + symbol: 'NOC', + name: 'Northrop Grumman', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'NOV', + name: 'Nov', + sector: 'Energy', + subIndustry: 'Oil & Gas Equipment & Services', + }, + { + symbol: 'NOW', + name: 'ServiceNow', + sector: 'Information Technology', + subIndustry: 'Systems Software', + }, + { + symbol: 'NRG', + name: 'NRG Energy', + sector: 'Utilities', + subIndustry: 'Independent Power Producers & Energy Traders', + }, + { + symbol: 'NSC', + name: 'Norfolk Southern', + sector: 'Industrials', + subIndustry: 'Railroads', + }, + { + symbol: 'NTAP', + name: 'NetApp', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'NTRS', + name: 'Northern Trust', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { symbol: 'NUE', name: 'Nucor', sector: 'Materials', subIndustry: 'Steel' }, + { + symbol: 'NVDA', + name: 'Nvidia', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'NVR', + name: 'NVR', + sector: 'Consumer Discretionary', + subIndustry: 'Homebuilding', + }, + { + symbol: 'NWL', + name: 'Newell Brands', + sector: 'Consumer Discretionary', + subIndustry: 'Housewares & Specialties', + }, + { + symbol: 'NWS', + name: 'News Corp (Class B)', + sector: 'Communication Services', + subIndustry: 'Publishing', + }, + { + symbol: 'NWSA', + name: 'News Corp (Class A)', + sector: 'Communication Services', + subIndustry: 'Publishing', + }, + { + symbol: 'NXPI', + name: 'NXP', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'O', + name: 'Realty Income Corporation', + sector: 'Real Estate', + subIndustry: 'Retail REITs', + }, + { + symbol: 'ODFL', + name: 'Old Dominion Freight Line', + sector: 'Industrials', + subIndustry: 'Trucking', + }, + { + symbol: 'OGN', + name: 'Organon & Co.', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'OKE', + name: 'Oneok', + sector: 'Energy', + subIndustry: 'Oil & Gas Storage & Transportation', + }, + { + symbol: 'OMC', + name: 'Omnicom Group', + sector: 'Communication Services', + subIndustry: 'Advertising', + }, + { + symbol: 'ORCL', + name: 'Oracle', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'ORLY', + name: "O'Reilly Automotive", + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'OTIS', + name: 'Otis Worldwide', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'OXY', + name: 'Occidental Petroleum', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'PAYC', + name: 'Paycom', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'PAYX', + name: 'Paychex', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'PBCT', + name: "People's United Financial", + sector: 'Financials', + subIndustry: 'Thrifts & Mortgage Finance', + }, + { + symbol: 'PCAR', + name: 'Paccar', + sector: 'Industrials', + subIndustry: 'Construction Machinery & Heavy Trucks', + }, + { + symbol: 'PEAK', + name: 'Healthpeak Properties', + sector: 'Real Estate', + subIndustry: 'Health Care REITs', + }, + { + symbol: 'PEG', + name: 'Public Service Enterprise Group', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'PENN', + name: 'Penn National Gaming', + sector: 'Consumer Discretionary', + subIndustry: 'Casinos & Gaming', + }, + { + symbol: 'PEP', + name: 'PepsiCo', + sector: 'Consumer Staples', + subIndustry: 'Soft Drinks', + }, + { + symbol: 'PFE', + name: 'Pfizer', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'PFG', + name: 'Principal Financial Group', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'PG', + name: 'Procter & Gamble', + sector: 'Consumer Staples', + subIndustry: 'Personal Products', + }, + { + symbol: 'PGR', + name: 'Progressive Corporation', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'PH', + name: 'Parker-Hannifin', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'PHM', + name: 'PulteGroup', + sector: 'Consumer Discretionary', + subIndustry: 'Homebuilding', + }, + { + symbol: 'PKG', + name: 'Packaging Corporation of America', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'PKI', + name: 'PerkinElmer', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'PLD', + name: 'Prologis', + sector: 'Real Estate', + subIndustry: 'Industrial REITs', + }, + { + symbol: 'PM', + name: 'Philip Morris International', + sector: 'Consumer Staples', + subIndustry: 'Tobacco', + }, + { + symbol: 'PNC', + name: 'PNC Financial Services', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'PNR', + name: 'Pentair', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'PNW', + name: 'Pinnacle West Capital', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'POOL', + name: 'Pool Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Distributors', + }, + { + symbol: 'PPG', + name: 'PPG Industries', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'PPL', + name: 'PPL', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'PRGO', + name: 'Perrigo', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'PRU', + name: 'Prudential Financial', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'PSA', + name: 'Public Storage', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'PSX', + name: 'Phillips 66', + sector: 'Energy', + subIndustry: 'Oil & Gas Refining & Marketing', + }, + { + symbol: 'PTC', + name: 'PTC', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'PVH', + name: 'PVH', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'PWR', + name: 'Quanta Services', + sector: 'Industrials', + subIndustry: 'Construction & Engineering', + }, + { + symbol: 'PXD', + name: 'Pioneer Natural Resources', + sector: 'Energy', + subIndustry: 'Oil & Gas Exploration & Production', + }, + { + symbol: 'PYPL', + name: 'PayPal', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'QCOM', + name: 'Qualcomm', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'QRVO', + name: 'Qorvo', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'RCL', + name: 'Royal Caribbean Group', + sector: 'Consumer Discretionary', + subIndustry: 'Hotels, Resorts & Cruise Lines', + }, + { + symbol: 'RE', + name: 'Everest Re', + sector: 'Financials', + subIndustry: 'Reinsurance', + }, + { + symbol: 'REG', + name: 'Regency Centers', + sector: 'Real Estate', + subIndustry: 'Retail REITs', + }, + { + symbol: 'REGN', + name: 'Regeneron Pharmaceuticals', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'RF', + name: 'Regions Financial Corporation', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'RHI', + name: 'Robert Half International', + sector: 'Industrials', + subIndustry: 'Human Resource & Employment Services', + }, + { + symbol: 'RJF', + name: 'Raymond James Financial', + sector: 'Financials', + subIndustry: 'Investment Banking & Brokerage', + }, + { + symbol: 'RL', + name: 'Ralph Lauren Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'RMD', + name: 'ResMed', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'ROK', + name: 'Rockwell Automation', + sector: 'Industrials', + subIndustry: 'Electrical Components & Equipment', + }, + { + symbol: 'ROL', + name: 'Rollins', + sector: 'Industrials', + subIndustry: 'Environmental & Facilities Services', + }, + { + symbol: 'ROP', + name: 'Roper Technologies', + sector: 'Industrials', + subIndustry: 'Industrial Conglomerates', + }, + { + symbol: 'ROST', + name: 'Ross Stores', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel Retail', + }, + { + symbol: 'RSG', + name: 'Republic Services', + sector: 'Industrials', + subIndustry: 'Environmental & Facilities Services', + }, + { + symbol: 'RTX', + name: 'Raytheon Technologies', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'SBAC', + name: 'SBA Communications', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'SBUX', + name: 'Starbucks', + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'SCHW', + name: 'Charles Schwab Corporation', + sector: 'Financials', + subIndustry: 'Investment Banking & Brokerage', + }, + { + symbol: 'SEE', + name: 'Sealed Air', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'SHW', + name: 'Sherwin-Williams', + sector: 'Materials', + subIndustry: 'Specialty Chemicals', + }, + { + symbol: 'SIVB', + name: 'SVB Financial', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'SJM', + name: 'JM Smucker', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'SLB', + name: 'Schlumberger', + sector: 'Energy', + subIndustry: 'Oil & Gas Equipment & Services', + }, + { + symbol: 'SNA', + name: 'Snap-on', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'SNPS', + name: 'Synopsys', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'SO', + name: 'Southern Company', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'SPG', + name: 'Simon Property Group', + sector: 'Real Estate', + subIndustry: 'Retail REITs', + }, + { + symbol: 'SPGI', + name: 'S&P Global', + sector: 'Financials', + subIndustry: 'Financial Exchanges & Data', + }, + { + symbol: 'SRE', + name: 'Sempra Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'STE', + name: 'Steris', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'STT', + name: 'State Street Corporation', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'STX', + name: 'Seagate Technology', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'STZ', + name: 'Constellation Brands', + sector: 'Consumer Staples', + subIndustry: 'Distillers & Vintners', + }, + { + symbol: 'SWK', + name: 'Stanley Black & Decker', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'SWKS', + name: 'Skyworks Solutions', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'SYF', + name: 'Synchrony Financial', + sector: 'Financials', + subIndustry: 'Consumer Finance', + }, + { + symbol: 'SYK', + name: 'Stryker Corporation', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'SYY', + name: 'Sysco', + sector: 'Consumer Staples', + subIndustry: 'Food Distributors', + }, + { + symbol: 'T', + name: 'AT&T', + sector: 'Communication Services', + subIndustry: 'Integrated Telecommunication Services', + }, + { + symbol: 'TAP', + name: 'Molson Coors Beverage Company', + sector: 'Consumer Staples', + subIndustry: 'Brewers', + }, + { + symbol: 'TDG', + name: 'TransDigm Group', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'TDY', + name: 'Teledyne Technologies', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'TEL', + name: 'TE Connectivity', + sector: 'Information Technology', + subIndustry: 'Electronic Manufacturing Services', + }, + { + symbol: 'TER', + name: 'Teradyne', + sector: 'Information Technology', + subIndustry: 'Semiconductor Equipment', + }, + { + symbol: 'TFC', + name: 'Truist Financial', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'TFX', + name: 'Teleflex', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'TGT', + name: 'Target Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'General Merchandise Stores', + }, + { + symbol: 'TJX', + name: 'TJX Companies', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel Retail', + }, + { + symbol: 'TMO', + name: 'Thermo Fisher Scientific', + sector: 'Health Care', + subIndustry: 'Life Sciences Tools & Services', + }, + { + symbol: 'TMUS', + name: 'T-Mobile US', + sector: 'Communication Services', + subIndustry: 'Wireless Telecommunication Services', + }, + { + symbol: 'TPR', + name: 'Tapestry', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'TRMB', + name: 'Trimble', + sector: 'Information Technology', + subIndustry: 'Electronic Equipment & Instruments', + }, + { + symbol: 'TROW', + name: 'T. Rowe Price', + sector: 'Financials', + subIndustry: 'Asset Management & Custody Banks', + }, + { + symbol: 'TRV', + name: 'The Travelers Companies', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'TSCO', + name: 'Tractor Supply Company', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'TSLA', + name: 'Tesla', + sector: 'Consumer Discretionary', + subIndustry: 'Automobile Manufacturers', + }, + { + symbol: 'TSN', + name: 'Tyson Foods', + sector: 'Consumer Staples', + subIndustry: 'Packaged Foods & Meats', + }, + { + symbol: 'TT', + name: 'Trane Technologies', + sector: 'Industrials', + subIndustry: 'Building Products', + }, + { + symbol: 'TTWO', + name: 'Take-Two Interactive', + sector: 'Communication Services', + subIndustry: 'Interactive Home Entertainment', + }, + { + symbol: 'TWTR', + name: 'Twitter', + sector: 'Communication Services', + subIndustry: 'Interactive Media & Services', + }, + { + symbol: 'TXN', + name: 'Texas Instruments', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'TXT', + name: 'Textron', + sector: 'Industrials', + subIndustry: 'Aerospace & Defense', + }, + { + symbol: 'TYL', + name: 'Tyler Technologies', + sector: 'Information Technology', + subIndustry: 'Application Software', + }, + { + symbol: 'UA', + name: 'Under Armour (Class C)', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'UAA', + name: 'Under Armour (Class A)', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'UAL', + name: 'United Airlines', + sector: 'Industrials', + subIndustry: 'Airlines', + }, + { + symbol: 'UDR', + name: 'UDR', + sector: 'Real Estate', + subIndustry: 'Residential REITs', + }, + { + symbol: 'UHS', + name: 'Universal Health Services', + sector: 'Health Care', + subIndustry: 'Health Care Facilities', + }, + { + symbol: 'ULTA', + name: 'Ulta Beauty', + sector: 'Consumer Discretionary', + subIndustry: 'Specialty Stores', + }, + { + symbol: 'UNH', + name: 'UnitedHealth Group', + sector: 'Health Care', + subIndustry: 'Managed Health Care', + }, + { + symbol: 'UNM', + name: 'Unum Group', + sector: 'Financials', + subIndustry: 'Life & Health Insurance', + }, + { + symbol: 'UNP', + name: 'Union Pacific', + sector: 'Industrials', + subIndustry: 'Railroads', + }, + { + symbol: 'UPS', + name: 'United Parcel Service', + sector: 'Industrials', + subIndustry: 'Air Freight & Logistics', + }, + { + symbol: 'URI', + name: 'United Rentals', + sector: 'Industrials', + subIndustry: 'Trading Companies & Distributors', + }, + { + symbol: 'USB', + name: 'U.S. Bancorp', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'V', + name: 'Visa', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'VFC', + name: 'VF Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Apparel, Accessories & Luxury Goods', + }, + { + symbol: 'VIAC', + name: 'ViacomCBS', + sector: 'Communication Services', + subIndustry: 'Movies & Entertainment', + }, + { + symbol: 'VLO', + name: 'Valero Energy', + sector: 'Energy', + subIndustry: 'Oil & Gas Refining & Marketing', + }, + { + symbol: 'VMC', + name: 'Vulcan Materials', + sector: 'Materials', + subIndustry: 'Construction Materials', + }, + { + symbol: 'VNO', + name: 'Vornado Realty Trust', + sector: 'Real Estate', + subIndustry: 'Office REITs', + }, + { + symbol: 'VRSK', + name: 'Verisk Analytics', + sector: 'Industrials', + subIndustry: 'Research & Consulting Services', + }, + { + symbol: 'VRSN', + name: 'Verisign', + sector: 'Information Technology', + subIndustry: 'Internet Services & Infrastructure', + }, + { + symbol: 'VRTX', + name: 'Vertex Pharmaceuticals', + sector: 'Health Care', + subIndustry: 'Biotechnology', + }, + { + symbol: 'VTR', + name: 'Ventas', + sector: 'Real Estate', + subIndustry: 'Health Care REITs', + }, + { + symbol: 'VTRS', + name: 'Viatris', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, + { + symbol: 'VZ', + name: 'Verizon Communications', + sector: 'Communication Services', + subIndustry: 'Integrated Telecommunication Services', + }, + { + symbol: 'WAB', + name: 'Wabtec', + sector: 'Industrials', + subIndustry: 'Construction Machinery & Heavy Trucks', + }, + { + symbol: 'WAT', + name: 'Waters Corporation', + sector: 'Health Care', + subIndustry: 'Health Care Distributors', + }, + { + symbol: 'WBA', + name: 'Walgreens Boots Alliance', + sector: 'Consumer Staples', + subIndustry: 'Drug Retail', + }, + { + symbol: 'WDC', + name: 'Western Digital', + sector: 'Information Technology', + subIndustry: 'Technology Hardware, Storage & Peripherals', + }, + { + symbol: 'WEC', + name: 'WEC Energy Group', + sector: 'Utilities', + subIndustry: 'Electric Utilities', + }, + { + symbol: 'WELL', + name: 'Welltower', + sector: 'Real Estate', + subIndustry: 'Health Care REITs', + }, + { + symbol: 'WFC', + name: 'Wells Fargo', + sector: 'Financials', + subIndustry: 'Diversified Banks', + }, + { + symbol: 'WHR', + name: 'Whirlpool Corporation', + sector: 'Consumer Discretionary', + subIndustry: 'Household Appliances', + }, + { + symbol: 'WLTW', + name: 'Willis Towers Watson', + sector: 'Financials', + subIndustry: 'Insurance Brokers', + }, + { + symbol: 'WM', + name: 'Waste Management', + sector: 'Industrials', + subIndustry: 'Environmental & Facilities Services', + }, + { + symbol: 'WMB', + name: 'Williams Companies', + sector: 'Energy', + subIndustry: 'Oil & Gas Storage & Transportation', + }, + { + symbol: 'WMT', + name: 'Walmart', + sector: 'Consumer Staples', + subIndustry: 'Hypermarkets & Super Centers', + }, + { + symbol: 'WRB', + name: 'W. R. Berkley Corporation', + sector: 'Financials', + subIndustry: 'Property & Casualty Insurance', + }, + { + symbol: 'WRK', + name: 'WestRock', + sector: 'Materials', + subIndustry: 'Paper Packaging', + }, + { + symbol: 'WST', + name: 'West Pharmaceutical Services', + sector: 'Health Care', + subIndustry: 'Health Care Supplies', + }, + { + symbol: 'WU', + name: 'Western Union', + sector: 'Information Technology', + subIndustry: 'Data Processing & Outsourced Services', + }, + { + symbol: 'WY', + name: 'Weyerhaeuser', + sector: 'Real Estate', + subIndustry: 'Specialized REITs', + }, + { + symbol: 'WYNN', + name: 'Wynn Resorts', + sector: 'Consumer Discretionary', + subIndustry: 'Casinos & Gaming', + }, + { + symbol: 'XEL', + name: 'Xcel Energy', + sector: 'Utilities', + subIndustry: 'Multi-Utilities', + }, + { + symbol: 'XLNX', + name: 'Xilinx', + sector: 'Information Technology', + subIndustry: 'Semiconductors', + }, + { + symbol: 'XOM', + name: 'ExxonMobil', + sector: 'Energy', + subIndustry: 'Integrated Oil & Gas', + }, + { + symbol: 'XRAY', + name: 'Dentsply Sirona', + sector: 'Health Care', + subIndustry: 'Health Care Supplies', + }, + { + symbol: 'XYL', + name: 'Xylem', + sector: 'Industrials', + subIndustry: 'Industrial Machinery', + }, + { + symbol: 'YUM', + name: 'Yum! Brands', + sector: 'Consumer Discretionary', + subIndustry: 'Restaurants', + }, + { + symbol: 'ZBH', + name: 'Zimmer Biomet', + sector: 'Health Care', + subIndustry: 'Health Care Equipment', + }, + { + symbol: 'ZBRA', + name: 'Zebra Technologies', + sector: 'Information Technology', + subIndustry: 'Electronic Equipment & Instruments', + }, + { + symbol: 'ZION', + name: 'Zions Bancorp', + sector: 'Financials', + subIndustry: 'Regional Banks', + }, + { + symbol: 'ZTS', + name: 'Zoetis', + sector: 'Health Care', + subIndustry: 'Pharmaceuticals', + }, ]; diff --git a/src/helper/binarySearchTree.test.ts b/src/helper/binarySearchTree.test.ts index f6e6fcf..fbf5166 100644 --- a/src/helper/binarySearchTree.test.ts +++ b/src/helper/binarySearchTree.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {strictEqual} from 'assert'; -import {BinarySearchTree} from './binarySearchTree'; +import { strictEqual } from 'assert'; +import { BinarySearchTree } from './binarySearchTree'; describe('Binary Search Tree (BST)', () => { it('should be able to compute min', () => { @@ -18,7 +18,7 @@ describe('Binary Search Tree (BST)', () => { for (let i = values.length - 1; i > 0; i--) { const removed = bst.remove(values[i]); strictEqual(removed, true); - strictEqual(bst.min(), expected[i-1]); + strictEqual(bst.min(), expected[i - 1]); } }); it('should be able to compute max', () => { @@ -34,7 +34,7 @@ describe('Binary Search Tree (BST)', () => { for (let i = values.length - 1; i > 0; i--) { const removed = bst.remove(values[i]); strictEqual(removed, true); - strictEqual(bst.max(), expected[i-1]); + strictEqual(bst.max(), expected[i - 1]); } }); }); diff --git a/src/helper/binarySearchTree.ts b/src/helper/binarySearchTree.ts index 249c4b9..1bdf15e 100644 --- a/src/helper/binarySearchTree.ts +++ b/src/helper/binarySearchTree.ts @@ -126,7 +126,7 @@ export class BinarySearchTree { return; } - if ((info.node.left !== null) && ((info.node.right !== null))) { + if (info.node.left !== null && info.node.right !== null) { const minInfo = BinarySearchTree.minNode(info.node.right); if (minInfo.parent === null) { minInfo.parent = info.node; diff --git a/src/helper/date.test.ts b/src/helper/date.test.ts index 084d285..9da5a9b 100644 --- a/src/helper/date.test.ts +++ b/src/helper/date.test.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {daysLaterFrom, toISODateString} from './date'; +import { daysLaterFrom, toISODateString } from './date'; describe('Date helpers', () => { it('should be able to compute iso', () => { diff --git a/src/helper/numArray.test.ts b/src/helper/numArray.test.ts index c47bf9d..ec034ab 100644 --- a/src/helper/numArray.test.ts +++ b/src/helper/numArray.test.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual, strictEqual} from 'assert'; +import { deepStrictEqual, strictEqual } from 'assert'; import * as NumArray from './numArray'; describe('Number Array', () => { @@ -113,7 +113,12 @@ describe('Number Array', () => { it('should be able to transpose values', () => { const values1 = [1, 3, 5, 7]; const values2 = [2, 4, 6, 8]; - const expected = [[1, 2], [3, 4], [5, 6], [7, 8]]; + const expected = [ + [1, 2], + [3, 4], + [5, 6], + [7, 8], + ]; const actual = NumArray.transpose(values1, values2); deepStrictEqual(actual, expected); @@ -138,9 +143,9 @@ describe('Number Array', () => { }); it('should be able to round digits for all', () => { - const values = [1.2345, 2.5194, 4.1025, 6.7790]; + const values = [1.2345, 2.5194, 4.1025, 6.779]; const digits = 2; - const expected = [1.23, 2.52, 4.10, 6.78]; + const expected = [1.23, 2.52, 4.1, 6.78]; const actual = NumArray.roundDigitsAll(digits, values); deepStrictEqual(actual, expected); diff --git a/src/helper/numArray.ts b/src/helper/numArray.ts index 200c54e..5b70867 100644 --- a/src/helper/numArray.ts +++ b/src/helper/numArray.ts @@ -199,7 +199,7 @@ export function changes(n: number, values: number[]): number[] { * @return sign values. */ export function extractSigns(values: number[]): number[] { - return values.map((value) => (value >= 0) ? 1 : -1); + return values.map((value) => (value >= 0 ? 1 : -1)); } /** @@ -261,14 +261,14 @@ export function roundDigitsAll(digits: number, values: number[]): number[] { * @return generated numbers. */ export function generateNumbers( - begin: number, - end: number, - step: number, + begin: number, + end: number, + step: number ): number[] { const result = new Array((end - begin) / step); for (let i = 0; i < result.length; i++) { - result[i] = begin + (step * i); + result[i] = begin + step * i; } return result; diff --git a/src/helper/regression.test.ts b/src/helper/regression.test.ts index 25a9409..dd43f19 100644 --- a/src/helper/regression.test.ts +++ b/src/helper/regression.test.ts @@ -1,9 +1,13 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual, strictEqual} from 'assert'; -import {roundDigits, roundDigitsAll} from './numArray'; -import {leastSquare, linearRegressionUsingLeastSquare, movingLeastSquare} from './regression'; +import { deepStrictEqual, strictEqual } from 'assert'; +import { roundDigits, roundDigitsAll } from './numArray'; +import { + leastSquare, + linearRegressionUsingLeastSquare, + movingLeastSquare, +} from './regression'; describe('Linear Regressin', () => { it('should be able to compute the least square', () => { diff --git a/src/helper/regression.ts b/src/helper/regression.ts index d359fca..cbd43d0 100644 --- a/src/helper/regression.ts +++ b/src/helper/regression.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, addBy, checkSameLength, multiply, multiplyBy} from './numArray'; +import { add, addBy, checkSameLength, multiply, multiplyBy } from './numArray'; /** * Least square result object. @@ -49,8 +49,8 @@ export function leastSquare(x: number[], y: number[]): LeastSquareResult { } const n = x.length; - const m = ((n * sumXY) - (sumX * sumY)) / ((n * sumX2) - (sumX * sumX)); - const b = (sumY - (m * sumX)) / n; + const m = (n * sumXY - sumX * sumY) / (n * sumX2 - sumX * sumX); + const b = (sumY - m * sumX) / n; return { m, @@ -74,9 +74,9 @@ export function leastSquare(x: number[], y: number[]): LeastSquareResult { * @return moving least square result. */ export function movingLeastSquare( - period: number, - x: number[], - y: number[], + period: number, + x: number[], + y: number[] ): MovingLeastSquareResult { checkSameLength(x, y); @@ -97,16 +97,16 @@ export function movingLeastSquare( let n = i + 1; if (i >= period) { - sumX -= x[i-period]; - sumX2 -= x[i-period] * x[i-period]; - sumY -= y[i-period]; - sumXY -= x[i-period] * y[i-period]; + sumX -= x[i - period]; + sumX2 -= x[i - period] * x[i - period]; + sumY -= y[i - period]; + sumXY -= x[i - period] * y[i - period]; n = period; } if (i > 0) { - m[i] = ((n * sumXY) - (sumX * sumY)) / ((n * sumX2) - (sumX * sumX)); - b[i] = (sumY - (m[i] * sumX)) / n; + m[i] = (n * sumXY - sumX * sumY) / (n * sumX2 - sumX * sumX); + b[i] = (sumY - m[i] * sumX) / n; } else { m[i] = 0; b[i] = 0; @@ -128,7 +128,10 @@ export function movingLeastSquare( * @param y y values. * @return regression values. */ -export function linearRegressionUsingLeastSquare(x: number[], y: number[]): number[] { +export function linearRegressionUsingLeastSquare( + x: number[], + y: number[] +): number[] { const ls = leastSquare(x, y); const lr = addBy(ls.b, multiplyBy(ls.m, x)); return lr; @@ -145,9 +148,9 @@ export function linearRegressionUsingLeastSquare(x: number[], y: number[]): numb * @return regression values. */ export function movingLinearRegressionUsingLeastSquare( - period: number, - x: number[], - y: number[], + period: number, + x: number[], + y: number[] ): number[] { const ls = movingLeastSquare(period, x, y); const lr = add(multiply(ls.m, x), ls.b); diff --git a/src/indicator/momentum/awesomeOscillator.ts b/src/indicator/momentum/awesomeOscillator.ts index 61f6387..46f2eda 100644 --- a/src/indicator/momentum/awesomeOscillator.ts +++ b/src/indicator/momentum/awesomeOscillator.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, divideBy, substract} from '../../helper/numArray'; -import {sma} from '../trend/sma'; +import { add, divideBy, substract } from '../../helper/numArray'; +import { sma } from '../trend/sma'; /** * Awesome Oscillator. diff --git a/src/indicator/momentum/chaikinOscillator.test.ts b/src/indicator/momentum/chaikinOscillator.test.ts index d115f6a..a607f3e 100644 --- a/src/indicator/momentum/chaikinOscillator.test.ts +++ b/src/indicator/momentum/chaikinOscillator.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {chaikinOscillator} from './chaikinOscillator'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { chaikinOscillator } from './chaikinOscillator'; describe('Chaikin Oscillator', () => { it('should be able to compute co', () => { diff --git a/src/indicator/momentum/chaikinOscillator.ts b/src/indicator/momentum/chaikinOscillator.ts index 48b113d..27fd068 100644 --- a/src/indicator/momentum/chaikinOscillator.ts +++ b/src/indicator/momentum/chaikinOscillator.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {substract} from '../../helper/numArray'; -import {ema} from '../trend/ema'; -import {accumulationDistribution} from '../volume/accumulationDistribution'; +import { substract } from '../../helper/numArray'; +import { ema } from '../trend/ema'; +import { accumulationDistribution } from '../volume/accumulationDistribution'; /** * Chaikin oscillator result object. @@ -31,12 +31,12 @@ export interface ChaikinOscillator { * @return chaikin oscillator. */ export function chaikinOscillator( - fastPeriod: number, - slowPeriod: number, - highs: number[], - lows: number[], - closings: number[], - volumes: number[], + fastPeriod: number, + slowPeriod: number, + highs: number[], + lows: number[], + closings: number[], + volumes: number[] ): ChaikinOscillator { const ad = accumulationDistribution(highs, lows, closings, volumes); const co = substract(ema(fastPeriod, ad), ema(slowPeriod, ad)); @@ -58,10 +58,10 @@ export function chaikinOscillator( * @return chaikin oscillator. */ export function defaultChaikinOscillator( - highs: number[], - lows: number[], - closings: number[], - volumes: number[], + highs: number[], + lows: number[], + closings: number[], + volumes: number[] ): ChaikinOscillator { return chaikinOscillator(3, 10, highs, lows, closings, volumes); } diff --git a/src/indicator/momentum/ichimokuCloud.ts b/src/indicator/momentum/ichimokuCloud.ts index 26a039e..1d9367c 100644 --- a/src/indicator/momentum/ichimokuCloud.ts +++ b/src/indicator/momentum/ichimokuCloud.ts @@ -1,9 +1,14 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, checkSameLength, divideBy, shiftRightBy} from '../../helper/numArray'; -import {mmax} from '../trend/mmax'; -import {mmin} from '../trend/mmin'; +import { + add, + checkSameLength, + divideBy, + shiftRightBy, +} from '../../helper/numArray'; +import { mmax } from '../trend/mmax'; +import { mmin } from '../trend/mmin'; /** * Ichimoku cloud result object. @@ -33,9 +38,9 @@ export interface IchimokuCloudResult { * @return ichimoku cloud result object. */ export function ichimokuCloud( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): IchimokuCloudResult { checkSameLength(highs, lows, closings); diff --git a/src/indicator/momentum/rsi.ts b/src/indicator/momentum/rsi.ts index d373a85..dd49179 100644 --- a/src/indicator/momentum/rsi.ts +++ b/src/indicator/momentum/rsi.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {sma} from '../trend/sma'; +import { sma } from '../trend/sma'; /** * Relative Strength Index (RSI). It is a momentum indicator that measures @@ -38,7 +38,7 @@ export function rsi(closings: number[]): number[] { for (let i = 0; i < closings.length; i++) { rs[i] = meanGains[i] / meanLosses[i]; - r[i] = 100 - (100 / (1 + rs[i])); + r[i] = 100 - 100 / (1 + rs[i]); } return r; diff --git a/src/indicator/momentum/stochasticOscillator.ts b/src/indicator/momentum/stochasticOscillator.ts index cce5f3e..f9a40e9 100644 --- a/src/indicator/momentum/stochasticOscillator.ts +++ b/src/indicator/momentum/stochasticOscillator.ts @@ -1,10 +1,10 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiplyBy, substract} from '../../helper/numArray'; -import {mmin} from '../trend/mmin'; -import {mmax} from '../trend/mmax'; -import {sma} from '../trend/sma'; +import { divide, multiplyBy, substract } from '../../helper/numArray'; +import { mmin } from '../trend/mmin'; +import { mmax } from '../trend/mmax'; +import { sma } from '../trend/sma'; /** * Stochastic oscillator result object. @@ -28,17 +28,20 @@ export interface StochasticOscillator { * @return stochastic oscillator result object. */ export function stochasticOscillator( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): StochasticOscillator { const highestHigh14 = mmax(14, highs); const lowestLow14 = mmin(14, lows); - const k = multiplyBy(100, - divide( - substract(closings, lowestLow14), - substract(highestHigh14, lowestLow14))); + const k = multiplyBy( + 100, + divide( + substract(closings, lowestLow14), + substract(highestHigh14, lowestLow14) + ) + ); const d = sma(3, k); diff --git a/src/indicator/momentum/williamsR.ts b/src/indicator/momentum/williamsR.ts index e25aebd..e33ac97 100644 --- a/src/indicator/momentum/williamsR.ts +++ b/src/indicator/momentum/williamsR.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiplyBy, substract} from '../../helper/numArray'; -import {mmax} from '../trend/mmax'; -import {mmin} from '../trend/mmin'; +import { divide, multiplyBy, substract } from '../../helper/numArray'; +import { mmax } from '../trend/mmax'; +import { mmin } from '../trend/mmin'; const PERIOD = 14; @@ -20,14 +20,14 @@ const PERIOD = 14; * @return wr values. */ export function williamsR( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): number[] { const highestHigh = mmax(PERIOD, highs); const lowestLow = mmin(PERIOD, lows); - return multiplyBy(-100, - divide( - substract(highestHigh, closings), - substract(highestHigh, lowestLow))); + return multiplyBy( + -100, + divide(substract(highestHigh, closings), substract(highestHigh, lowestLow)) + ); } diff --git a/src/indicator/trend/absolutePriceOscillator.test.ts b/src/indicator/trend/absolutePriceOscillator.test.ts index 442e55b..71d7e48 100644 --- a/src/indicator/trend/absolutePriceOscillator.test.ts +++ b/src/indicator/trend/absolutePriceOscillator.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {absolutePriceOscillator} from './absolutePriceOscillator'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { absolutePriceOscillator } from './absolutePriceOscillator'; describe('Absolute Price Oscillator (APO)', () => { it('should be able to compute APO', () => { diff --git a/src/indicator/trend/absolutePriceOscillator.ts b/src/indicator/trend/absolutePriceOscillator.ts index 6e3d848..e11550f 100644 --- a/src/indicator/trend/absolutePriceOscillator.ts +++ b/src/indicator/trend/absolutePriceOscillator.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {substract} from '../../helper/numArray'; -import {ema} from './ema'; +import { substract } from '../../helper/numArray'; +import { ema } from './ema'; /** * Absolute Price Oscillator (APO) function calculates the technical indicator @@ -20,9 +20,9 @@ import {ema} from './ema'; * @return apo array. */ export function absolutePriceOscillator( - fastPeriod: number, - slowPeriod: number, - values: number[], + fastPeriod: number, + slowPeriod: number, + values: number[] ): number[] { const fast = ema(fastPeriod, values); const slow = ema(slowPeriod, values); diff --git a/src/indicator/trend/aroon.ts b/src/indicator/trend/aroon.ts index de13a6f..0870905 100644 --- a/src/indicator/trend/aroon.ts +++ b/src/indicator/trend/aroon.ts @@ -1,10 +1,15 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {addBy, checkSameLength, divideBy, multiplyBy} from '../../helper/numArray'; -import {since} from './since'; -import {mmin} from './mmin'; -import {mmax} from './mmax'; +import { + addBy, + checkSameLength, + divideBy, + multiplyBy, +} from '../../helper/numArray'; +import { since } from './since'; +import { mmin } from './mmin'; +import { mmax } from './mmax'; /** * Aroon period. @@ -15,8 +20,8 @@ const AROON_PERIOD = 25; * Aroon result. */ export interface AroonResult { - up: number[], - down: number[], + up: number[]; + down: number[]; } /** @@ -40,11 +45,15 @@ export function aroon(highs: number[], lows: number[]): AroonResult { const sinceLastHigh = since(mmax(AROON_PERIOD, highs)); const sinceLastLow = since(mmin(AROON_PERIOD, lows)); - const up = multiplyBy(100, - divideBy(AROON_PERIOD, addBy(AROON_PERIOD, multiplyBy(-1, sinceLastHigh)))); + const up = multiplyBy( + 100, + divideBy(AROON_PERIOD, addBy(AROON_PERIOD, multiplyBy(-1, sinceLastHigh))) + ); - const down = multiplyBy(100, - divideBy(AROON_PERIOD, addBy(AROON_PERIOD, multiplyBy(-1, sinceLastLow)))); + const down = multiplyBy( + 100, + divideBy(AROON_PERIOD, addBy(AROON_PERIOD, multiplyBy(-1, sinceLastLow))) + ); return { up, diff --git a/src/indicator/trend/balanceOfPower.test.ts b/src/indicator/trend/balanceOfPower.test.ts index 9a50bed..ad53877 100644 --- a/src/indicator/trend/balanceOfPower.test.ts +++ b/src/indicator/trend/balanceOfPower.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {balanceOfPower} from './balanceOfPower'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { balanceOfPower } from './balanceOfPower'; describe('Balance of Powers (BOM)', () => { it('should be able to compute BOM', () => { diff --git a/src/indicator/trend/balanceOfPower.ts b/src/indicator/trend/balanceOfPower.ts index 1aeec10..0478c96 100644 --- a/src/indicator/trend/balanceOfPower.ts +++ b/src/indicator/trend/balanceOfPower.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, substract} from '../../helper/numArray'; +import { divide, substract } from '../../helper/numArray'; /** * The Balance of Power (BOP) function calculates the strength of buying and @@ -17,7 +17,11 @@ import {divide, substract} from '../../helper/numArray'; * @param closings closing values. * @return balance of power values. */ -export function balanceOfPower(openings: number[], highs: number[], - lows: number[], closings: number[]): number[] { +export function balanceOfPower( + openings: number[], + highs: number[], + lows: number[], + closings: number[] +): number[] { return divide(substract(closings, openings), substract(highs, lows)); } diff --git a/src/indicator/trend/chandeForecastOscillator.test.ts b/src/indicator/trend/chandeForecastOscillator.test.ts index b314d1e..048ca05 100644 --- a/src/indicator/trend/chandeForecastOscillator.test.ts +++ b/src/indicator/trend/chandeForecastOscillator.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {chandeForecastOscillator} from './chandeForecastOscillator'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { chandeForecastOscillator } from './chandeForecastOscillator'; describe('Chande Forecast Oscillator (CFO)', () => { it('should be able to compute CFO', () => { diff --git a/src/indicator/trend/chandeForecastOscillator.ts b/src/indicator/trend/chandeForecastOscillator.ts index e8ef260..ce9cf72 100644 --- a/src/indicator/trend/chandeForecastOscillator.ts +++ b/src/indicator/trend/chandeForecastOscillator.ts @@ -1,8 +1,16 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, generateNumbers, multiplyBy, substract} from '../../helper/numArray'; -import {linearRegressionUsingLeastSquare, movingLinearRegressionUsingLeastSquare} from '../../helper/regression'; +import { + divide, + generateNumbers, + multiplyBy, + substract, +} from '../../helper/numArray'; +import { + linearRegressionUsingLeastSquare, + movingLinearRegressionUsingLeastSquare, +} from '../../helper/regression'; /** * The Chande Forecast Oscillator developed by Tushar Chande The Forecast @@ -41,7 +49,10 @@ export function chandeForecastOscillator(closings: number[]): number[] { * @param closings closing values. * @return moving cfo. */ -export function movingChandeForecastOscillator(period: number, closings: number[]): number[] { +export function movingChandeForecastOscillator( + period: number, + closings: number[] +): number[] { const x = generateNumbers(0, closings.length, 1); const r = movingLinearRegressionUsingLeastSquare(period, x, closings); const cfo = multiplyBy(100, divide(substract(closings, r), closings)); diff --git a/src/indicator/trend/dema.ts b/src/indicator/trend/dema.ts index c2c6ada..6467f01 100644 --- a/src/indicator/trend/dema.ts +++ b/src/indicator/trend/dema.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {multiplyBy, substract} from '../../helper/numArray'; -import {ema} from './ema'; +import { multiplyBy, substract } from '../../helper/numArray'; +import { ema } from './ema'; /** * Dema calculates the Double Exponential Moving Average (DEMA). diff --git a/src/indicator/trend/ema.test.ts b/src/indicator/trend/ema.test.ts index a09fca4..5306894 100644 --- a/src/indicator/trend/ema.test.ts +++ b/src/indicator/trend/ema.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {ema} from './ema'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { ema } from './ema'; describe('Exponential Moving Average (EMA)', () => { it('should be able to compute EMA', () => { diff --git a/src/indicator/trend/ema.ts b/src/indicator/trend/ema.ts index 90c69f8..bab4c42 100644 --- a/src/indicator/trend/ema.ts +++ b/src/indicator/trend/ema.ts @@ -17,7 +17,7 @@ export function ema(period: number, values: number[]): number[] { result[0] = values[0]; for (let i = 1; i < result.length; i++) { - result[i] = (values[i] * k) + (result[i - 1] * m); + result[i] = values[i] * k + result[i - 1] * m; } } diff --git a/src/indicator/trend/index.md b/src/indicator/trend/index.md index 9c9b29f..e1d5959 100644 --- a/src/indicator/trend/index.md +++ b/src/indicator/trend/index.md @@ -208,7 +208,7 @@ const result = qstick(period, openings, closings); #### Random Index (KDJ) -The [kdj](./kdj.ts) function calculates the KDJ indicator, also known as the Random Index. KDJ is calculated similar to the Stochastic Oscillator with the difference of having the J line. It is used to analyze the trend and entry points. +The [kdj](./kdj.ts) function calculates the KDJ indicator, also known as the Random Index. KDJ is calculated similar to the Stochastic Oscillator with the difference of having the J line. It is used to analyze the trend and entry points. The K and D lines show if the asset is overbought when they crosses above 80%, and oversold when they crosses below 20%. The J line represents the divergence. diff --git a/src/indicator/trend/kdj.test.ts b/src/indicator/trend/kdj.test.ts index b94a3e3..08cde0d 100644 --- a/src/indicator/trend/kdj.test.ts +++ b/src/indicator/trend/kdj.test.ts @@ -1,18 +1,24 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {defaultKdj} from './kdj'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { defaultKdj } from './kdj'; describe('KDJ indicator', () => { it('should be able to compute KDJ', () => { const lows = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const highs = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]; const closings = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]; - const expectedK = [44.44, 45.91, 46.70, 48.12, 48.66, 48.95, 49.14, 49.26, 49.36, 49.26]; - const expectedD = [44.44, 45.18, 45.68, 46.91, 47.82, 48.58, 48.91, 49.12, 49.25, 49.30]; - const expectedJ = [44.44, 47.37, 48.72, 50.55, 50.32, 49.70, 49.58, 49.56, 49.57, 49.19]; + const expectedK = [ + 44.44, 45.91, 46.7, 48.12, 48.66, 48.95, 49.14, 49.26, 49.36, 49.26, + ]; + const expectedD = [ + 44.44, 45.18, 45.68, 46.91, 47.82, 48.58, 48.91, 49.12, 49.25, 49.3, + ]; + const expectedJ = [ + 44.44, 47.37, 48.72, 50.55, 50.32, 49.7, 49.58, 49.56, 49.57, 49.19, + ]; const kdjResult = defaultKdj(highs, lows, closings); deepStrictEqual(roundDigitsAll(2, kdjResult.k), expectedK); diff --git a/src/indicator/trend/kdj.ts b/src/indicator/trend/kdj.ts index b29130f..023e291 100644 --- a/src/indicator/trend/kdj.ts +++ b/src/indicator/trend/kdj.ts @@ -1,18 +1,18 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiplyBy, substract} from '../../helper/numArray'; -import {mmin} from './mmin'; -import {mmax} from './mmax'; -import {sma} from './sma'; +import { divide, multiplyBy, substract } from '../../helper/numArray'; +import { mmin } from './mmin'; +import { mmax } from './mmax'; +import { sma } from './sma'; /** * KDJ result. */ export interface KdjResult { - k: number[], - d: number[], - j: number[] + k: number[]; + d: number[]; + j: number[]; } /** @@ -40,17 +40,20 @@ export interface KdjResult { * @return kdj result. */ export function kdj( - rPeriod: number, - kPeriod: number, - dPeriod: number, - highs: number[], - lows: number[], - closings: number[], + rPeriod: number, + kPeriod: number, + dPeriod: number, + highs: number[], + lows: number[], + closings: number[] ): KdjResult { const highest = mmax(rPeriod, highs); const lowest = mmin(rPeriod, lows); - const rsv = multiplyBy(100, divide(substract(closings, lowest), substract(highest, lowest))); + const rsv = multiplyBy( + 100, + divide(substract(closings, lowest), substract(highest, lowest)) + ); const k = sma(kPeriod, rsv); const d = sma(dPeriod, k); @@ -73,9 +76,9 @@ export function kdj( * @return kdj result. */ export function defaultKdj( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): KdjResult { return kdj(9, 3, 3, highs, lows, closings); } diff --git a/src/indicator/trend/macd.ts b/src/indicator/trend/macd.ts index 06aa4ce..649a53f 100644 --- a/src/indicator/trend/macd.ts +++ b/src/indicator/trend/macd.ts @@ -1,12 +1,12 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {substract} from '../../helper/numArray'; -import {ema} from './ema'; +import { substract } from '../../helper/numArray'; +import { ema } from './ema'; export interface MacdResult { - macdLine: number[], - signalLine: number[] + macdLine: number[]; + signalLine: number[]; } /** diff --git a/src/indicator/trend/mmax.test.ts b/src/indicator/trend/mmax.test.ts index a0a7f78..fb5b28b 100644 --- a/src/indicator/trend/mmax.test.ts +++ b/src/indicator/trend/mmax.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {mmax} from './mmax'; +import { deepStrictEqual } from 'assert'; +import { mmax } from './mmax'; describe('Moving Max', () => { it('should be able to compute max', () => { diff --git a/src/indicator/trend/mmax.ts b/src/indicator/trend/mmax.ts index d19e957..d334e8d 100644 --- a/src/indicator/trend/mmax.ts +++ b/src/indicator/trend/mmax.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {BinarySearchTree} from '../../helper/binarySearchTree'; +import { BinarySearchTree } from '../../helper/binarySearchTree'; /** * Moving max for the given period. diff --git a/src/indicator/trend/mmin.test.ts b/src/indicator/trend/mmin.test.ts index 697d1a9..dd57efa 100644 --- a/src/indicator/trend/mmin.test.ts +++ b/src/indicator/trend/mmin.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {mmin} from './mmin'; +import { deepStrictEqual } from 'assert'; +import { mmin } from './mmin'; describe('Moving Min', () => { it('should be able to compute min', () => { diff --git a/src/indicator/trend/mmin.ts b/src/indicator/trend/mmin.ts index 59d2c74..3066099 100644 --- a/src/indicator/trend/mmin.ts +++ b/src/indicator/trend/mmin.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {BinarySearchTree} from '../../helper/binarySearchTree'; +import { BinarySearchTree } from '../../helper/binarySearchTree'; /** * Moving min for the given period. diff --git a/src/indicator/trend/msum.test.ts b/src/indicator/trend/msum.test.ts index 82740cb..2eff005 100644 --- a/src/indicator/trend/msum.test.ts +++ b/src/indicator/trend/msum.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {msum} from './msum'; +import { deepStrictEqual } from 'assert'; +import { msum } from './msum'; describe('Moving Sum', () => { it('should be able to compute sum', () => { diff --git a/src/indicator/trend/parabolicSar.test.ts b/src/indicator/trend/parabolicSar.test.ts index bf93968..4a166f3 100644 --- a/src/indicator/trend/parabolicSar.test.ts +++ b/src/indicator/trend/parabolicSar.test.ts @@ -1,36 +1,43 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {Trend} from '../trend'; -import {parabolicSar} from './parabolicSar'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { Trend } from '../trend'; +import { parabolicSar } from './parabolicSar'; describe('Parabolic SAR', () => { it('should be able to compute PSAR', () => { const highs = [ - 3836.86, 3766.57, 3576.17, 3513.55, 3529.75, - 3756.17, 3717.17, 3572.62, 3612.43, + 3836.86, 3766.57, 3576.17, 3513.55, 3529.75, 3756.17, 3717.17, 3572.62, + 3612.43, ]; const lows = [ - 3643.25, 3542.73, 3371.75, 3334.02, 3314.75, - 3558.21, 3517.79, 3447.90, 3494.39, + 3643.25, 3542.73, 3371.75, 3334.02, 3314.75, 3558.21, 3517.79, 3447.9, + 3494.39, ]; const closings = [ - 3790.55, 3546.20, 3507.31, 3340.81, 3529.60, - 3717.41, 3544.35, 3478.14, 3612.08, + 3790.55, 3546.2, 3507.31, 3340.81, 3529.6, 3717.41, 3544.35, 3478.14, + 3612.08, ]; const expectedPsar = [ - 3836.86, 3836.86, 3836.86, 3808.95, 3770.96, - 3314.75, 3314.75, 3323.58, 3332.23, + 3836.86, 3836.86, 3836.86, 3808.95, 3770.96, 3314.75, 3314.75, 3323.58, + 3332.23, ]; const expectedTrends = [ - Trend.FALLING, Trend.FALLING, Trend.FALLING, Trend.FALLING, Trend.FALLING, - Trend.RISING, Trend.RISING, Trend.RISING, Trend.RISING, + Trend.FALLING, + Trend.FALLING, + Trend.FALLING, + Trend.FALLING, + Trend.FALLING, + Trend.RISING, + Trend.RISING, + Trend.RISING, + Trend.RISING, ]; const actual = parabolicSar(highs, lows, closings); diff --git a/src/indicator/trend/parabolicSar.ts b/src/indicator/trend/parabolicSar.ts index abb8941..49b2a95 100644 --- a/src/indicator/trend/parabolicSar.ts +++ b/src/indicator/trend/parabolicSar.ts @@ -1,18 +1,18 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {checkSameLength} from '../../helper/numArray'; -import {Trend} from '../trend'; +import { checkSameLength } from '../../helper/numArray'; +import { Trend } from '../trend'; const PSAR_AF_STEP = 0.02; -const PSAR_AF_MAX = 0.20; +const PSAR_AF_MAX = 0.2; /** * Parabolic SAR result object. */ export interface ParabolicSar { trends: Trend[]; - psar: number[] + psar: number[]; } /** @@ -46,9 +46,9 @@ export interface ParabolicSar { * @return psar result. */ export function parabolicSar( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): ParabolicSar { checkSameLength(highs, lows, closings); @@ -62,21 +62,21 @@ export function parabolicSar( let ep = lows[0]; for (let i = 1; i < psar.length; i++) { - psar[i] = psar[i-1] - ((psar[i-1] - ep) * af); + psar[i] = psar[i - 1] - (psar[i - 1] - ep) * af; - if (trends[i-1] === Trend.FALLING) { - psar[i] = Math.max(psar[i], highs[i-1]); + if (trends[i - 1] === Trend.FALLING) { + psar[i] = Math.max(psar[i], highs[i - 1]); if (i > 1) { - psar[i] = Math.max(psar[i], highs[i-2]); + psar[i] = Math.max(psar[i], highs[i - 2]); } if (highs[i] >= psar[i]) { psar[i] = ep; } } else { - psar[i] = Math.min(psar[i], lows[i-1]); + psar[i] = Math.min(psar[i], lows[i - 1]); if (i > 1) { - psar[i] = Math.min(psar[i], lows[i-2]); + psar[i] = Math.min(psar[i], lows[i - 2]); } if (lows[i] <= psar[i]) { @@ -94,9 +94,9 @@ export function parabolicSar( ep = Math.max(ep, highs[i]); } - if (trends[i] !== trends[i-1]) { + if (trends[i] !== trends[i - 1]) { af = PSAR_AF_STEP; - } else if ((prevEp !== ep) && (af < PSAR_AF_MAX)) { + } else if (prevEp !== ep && af < PSAR_AF_MAX) { af += PSAR_AF_STEP; } } diff --git a/src/indicator/trend/qstick.ts b/src/indicator/trend/qstick.ts index c0c0284..9844a6f 100644 --- a/src/indicator/trend/qstick.ts +++ b/src/indicator/trend/qstick.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {substract} from '../../helper/numArray'; -import {sma} from './sma'; +import { substract } from '../../helper/numArray'; +import { sma } from './sma'; /** * The Qstick function calculates the ratio of recent up and down bars. @@ -14,7 +14,10 @@ import {sma} from './sma'; * @param closings closing values. * @return qstick values. */ -export function qstick(period: number, openings: number[], - closings: number[]): number[] { +export function qstick( + period: number, + openings: number[], + closings: number[] +): number[] { return sma(period, substract(closings, openings)); } diff --git a/src/indicator/trend/since.test.ts b/src/indicator/trend/since.test.ts index ec71906..56b74f6 100644 --- a/src/indicator/trend/since.test.ts +++ b/src/indicator/trend/since.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {since} from './since'; +import { deepStrictEqual } from 'assert'; +import { since } from './since'; describe('Since last change count', () => { it('should be able to compute since', () => { diff --git a/src/indicator/trend/sma.test.ts b/src/indicator/trend/sma.test.ts index c254d42..e46a9ca 100644 --- a/src/indicator/trend/sma.test.ts +++ b/src/indicator/trend/sma.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {sma} from './sma'; +import { deepStrictEqual } from 'assert'; +import { sma } from './sma'; describe('Simple Moving Average (SMA)', () => { it('should be able to compute SMA', () => { diff --git a/src/indicator/trend/tema.test.ts b/src/indicator/trend/tema.test.ts index 0d63315..3ef22b8 100644 --- a/src/indicator/trend/tema.test.ts +++ b/src/indicator/trend/tema.test.ts @@ -1,14 +1,16 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {tema} from './tema'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { tema } from './tema'; describe('Triple Exponential Moving Average', () => { it('should be able to compute TEMA', () => { const values = [2, 4, 6, 8, 12, 14, 16, 18, 20]; - const expected = [2, 3.926, 6, 8.025, 11.948, 14.088, 16.032, 18.001, 19.993]; + const expected = [ + 2, 3.926, 6, 8.025, 11.948, 14.088, 16.032, 18.001, 19.993, + ]; const period = 2; const actual = tema(period, values); diff --git a/src/indicator/trend/tema.ts b/src/indicator/trend/tema.ts index 2534fbb..10656b1 100644 --- a/src/indicator/trend/tema.ts +++ b/src/indicator/trend/tema.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, multiplyBy, substract} from '../../helper/numArray'; -import {ema} from './ema'; +import { add, multiplyBy, substract } from '../../helper/numArray'; +import { ema } from './ema'; /** * Tema calculates the Triple Exponential Moving Average (TEMA). @@ -21,7 +21,10 @@ export function tema(period: number, values: number[]): number[] { const ema2 = ema(period, ema1); const ema3 = ema(period, ema2); - const temaLine = add(substract(multiplyBy(3, ema1), multiplyBy(3, ema2)), ema3); + const temaLine = add( + substract(multiplyBy(3, ema1), multiplyBy(3, ema2)), + ema3 + ); return temaLine; } diff --git a/src/indicator/trend/trima.ts b/src/indicator/trend/trima.ts index c8af522..6fdcd1b 100644 --- a/src/indicator/trend/trima.ts +++ b/src/indicator/trend/trima.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {sma} from './sma'; +import { sma } from './sma'; /** * Trima function calculates the Triangular Moving Average (TRIMA). diff --git a/src/indicator/trend/typicalPrice.ts b/src/indicator/trend/typicalPrice.ts index 07709a6..128c926 100644 --- a/src/indicator/trend/typicalPrice.ts +++ b/src/indicator/trend/typicalPrice.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, divideBy} from '../../helper/numArray'; +import { add, divideBy } from '../../helper/numArray'; /** * The Typical Price. It is another approximation of @@ -16,9 +16,9 @@ import {add, divideBy} from '../../helper/numArray'; * @return tpi values. */ export function typicalPrice( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): number[] { return divideBy(3, add(add(highs, lows), closings)); } diff --git a/src/indicator/trend/vortex.test.ts b/src/indicator/trend/vortex.test.ts index 79cd25e..5facbb2 100644 --- a/src/indicator/trend/vortex.test.ts +++ b/src/indicator/trend/vortex.test.ts @@ -1,15 +1,15 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {vortex} from './vortex'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { vortex } from './vortex'; describe('Vortex Indicator', () => { it('should be able to compute vortex', () => { const highs = [1404.14, 1405.95, 1405.98, 1405.87, 1410.03]; - const lows = [1396.13, 1398.80, 1395.62, 1397.32, 1400.60]; - const closings = [1402.22, 1402.80, 1405.87, 1404.11, 1403.93]; + const lows = [1396.13, 1398.8, 1395.62, 1397.32, 1400.6]; + const closings = [1402.22, 1402.8, 1405.87, 1404.11, 1403.93]; const expectedPlusVi = [1, 1.00189, 0.99964, 1.00083, 1.0031]; const expectedMinusVi = [0.9943, 0.99304, 0.99307, 0.99319, 0.99034]; diff --git a/src/indicator/trend/vortex.ts b/src/indicator/trend/vortex.ts index 6cf4ea6..e7074c8 100644 --- a/src/indicator/trend/vortex.ts +++ b/src/indicator/trend/vortex.ts @@ -1,8 +1,15 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {abs, checkSameLength, divide, max, shiftRightBy, substract} from '../../helper/numArray'; -import {msum} from './msum'; +import { + abs, + checkSameLength, + divide, + max, + shiftRightBy, + substract, +} from '../../helper/numArray'; +import { msum } from './msum'; const VORTEX_PERIOD = 14; @@ -10,8 +17,8 @@ const VORTEX_PERIOD = 14; * Vortex result. */ export interface VortexResult { - plusVi: number[], - minusVi: number[] + plusVi: number[]; + minusVi: number[]; } /** @@ -41,9 +48,9 @@ export interface VortexResult { * @return vortex result. */ export function vortex( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): VortexResult { checkSameLength(highs, lows, closings); @@ -56,9 +63,9 @@ export function vortex( const minusVmSum = msum(VORTEX_PERIOD, minusVm); const tr = max( - substract(highs, lows), - abs(substract(highs, prevClosings)), - abs(substract(lows, prevClosings)), + substract(highs, lows), + abs(substract(highs, prevClosings)), + abs(substract(lows, prevClosings)) ); const trSum = msum(VORTEX_PERIOD, tr); diff --git a/src/indicator/volatility/accelerationBands.ts b/src/indicator/volatility/accelerationBands.ts index 9283e1e..fb7eff9 100644 --- a/src/indicator/volatility/accelerationBands.ts +++ b/src/indicator/volatility/accelerationBands.ts @@ -1,8 +1,16 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, addBy, checkSameLength, divide, multiply, multiplyBy, substract} from '../../helper/numArray'; -import {sma} from '../trend/sma'; +import { + add, + addBy, + checkSameLength, + divide, + multiply, + multiplyBy, + substract, +} from '../../helper/numArray'; +import { sma } from '../trend/sma'; /** * Acceleration bands result object. @@ -27,9 +35,9 @@ export interface AccelerationBands { * @return acceleration band. */ export function accelerationBands( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): AccelerationBands { checkSameLength(highs, lows, closings); diff --git a/src/indicator/volatility/atr.ts b/src/indicator/volatility/atr.ts index 029f59d..8b36682 100644 --- a/src/indicator/volatility/atr.ts +++ b/src/indicator/volatility/atr.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {checkSameLength, max, substract} from '../../helper/numArray'; -import {sma} from '../../indicator/trend/sma'; +import { checkSameLength, max, substract } from '../../helper/numArray'; +import { sma } from '../../indicator/trend/sma'; /** * ATR result. @@ -28,17 +28,17 @@ export interface AtrResult { */ export function atr( - period: number, - highs: number[], - lows: number[], - closings: number[], + period: number, + highs: number[], + lows: number[], + closings: number[] ): AtrResult { checkSameLength(highs, lows, closings); const trLine = max( - substract(highs, lows), - substract(highs, closings), - substract(closings, lows), + substract(highs, lows), + substract(highs, closings), + substract(closings, lows) ); const atrLine = sma(period, trLine); diff --git a/src/indicator/volatility/bollingerBands.ts b/src/indicator/volatility/bollingerBands.ts index d8929cf..313c546 100644 --- a/src/indicator/volatility/bollingerBands.ts +++ b/src/indicator/volatility/bollingerBands.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, multiplyBy, substract} from '../../helper/numArray'; -import {sma} from '../trend/sma'; -import {mstd} from './mstd'; +import { add, multiplyBy, substract } from '../../helper/numArray'; +import { sma } from '../trend/sma'; +import { mstd } from './mstd'; const BB_PERIOD = 20; diff --git a/src/indicator/volatility/bollingerBandsWidth.ts b/src/indicator/volatility/bollingerBandsWidth.ts index 389b306..95f051f 100644 --- a/src/indicator/volatility/bollingerBandsWidth.ts +++ b/src/indicator/volatility/bollingerBandsWidth.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, substract} from '../../helper/numArray'; -import {ema} from '../trend/ema'; -import {BollingerBands} from './bollingerBands'; +import { divide, substract } from '../../helper/numArray'; +import { ema } from '../trend/ema'; +import { BollingerBands } from './bollingerBands'; const PERIOD = 90; @@ -30,8 +30,9 @@ export interface BollingerBandsWidth { */ export function bollingerBandsWidth(bb: BollingerBands): BollingerBandsWidth { const bandWidth = divide( - substract(bb.upperBand, bb.lowerBand), - bb.middleBand); + substract(bb.upperBand, bb.lowerBand), + bb.middleBand + ); const bandWidthEma90 = ema(PERIOD, bandWidth); diff --git a/src/indicator/volatility/chandelierExit.ts b/src/indicator/volatility/chandelierExit.ts index 04d5de7..3ef2373 100644 --- a/src/indicator/volatility/chandelierExit.ts +++ b/src/indicator/volatility/chandelierExit.ts @@ -1,10 +1,10 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, multiplyBy, substract} from '../../helper/numArray'; -import {mmax} from '../trend/mmax'; -import {mmin} from '../trend/mmin'; -import {atr} from './atr'; +import { add, multiplyBy, substract } from '../../helper/numArray'; +import { mmax } from '../trend/mmax'; +import { mmin } from '../trend/mmin'; +import { atr } from './atr'; const PERIOD = 22; @@ -29,9 +29,9 @@ export interface ChandelierExitResult { * @return chandelier exit. */ export function chandelierExit( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): ChandelierExitResult { const atrResult = atr(PERIOD, highs, lows, closings); const atrLine3 = multiplyBy(3, atrResult.atrLine); diff --git a/src/indicator/volatility/mstd.test.ts b/src/indicator/volatility/mstd.test.ts index d40ec50..1ab813a 100644 --- a/src/indicator/volatility/mstd.test.ts +++ b/src/indicator/volatility/mstd.test.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {deepStrictEqual} from 'assert'; -import {roundDigitsAll} from '../../helper/numArray'; -import {mstd} from './mstd'; +import { deepStrictEqual } from 'assert'; +import { roundDigitsAll } from '../../helper/numArray'; +import { mstd } from './mstd'; describe('Standard deviation', () => { it('should be able to compute std', () => { diff --git a/src/indicator/volatility/projectionOscillator.ts b/src/indicator/volatility/projectionOscillator.ts index 9415b79..c6989c9 100644 --- a/src/indicator/volatility/projectionOscillator.ts +++ b/src/indicator/volatility/projectionOscillator.ts @@ -1,11 +1,18 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, divide, generateNumbers, multiply, multiplyBy, substract} from '../../helper/numArray'; -import {movingLeastSquare} from '../../helper/regression'; -import {ema} from '../trend/ema'; -import {mmax} from '../trend/mmax'; -import {mmin} from '../trend/mmin'; +import { + add, + divide, + generateNumbers, + multiply, + multiplyBy, + substract, +} from '../../helper/numArray'; +import { movingLeastSquare } from '../../helper/regression'; +import { ema } from '../trend/ema'; +import { mmax } from '../trend/mmax'; +import { mmin } from '../trend/mmin'; /** * Projection oscillator result object. @@ -35,11 +42,11 @@ export interface ProjectionOscillator { * @return projection oscillator. */ export function projectionOscillator( - period: number, - smooth: number, - highs: number[], - lows: number[], - closings: number[], + period: number, + smooth: number, + highs: number[], + lows: number[], + closings: number[] ): ProjectionOscillator { const x = generateNumbers(0, closings.length, 1); const lsHighs = movingLeastSquare(period, x, highs); @@ -51,7 +58,10 @@ export function projectionOscillator( const pu = mmax(period, vHighs); const pl = mmin(period, vLows); - const po = divide(multiplyBy(100, substract(closings, pl)), substract(pu, pl)); + const po = divide( + multiplyBy(100, substract(closings, pl)), + substract(pu, pl) + ); const spo = ema(smooth, po); return { @@ -68,9 +78,9 @@ export function projectionOscillator( * @return projection oscillator. */ export function defaultProjectionOscillator( - highs: number[], - lows: number[], - closings: number[], + highs: number[], + lows: number[], + closings: number[] ): ProjectionOscillator { return projectionOscillator(14, 3, highs, lows, closings); } diff --git a/src/indicator/volatility/ulcerIndex.test.ts b/src/indicator/volatility/ulcerIndex.test.ts index a23b654..9fee36b 100644 --- a/src/indicator/volatility/ulcerIndex.test.ts +++ b/src/indicator/volatility/ulcerIndex.test.ts @@ -1,14 +1,16 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../index'; -import {defaultUlcerIndex} from './ulcerIndex'; +import { roundDigitsAll } from '../../index'; +import { defaultUlcerIndex } from './ulcerIndex'; describe('Ulcer Index', () => { it('should be able to compute UI', () => { const closings = [9, 11, 7, 10, 8, 7, 7, 8, 10, 9, 5, 4, 6, 7]; - const expected = [0, 0, 20.99, 18.74, 20.73, 24.05, 26.17, 26.31, - 24.99, 24.39, 28.49, 32.88, 34.02, 34.19]; + const expected = [ + 0, 0, 20.99, 18.74, 20.73, 24.05, 26.17, 26.31, 24.99, 24.39, 28.49, + 32.88, 34.02, 34.19, + ]; const actual = defaultUlcerIndex(closings); expect(roundDigitsAll(2, actual)).toStrictEqual(expected); diff --git a/src/indicator/volatility/ulcerIndex.ts b/src/indicator/volatility/ulcerIndex.ts index 4a6d7b3..6e3b0d0 100644 --- a/src/indicator/volatility/ulcerIndex.ts +++ b/src/indicator/volatility/ulcerIndex.ts @@ -1,9 +1,15 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiply, multiplyBy, sqrt, substract} from '../../helper/numArray'; -import {mmax} from '../trend/mmax'; -import {sma} from '../trend/sma'; +import { + divide, + multiply, + multiplyBy, + sqrt, + substract, +} from '../../helper/numArray'; +import { mmax } from '../trend/mmax'; +import { sma } from '../trend/sma'; /** * Default period for UI. @@ -26,8 +32,14 @@ export const UI_DEFAULT_PERIOD = 14; */ export function ulcerIndex(period: number, closings: number[]): number[] { const highClosings = mmax(period, closings); - const percentageDrawdown = multiplyBy(100, divide(substract(closings, highClosings), highClosings)); - const squaredAverage = sma(period, multiply(percentageDrawdown, percentageDrawdown)); + const percentageDrawdown = multiplyBy( + 100, + divide(substract(closings, highClosings), highClosings) + ); + const squaredAverage = sma( + period, + multiply(percentageDrawdown, percentageDrawdown) + ); const ui = sqrt(squaredAverage); return ui; @@ -42,4 +54,3 @@ export function ulcerIndex(period: number, closings: number[]): number[] { export function defaultUlcerIndex(closings: number[]): number[] { return ulcerIndex(UI_DEFAULT_PERIOD, closings); } - diff --git a/src/indicator/volume/accumulationDistribution.ts b/src/indicator/volume/accumulationDistribution.ts index 4f6430a..9509129 100644 --- a/src/indicator/volume/accumulationDistribution.ts +++ b/src/indicator/volume/accumulationDistribution.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiply, substract} from '../../helper/numArray'; +import { divide, multiply, substract } from '../../helper/numArray'; /** * Accumulation/Distribution Indicator (A/D). Cumulative indicator @@ -19,14 +19,15 @@ import {divide, multiply, substract} from '../../helper/numArray'; * @return ad values. */ export function accumulationDistribution( - highs: number[], - lows: number[], - closings: number[], - volume: number[], + highs: number[], + lows: number[], + closings: number[], + volume: number[] ): number[] { const mfm = divide( - substract(substract(closings, lows), substract(highs, closings)), - substract(highs, lows)); + substract(substract(closings, lows), substract(highs, closings)), + substract(highs, lows) + ); const mfv = multiply(mfm, volume); @@ -35,7 +36,7 @@ export function accumulationDistribution( for (let i = 0; i < ad.length; i++) { ad[i] = mfv[i]; if (i > 0) { - ad[i] += ad[i-1]; + ad[i] += ad[i - 1]; } } diff --git a/src/indicator/volume/chaikinMoneyFlow.test.ts b/src/indicator/volume/chaikinMoneyFlow.test.ts index 79a5f07..454c9de 100644 --- a/src/indicator/volume/chaikinMoneyFlow.test.ts +++ b/src/indicator/volume/chaikinMoneyFlow.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../index'; -import {chaikinMoneyFlow} from './chaikinMoneyFlow'; +import { roundDigitsAll } from '../../index'; +import { chaikinMoneyFlow } from './chaikinMoneyFlow'; describe('Chaikin Money Flow (CMF)', () => { it('should be able to compute CMF', () => { diff --git a/src/indicator/volume/chaikinMoneyFlow.ts b/src/indicator/volume/chaikinMoneyFlow.ts index 1a339c9..a77cdfe 100644 --- a/src/indicator/volume/chaikinMoneyFlow.ts +++ b/src/indicator/volume/chaikinMoneyFlow.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiply, substract} from '../../helper/numArray'; -import {msum} from '../trend/msum'; +import { divide, multiply, substract } from '../../helper/numArray'; +import { msum } from '../trend/msum'; /** * Default period of CMF. @@ -24,20 +24,22 @@ export const CMF_DEFAULT_PERIOD = 20; * @returns cmf values. */ export function chaikinMoneyFlow( - highs: number[], - lows: number[], - closings: number[], - volumes: number[], + highs: number[], + lows: number[], + closings: number[], + volumes: number[] ): number[] { const moneyFlowMultipler = divide( - substract(substract(closings, lows), substract(highs, closings)), - substract(highs, lows)); + substract(substract(closings, lows), substract(highs, closings)), + substract(highs, lows) + ); const moneyFlowVolume = multiply(moneyFlowMultipler, volumes); const cmf = divide( - msum(CMF_DEFAULT_PERIOD, moneyFlowVolume), - msum(CMF_DEFAULT_PERIOD, volumes)); + msum(CMF_DEFAULT_PERIOD, moneyFlowVolume), + msum(CMF_DEFAULT_PERIOD, volumes) + ); return cmf; } diff --git a/src/indicator/volume/easeOfMovement.test.ts b/src/indicator/volume/easeOfMovement.test.ts index b24bb41..769af5a 100644 --- a/src/indicator/volume/easeOfMovement.test.ts +++ b/src/indicator/volume/easeOfMovement.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../index'; -import {defaultEaseOfMovement} from './easeOfMovement'; +import { roundDigitsAll } from '../../index'; +import { defaultEaseOfMovement } from './easeOfMovement'; describe('Ease of Movement (EMV)', () => { it('should be able to compute EMV', () => { diff --git a/src/indicator/volume/easeOfMovement.ts b/src/indicator/volume/easeOfMovement.ts index 4684514..078f065 100644 --- a/src/indicator/volume/easeOfMovement.ts +++ b/src/indicator/volume/easeOfMovement.ts @@ -1,8 +1,14 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {add, changes, divide, divideBy, substract} from '../../helper/numArray'; -import {sma} from '../trend/sma'; +import { + add, + changes, + divide, + divideBy, + substract, +} from '../../helper/numArray'; +import { sma } from '../trend/sma'; /** * Default period for EMV. @@ -25,10 +31,10 @@ export const EMV_DEFAULT_PERIOD = 14; * @return ease of movement values. */ export function easeOfMovement( - period: number, - highs: number[], - lows: number[], - volumes: number[], + period: number, + highs: number[], + lows: number[], + volumes: number[] ): number[] { const distanceMoved = changes(1, divideBy(2, add(highs, lows))); const boxRatio = divide(divideBy(100000000, volumes), substract(highs, lows)); @@ -45,9 +51,9 @@ export function easeOfMovement( * @return ease of movement values. */ export function defaultEaseOfMovement( - highs: number[], - lows: number[], - volumes: number[], + highs: number[], + lows: number[], + volumes: number[] ): number[] { return easeOfMovement(EMV_DEFAULT_PERIOD, highs, lows, volumes); } diff --git a/src/indicator/volume/forceIndex.test.ts b/src/indicator/volume/forceIndex.test.ts index 03a5ff7..462a551 100644 --- a/src/indicator/volume/forceIndex.test.ts +++ b/src/indicator/volume/forceIndex.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../helper/numArray'; -import {defaultForceIndex, forceIndex} from './forceIndex'; +import { roundDigitsAll } from '../../helper/numArray'; +import { defaultForceIndex, forceIndex } from './forceIndex'; describe('Force Index', () => { it('should be able to compute FI', () => { diff --git a/src/indicator/volume/forceIndex.ts b/src/indicator/volume/forceIndex.ts index 44b571e..4cebae9 100644 --- a/src/indicator/volume/forceIndex.ts +++ b/src/indicator/volume/forceIndex.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {changes, multiply} from '../../helper/numArray'; -import {ema} from '../trend/ema'; +import { changes, multiply } from '../../helper/numArray'; +import { ema } from '../trend/ema'; /** * The Force Index (FI) uses the closing price and the volume to assess @@ -16,9 +16,9 @@ import {ema} from '../trend/ema'; * @return force index. */ export function forceIndex( - period: number, - closings: number[], - volumes: number[], + period: number, + closings: number[], + volumes: number[] ): number[] { return ema(period, multiply(changes(1, closings), volumes)); } @@ -31,8 +31,8 @@ export function forceIndex( * @return force index. */ export function defaultForceIndex( - closings: number[], - volumes: number[], + closings: number[], + volumes: number[] ): number[] { return forceIndex(13, closings, volumes); } diff --git a/src/indicator/volume/moneyFlowIndex.test.ts b/src/indicator/volume/moneyFlowIndex.test.ts index 65dbc69..e1b7d93 100644 --- a/src/indicator/volume/moneyFlowIndex.test.ts +++ b/src/indicator/volume/moneyFlowIndex.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../helper/numArray'; -import {moneyFlowIndex} from './moneyFlowIndex'; +import { roundDigitsAll } from '../../helper/numArray'; +import { moneyFlowIndex } from './moneyFlowIndex'; describe('Money Flow Index (MFI)', () => { it('should be able to compute MFI', () => { diff --git a/src/indicator/volume/moneyFlowIndex.ts b/src/indicator/volume/moneyFlowIndex.ts index c8bc2f8..f9400b9 100644 --- a/src/indicator/volume/moneyFlowIndex.ts +++ b/src/indicator/volume/moneyFlowIndex.ts @@ -1,9 +1,17 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {addBy, changes, divide, extractSigns, multiply, multiplyBy, pow} from '../../helper/numArray'; -import {msum} from '../trend/msum'; -import {typicalPrice} from '../trend/typicalPrice'; +import { + addBy, + changes, + divide, + extractSigns, + multiply, + multiplyBy, + pow, +} from '../../helper/numArray'; +import { msum } from '../trend/msum'; +import { typicalPrice } from '../trend/typicalPrice'; /** * The Money Flow Index (MFI) analyzes both the closing price and the volume @@ -22,25 +30,29 @@ import {typicalPrice} from '../trend/typicalPrice'; * @return money flow index values. */ export function moneyFlowIndex( - period: number, - highs: number[], - lows: number[], - closings: number[], - volumes: number[], + period: number, + highs: number[], + lows: number[], + closings: number[], + volumes: number[] ): number[] { const rawMoneyFlow = multiply(typicalPrice(highs, lows, closings), volumes); const signs = extractSigns(changes(1, rawMoneyFlow)); const moneyFlow = multiply(signs, rawMoneyFlow); - const positiveMoneyFlow = moneyFlow.map((value) => (value >= 0) ? value : 0); - const negativeMoneyFlow = moneyFlow.map((value) => (value < 0) ? value : 0); + const positiveMoneyFlow = moneyFlow.map((value) => (value >= 0 ? value : 0)); + const negativeMoneyFlow = moneyFlow.map((value) => (value < 0 ? value : 0)); const moneyRatio = divide( - msum(period, positiveMoneyFlow), - msum(period, negativeMoneyFlow)); + msum(period, positiveMoneyFlow), + msum(period, negativeMoneyFlow) + ); - const moneyFlowIndex = addBy(100, multiplyBy(-100, pow(addBy(1, moneyRatio), -1))); + const moneyFlowIndex = addBy( + 100, + multiplyBy(-100, pow(addBy(1, moneyRatio), -1)) + ); return moneyFlowIndex; } @@ -55,10 +67,10 @@ export function moneyFlowIndex( * @return money flow index values. */ export function defaultMoneyFlowIndex( - highs: number[], - lows: number[], - closings: number[], - volumes: number[], + highs: number[], + lows: number[], + closings: number[], + volumes: number[] ): number[] { return moneyFlowIndex(14, highs, lows, closings, volumes); } diff --git a/src/indicator/volume/negativeVolumeIndex.test.ts b/src/indicator/volume/negativeVolumeIndex.test.ts index db301bc..d5c5057 100644 --- a/src/indicator/volume/negativeVolumeIndex.test.ts +++ b/src/indicator/volume/negativeVolumeIndex.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../index'; -import {negativeVolumeIndex} from './negativeVolumeIndex'; +import { roundDigitsAll } from '../../index'; +import { negativeVolumeIndex } from './negativeVolumeIndex'; describe('Negative Volume Index (NVI)', () => { it('should be able to compute NVI', () => { diff --git a/src/indicator/volume/negativeVolumeIndex.ts b/src/indicator/volume/negativeVolumeIndex.ts index e8fb59e..a420843 100644 --- a/src/indicator/volume/negativeVolumeIndex.ts +++ b/src/indicator/volume/negativeVolumeIndex.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {checkSameLength} from '../../helper/numArray'; +import { checkSameLength } from '../../helper/numArray'; /** * Starting value for NVI. @@ -30,8 +30,8 @@ export const NVI_DEFAULT_PERIOD = 255; * @returns nvi values. */ export function negativeVolumeIndex( - closings: number[], - volumes: number[], + closings: number[], + volumes: number[] ): number[] { checkSameLength(closings, volumes); @@ -40,10 +40,12 @@ export function negativeVolumeIndex( for (let i = 0; i < nvi.length; i++) { if (i === 0) { nvi[i] = NVI_STARTING_VALUE; - } else if (volumes[i-1] < volumes[i]) { - nvi[i] = nvi[i-1]; + } else if (volumes[i - 1] < volumes[i]) { + nvi[i] = nvi[i - 1]; } else { - nvi[i] = nvi[i-1] + (((closings[i] - closings[i-1]) / closings[i-1]) * nvi[i-1]); + nvi[i] = + nvi[i - 1] + + ((closings[i] - closings[i - 1]) / closings[i - 1]) * nvi[i - 1]; } } diff --git a/src/indicator/volume/onBalanceVolume.ts b/src/indicator/volume/onBalanceVolume.ts index 083ce8c..fa18a5e 100644 --- a/src/indicator/volume/onBalanceVolume.ts +++ b/src/indicator/volume/onBalanceVolume.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {checkSameLength} from '../../helper/numArray'; +import { checkSameLength } from '../../helper/numArray'; /** * On-Balance Volume (OBV). It is a technical trading momentum indicator that @@ -16,8 +16,8 @@ import {checkSameLength} from '../../helper/numArray'; * @return obv values. */ export function onBalanceVolume( - closings: number[], - volumes: number[], + closings: number[], + volumes: number[] ): number[] { checkSameLength(closings, volumes); @@ -27,11 +27,11 @@ export function onBalanceVolume( if (i === 0) { result[i] = 0; } else { - result[i] = result[i-1]; + result[i] = result[i - 1]; - if (closings[i] > closings[i-1]) { + if (closings[i] > closings[i - 1]) { result[i] += volumes[i]; - } else if (closings[i] < closings[i-1]) { + } else if (closings[i] < closings[i - 1]) { result[i] -= volumes[i]; } } diff --git a/src/indicator/volume/volumePriceTrend.test.ts b/src/indicator/volume/volumePriceTrend.test.ts index ef96a48..200fdcd 100644 --- a/src/indicator/volume/volumePriceTrend.test.ts +++ b/src/indicator/volume/volumePriceTrend.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../helper/numArray'; -import {volumePriceTrend} from './volumePriceTrend'; +import { roundDigitsAll } from '../../helper/numArray'; +import { volumePriceTrend } from './volumePriceTrend'; describe('Volume Price Trend (VPT)', () => { it('should be able to compute VPT', () => { diff --git a/src/indicator/volume/volumePriceTrend.ts b/src/indicator/volume/volumePriceTrend.ts index 0aebbe4..326f7d0 100644 --- a/src/indicator/volume/volumePriceTrend.ts +++ b/src/indicator/volume/volumePriceTrend.ts @@ -1,8 +1,13 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiply, shiftRightBy, substract} from '../../helper/numArray'; -import {msum} from '../trend/msum'; +import { + divide, + multiply, + shiftRightBy, + substract, +} from '../../helper/numArray'; +import { msum } from '../trend/msum'; /** * The Volume Price Trend (VPT) provides a correlation between the volume and @@ -15,12 +20,15 @@ import {msum} from '../trend/msum'; * @returns volume price trend values. */ export function volumePriceTrend( - closings: number[], - volumes: number[], + closings: number[], + volumes: number[] ): number[] { const previousClosings = shiftRightBy(1, closings); // TODO: Consider changing shiftRightBy to fill with last value. previousClosings[0] = closings[0]; - const vpt = multiply(volumes, divide(substract(closings, previousClosings), previousClosings)); + const vpt = multiply( + volumes, + divide(substract(closings, previousClosings), previousClosings) + ); return msum(vpt.length, vpt); } diff --git a/src/indicator/volume/volumeWeightedAveragePrice.test.ts b/src/indicator/volume/volumeWeightedAveragePrice.test.ts index b928fe7..6e61e84 100644 --- a/src/indicator/volume/volumeWeightedAveragePrice.test.ts +++ b/src/indicator/volume/volumeWeightedAveragePrice.test.ts @@ -1,8 +1,11 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {roundDigitsAll} from '../../index'; -import {defaultVolumeWeightedAveragePrice, volumeWeightedAveragePrice} from './volumeWeightedAveragePrice'; +import { roundDigitsAll } from '../../index'; +import { + defaultVolumeWeightedAveragePrice, + volumeWeightedAveragePrice, +} from './volumeWeightedAveragePrice'; describe('Volume Weighted Average Price', () => { it('should be able to compute VWAP', () => { diff --git a/src/indicator/volume/volumeWeightedAveragePrice.ts b/src/indicator/volume/volumeWeightedAveragePrice.ts index e40ada8..3b597e3 100644 --- a/src/indicator/volume/volumeWeightedAveragePrice.ts +++ b/src/indicator/volume/volumeWeightedAveragePrice.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {divide, multiply} from '../../helper/numArray'; -import {msum} from '../trend/msum'; +import { divide, multiply } from '../../helper/numArray'; +import { msum } from '../trend/msum'; /** * Default period for VWAP. @@ -21,11 +21,14 @@ export const VWAP_DEFAULT_PERIOD = 14; * @returns vwap values. */ export function volumeWeightedAveragePrice( - period: number, - closings: number[], - volumes: number[], + period: number, + closings: number[], + volumes: number[] ): number[] { - return divide(msum(period, multiply(closings, volumes)), msum(period, volumes)); + return divide( + msum(period, multiply(closings, volumes)), + msum(period, volumes) + ); } /** @@ -36,8 +39,8 @@ export function volumeWeightedAveragePrice( * @returns vwap values. */ export function defaultVolumeWeightedAveragePrice( - closings: number[], - volumes: number[], + closings: number[], + volumes: number[] ): number[] { return volumeWeightedAveragePrice(VWAP_DEFAULT_PERIOD, closings, volumes); } diff --git a/src/strategy/action.ts b/src/strategy/action.ts index b57247e..7a4fd7f 100644 --- a/src/strategy/action.ts +++ b/src/strategy/action.ts @@ -1,7 +1,7 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {checkSameLength} from '../helper/numArray'; +import { checkSameLength } from '../helper/numArray'; /** * Strategy action. @@ -58,7 +58,8 @@ export function applyActions(closings: number[], actions: Action[]): number[] { } } - gains[i] = ((shares * closings[i]) + balance - initialBalance) / initialBalance; + gains[i] = + (shares * closings[i] + balance - initialBalance) / initialBalance; } return gains; diff --git a/src/strategy/asset.test.ts b/src/strategy/asset.test.ts index 3efdff3..148eb56 100644 --- a/src/strategy/asset.test.ts +++ b/src/strategy/asset.test.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from './asset'; -import {concatAssets, newAssetWithLength} from './asset'; +import { Asset } from './asset'; +import { concatAssets, newAssetWithLength } from './asset'; describe('Asset object', () => { it('should be able to provide a new asset with length', () => { @@ -37,7 +37,12 @@ describe('Asset object', () => { }; const expected: Asset = { - dates: [new Date(2021, 11, 1), new Date(2021, 11, 2), new Date(2021, 11, 3), new Date(2021, 11, 4)], + dates: [ + new Date(2021, 11, 1), + new Date(2021, 11, 2), + new Date(2021, 11, 3), + new Date(2021, 11, 4), + ], openings: [1, 2, 3, 4], closings: [100, 200, 300, 400], highs: [1000, 2000, 3000, 4000], diff --git a/src/strategy/buyAndHoldStrategy.ts b/src/strategy/buyAndHoldStrategy.ts index 903ef17..a8f8ea9 100644 --- a/src/strategy/buyAndHoldStrategy.ts +++ b/src/strategy/buyAndHoldStrategy.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from './asset'; -import {Action} from './action'; +import { Asset } from './asset'; +import { Action } from './action'; /** * Buy and hold strategy. diff --git a/src/strategy/index.md b/src/strategy/index.md index 5f9dec7..13d13e9 100644 --- a/src/strategy/index.md +++ b/src/strategy/index.md @@ -13,7 +13,6 @@ The strategies are where the results from one or more indicators gets combined t - [Strategy Function](#strategy-function) - [Buy and Hold Strategy](#buy-and-hold-strategy) - #### Asset The stragies operates on an [Asset](./asset.ts) with the following members. @@ -87,8 +86,8 @@ const actions = [ const result = reverseActions(actions); // [ -// Actions.BUY, -// Actions.HOLD, +// Actions.BUY, +// Actions.HOLD, // Actions.SELL // ]; ``` diff --git a/src/strategy/momentum/awesomeOscillatorStrategy.ts b/src/strategy/momentum/awesomeOscillatorStrategy.ts index 3501bef..e2f7ae4 100644 --- a/src/strategy/momentum/awesomeOscillatorStrategy.ts +++ b/src/strategy/momentum/awesomeOscillatorStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {awesomeOscillator} from '../../indicator/momentum/awesomeOscillator'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { awesomeOscillator } from '../../indicator/momentum/awesomeOscillator'; /** * Awesome oscillator strategy function. diff --git a/src/strategy/momentum/ichimokuCloudStrategy.ts b/src/strategy/momentum/ichimokuCloudStrategy.ts index 57f4f52..ce1b23b 100644 --- a/src/strategy/momentum/ichimokuCloudStrategy.ts +++ b/src/strategy/momentum/ichimokuCloudStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {ichimokuCloud} from '../../indicator/momentum/ichimokuCloud'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { ichimokuCloud } from '../../indicator/momentum/ichimokuCloud'; /** * Ichimoku cloud. @@ -12,11 +12,7 @@ import {ichimokuCloud} from '../../indicator/momentum/ichimokuCloud'; * @return strategy actions. */ export function ichimokuCloudStrategy(asset: Asset): Action[] { - const indicator = ichimokuCloud( - asset.highs, - asset.lows, - asset.closings, - ); + const indicator = ichimokuCloud(asset.highs, asset.lows, asset.closings); const actions = new Array(indicator.baseLine.length); diff --git a/src/strategy/momentum/stochasticOscillatorStrategy.ts b/src/strategy/momentum/stochasticOscillatorStrategy.ts index b2908db..77af58d 100644 --- a/src/strategy/momentum/stochasticOscillatorStrategy.ts +++ b/src/strategy/momentum/stochasticOscillatorStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {stochasticOscillator} from '../../indicator/momentum/stochasticOscillator'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { stochasticOscillator } from '../../indicator/momentum/stochasticOscillator'; /** * Stochastic oscillator strategy function. @@ -12,18 +12,14 @@ import {stochasticOscillator} from '../../indicator/momentum/stochasticOscillato * @return strategy actions. */ export function stochasticOscillatorStrategy(asset: Asset): Action[] { - const so = stochasticOscillator( - asset.highs, - asset.lows, - asset.closings, - ); + const so = stochasticOscillator(asset.highs, asset.lows, asset.closings); const actions = new Array(so.k.length); for (let i = 0; i < actions.length; i++) { - if ((so.k[i] >= 80) && (so.d[i] >= 80)) { + if (so.k[i] >= 80 && so.d[i] >= 80) { actions[i] = Action.SELL; - } else if ((so.k[i] <= 20) && (so.d[i] <= 20)) { + } else if (so.k[i] <= 20 && so.d[i] <= 20) { actions[i] = Action.BUY; } else { actions[i] = Action.HOLD; diff --git a/src/strategy/momentum/williamsRStrategy.ts b/src/strategy/momentum/williamsRStrategy.ts index 050f62b..d4d4e88 100644 --- a/src/strategy/momentum/williamsRStrategy.ts +++ b/src/strategy/momentum/williamsRStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {williamsR} from '../../indicator/momentum/williamsR'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { williamsR } from '../../indicator/momentum/williamsR'; /** * Williams R strategy function. @@ -12,11 +12,7 @@ import {williamsR} from '../../indicator/momentum/williamsR'; * @return strategy actions. */ export function williamsRStrategy(asset: Asset): Action[] { - const wr = williamsR( - asset.highs, - asset.lows, - asset.closings, - ); + const wr = williamsR(asset.highs, asset.lows, asset.closings); return wr.map((value) => { if (value <= -80) { diff --git a/src/strategy/strategyFunction.ts b/src/strategy/strategyFunction.ts index 032a887..e39186a 100644 --- a/src/strategy/strategyFunction.ts +++ b/src/strategy/strategyFunction.ts @@ -1,8 +1,8 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Action} from './action'; -import {Asset} from './asset'; +import { Action } from './action'; +import { Asset } from './asset'; /** * Strategy function. diff --git a/src/strategy/trend/absolutePriceOscillatorStrategy.ts b/src/strategy/trend/absolutePriceOscillatorStrategy.ts index 8188908..3d7918f 100644 --- a/src/strategy/trend/absolutePriceOscillatorStrategy.ts +++ b/src/strategy/trend/absolutePriceOscillatorStrategy.ts @@ -1,9 +1,12 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {absolutePriceOscillator, defaultAbsolutePriceOscillator} from '../../indicator/trend/absolutePriceOscillator'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { + absolutePriceOscillator, + defaultAbsolutePriceOscillator, +} from '../../indicator/trend/absolutePriceOscillator'; /** * Runs the APO strategy based on the indicator. @@ -36,15 +39,13 @@ function runStrategy(indicator: number[]): Action[] { * @return strategy actions. */ export function absolutePriceOscillatorStrategy( - fastPeriod: number, - slowPeriod: number, - asset: Asset, + fastPeriod: number, + slowPeriod: number, + asset: Asset ): Action[] { - return runStrategy(absolutePriceOscillator( - fastPeriod, - slowPeriod, - asset.closings, - )); + return runStrategy( + absolutePriceOscillator(fastPeriod, slowPeriod, asset.closings) + ); } /** diff --git a/src/strategy/trend/aroonStrategy.ts b/src/strategy/trend/aroonStrategy.ts index c5d7373..9eb8478 100644 --- a/src/strategy/trend/aroonStrategy.ts +++ b/src/strategy/trend/aroonStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {aroon} from '../../indicator/trend/aroon'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { aroon } from '../../indicator/trend/aroon'; /** * Aroon strategy. diff --git a/src/strategy/trend/balanceOfPowerStrategy.ts b/src/strategy/trend/balanceOfPowerStrategy.ts index a421650..81f07a8 100644 --- a/src/strategy/trend/balanceOfPowerStrategy.ts +++ b/src/strategy/trend/balanceOfPowerStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {balanceOfPower} from '../../indicator/trend/balanceOfPower'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { balanceOfPower } from '../../indicator/trend/balanceOfPower'; /** * Balance of power strategy. @@ -13,10 +13,10 @@ import {balanceOfPower} from '../../indicator/trend/balanceOfPower'; */ export function balanceOfPowerStrategy(asset: Asset): Action[] { const bop = balanceOfPower( - asset.openings, - asset.highs, - asset.lows, - asset.closings, + asset.openings, + asset.highs, + asset.lows, + asset.closings ); return bop.map((value) => { diff --git a/src/strategy/trend/chandeForecastOscillatorStrategy.ts b/src/strategy/trend/chandeForecastOscillatorStrategy.ts index eb6a444..a336477 100644 --- a/src/strategy/trend/chandeForecastOscillatorStrategy.ts +++ b/src/strategy/trend/chandeForecastOscillatorStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {chandeForecastOscillator} from '../../indicator/trend/chandeForecastOscillator'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { chandeForecastOscillator } from '../../indicator/trend/chandeForecastOscillator'; /** * Chande forecast oscillator strategy. diff --git a/src/strategy/trend/kdjStrategy.ts b/src/strategy/trend/kdjStrategy.ts index 5ed74a8..0ffd8a7 100644 --- a/src/strategy/trend/kdjStrategy.ts +++ b/src/strategy/trend/kdjStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {defaultKdj} from '../../indicator/trend/kdj'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { defaultKdj } from '../../indicator/trend/kdj'; /** * KDJ strategy. @@ -15,9 +15,9 @@ export function kdjStrategy(asset: Asset): Action[] { const actions = new Array(kdjResult.k.length); for (let i = 0; i < actions.length; i++) { - if ((kdjResult.k[i] > kdjResult.d[i]) && (kdjResult.k[i] <= 20)) { + if (kdjResult.k[i] > kdjResult.d[i] && kdjResult.k[i] <= 20) { actions[i] = Action.BUY; - } else if ((kdjResult.k[i] < kdjResult.d[i]) && (kdjResult.k[i] >= 80)) { + } else if (kdjResult.k[i] < kdjResult.d[i] && kdjResult.k[i] >= 80) { actions[i] = Action.SELL; } else { actions[i] = Action.HOLD; diff --git a/src/strategy/trend/macdStrategy.ts b/src/strategy/trend/macdStrategy.ts index d89a143..9724687 100644 --- a/src/strategy/trend/macdStrategy.ts +++ b/src/strategy/trend/macdStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {macd} from '../../indicator/trend/macd'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { macd } from '../../indicator/trend/macd'; /** * MACD strategy. diff --git a/src/strategy/trend/parabolicSarStrategy.ts b/src/strategy/trend/parabolicSarStrategy.ts index d3d592b..ac9d445 100644 --- a/src/strategy/trend/parabolicSarStrategy.ts +++ b/src/strategy/trend/parabolicSarStrategy.ts @@ -1,10 +1,10 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {parabolicSar} from '../../indicator/trend/parabolicSar'; -import {Trend} from '../../indicator/trend'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { parabolicSar } from '../../indicator/trend/parabolicSar'; +import { Trend } from '../../indicator/trend'; /** * Parabolic SAR strategy function. @@ -13,11 +13,7 @@ import {Trend} from '../../indicator/trend'; * @return strategy actions. */ export function parabolicSarStrategy(asset: Asset): Action[] { - const psar = parabolicSar( - asset.highs, - asset.lows, - asset.closings, - ); + const psar = parabolicSar(asset.highs, asset.lows, asset.closings); return psar.trends.map((trend) => { switch (trend) { diff --git a/src/strategy/trend/typicalPriceStrategy.ts b/src/strategy/trend/typicalPriceStrategy.ts index 1a45ee7..b68f665 100644 --- a/src/strategy/trend/typicalPriceStrategy.ts +++ b/src/strategy/trend/typicalPriceStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {typicalPrice} from '../../indicator/trend/typicalPrice'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { typicalPrice } from '../../indicator/trend/typicalPrice'; /** * Typical price strategy function. @@ -12,11 +12,7 @@ import {typicalPrice} from '../../indicator/trend/typicalPrice'; * @return strategy actions. */ export function typicalPriceStrategy(asset: Asset): Action[] { - const tpi = typicalPrice( - asset.highs, - asset.lows, - asset.closings, - ); + const tpi = typicalPrice(asset.highs, asset.lows, asset.closings); const actions = new Array(tpi.length); actions[0] = Action.HOLD; diff --git a/src/strategy/trend/vortexStrategy.ts b/src/strategy/trend/vortexStrategy.ts index ee06455..96f3b23 100644 --- a/src/strategy/trend/vortexStrategy.ts +++ b/src/strategy/trend/vortexStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {vortex} from '../../indicator/trend/vortex'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { vortex } from '../../indicator/trend/vortex'; /** * Vortex strategy. @@ -11,11 +11,7 @@ import {vortex} from '../../indicator/trend/vortex'; * @return strategy actions. */ export function vortexStrategy(asset: Asset): Action[] { - const indicator = vortex( - asset.highs, - asset.lows, - asset.closings, - ); + const indicator = vortex(asset.highs, asset.lows, asset.closings); const actions = new Array(indicator.plusVi.length); diff --git a/src/strategy/volatility/accelerationBandsStrategy.ts b/src/strategy/volatility/accelerationBandsStrategy.ts index 82dbbbd..72b9042 100644 --- a/src/strategy/volatility/accelerationBandsStrategy.ts +++ b/src/strategy/volatility/accelerationBandsStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {accelerationBands} from '../../indicator/volatility/accelerationBands'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { accelerationBands } from '../../indicator/volatility/accelerationBands'; /** * Acceleration bands strategy function. @@ -12,11 +12,7 @@ import {accelerationBands} from '../../indicator/volatility/accelerationBands'; * @return strategy actions. */ export function accelerationBandsStrategy(asset: Asset): Action[] { - const ab = accelerationBands( - asset.highs, - asset.lows, - asset.closings, - ); + const ab = accelerationBands(asset.highs, asset.lows, asset.closings); const actions = new Array(ab.upperBand.length); diff --git a/src/strategy/volatility/bollingerBandsStrategy.ts b/src/strategy/volatility/bollingerBandsStrategy.ts index 5038ab0..9de2db0 100644 --- a/src/strategy/volatility/bollingerBandsStrategy.ts +++ b/src/strategy/volatility/bollingerBandsStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {bollingerBands} from '../../indicator/volatility/bollingerBands'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { bollingerBands } from '../../indicator/volatility/bollingerBands'; /** * Bollinger bands strategy function. diff --git a/src/strategy/volatility/projectionOscillatorStrategy.ts b/src/strategy/volatility/projectionOscillatorStrategy.ts index 2421f18..6582a11 100644 --- a/src/strategy/volatility/projectionOscillatorStrategy.ts +++ b/src/strategy/volatility/projectionOscillatorStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {Asset} from '../asset'; -import {Action} from '../action'; -import {defaultProjectionOscillator} from '../../indicator/volatility/projectionOscillator'; +import { Asset } from '../asset'; +import { Action } from '../action'; +import { defaultProjectionOscillator } from '../../indicator/volatility/projectionOscillator'; /** * Projection oscillator strategy function. @@ -13,9 +13,9 @@ import {defaultProjectionOscillator} from '../../indicator/volatility/projection */ export function projectionOscillatorStrategy(asset: Asset): Action[] { const po = defaultProjectionOscillator( - asset.highs, - asset.lows, - asset.closings, + asset.highs, + asset.lows, + asset.closings ); const actions = new Array(po.po.length); diff --git a/src/strategy/volume/chaikinMoneyFlowStrategy.ts b/src/strategy/volume/chaikinMoneyFlowStrategy.ts index ef53354..d46d8af 100644 --- a/src/strategy/volume/chaikinMoneyFlowStrategy.ts +++ b/src/strategy/volume/chaikinMoneyFlowStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {chaikinMoneyFlow} from '../../indicator/volume/chaikinMoneyFlow'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { chaikinMoneyFlow } from '../../indicator/volume/chaikinMoneyFlow'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * The chaikin money flow strategy uses the cmf values that are generated @@ -16,10 +16,10 @@ import {Asset} from '../asset'; */ export function chaikinMoneyFlowStrategy(asset: Asset): Action[] { const cmf = chaikinMoneyFlow( - asset.highs, - asset.lows, - asset.closings, - asset.volumes, + asset.highs, + asset.lows, + asset.closings, + asset.volumes ); return cmf.map((value) => { diff --git a/src/strategy/volume/easeOfMovementStrategy.ts b/src/strategy/volume/easeOfMovementStrategy.ts index 902e8fd..dfe254e 100644 --- a/src/strategy/volume/easeOfMovementStrategy.ts +++ b/src/strategy/volume/easeOfMovementStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {defaultEaseOfMovement} from '../../indicator/volume/easeOfMovement'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { defaultEaseOfMovement } from '../../indicator/volume/easeOfMovement'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * Ease of movement strategy. @@ -12,11 +12,7 @@ import {Asset} from '../asset'; * @returns strategy actions. */ export function easeOfMovementStrategy(asset: Asset): Action[] { - const emv = defaultEaseOfMovement( - asset.highs, - asset.lows, - asset.volumes, - ); + const emv = defaultEaseOfMovement(asset.highs, asset.lows, asset.volumes); return emv.map((value) => { if (value > 0) { diff --git a/src/strategy/volume/forceIndexStrategy.ts b/src/strategy/volume/forceIndexStrategy.ts index 10a1c4a..0ddbe74 100644 --- a/src/strategy/volume/forceIndexStrategy.ts +++ b/src/strategy/volume/forceIndexStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {defaultForceIndex} from '../../indicator/volume/forceIndex'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { defaultForceIndex } from '../../indicator/volume/forceIndex'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * Force index strategy function. @@ -12,10 +12,7 @@ import {Asset} from '../asset'; * @returns strategy actions. */ export function forceIndexStrategy(asset: Asset): Action[] { - const fi = defaultForceIndex( - asset.closings, - asset.volumes, - ); + const fi = defaultForceIndex(asset.closings, asset.volumes); return fi.map((value) => { if (value > 0) { diff --git a/src/strategy/volume/moneyFlowIndexStrategy.ts b/src/strategy/volume/moneyFlowIndexStrategy.ts index 3f4733c..8277cd7 100644 --- a/src/strategy/volume/moneyFlowIndexStrategy.ts +++ b/src/strategy/volume/moneyFlowIndexStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {defaultMoneyFlowIndex} from '../../indicator/volume/moneyFlowIndex'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { defaultMoneyFlowIndex } from '../../indicator/volume/moneyFlowIndex'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * Money flow index strategy. @@ -13,10 +13,10 @@ import {Asset} from '../asset'; */ export function moneyFlowIndexStrategy(asset: Asset): Action[] { const mfi = defaultMoneyFlowIndex( - asset.highs, - asset.lows, - asset.closings, - asset.volumes, + asset.highs, + asset.lows, + asset.closings, + asset.volumes ); return mfi.map((value) => { diff --git a/src/strategy/volume/negativeVolumeIndexStrategy.ts b/src/strategy/volume/negativeVolumeIndexStrategy.ts index d8270b8..4716530 100644 --- a/src/strategy/volume/negativeVolumeIndexStrategy.ts +++ b/src/strategy/volume/negativeVolumeIndexStrategy.ts @@ -1,10 +1,13 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {ema} from '../../indicator/trend/ema'; -import {negativeVolumeIndex, NVI_DEFAULT_PERIOD} from '../../indicator/volume/negativeVolumeIndex'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { ema } from '../../indicator/trend/ema'; +import { + negativeVolumeIndex, + NVI_DEFAULT_PERIOD, +} from '../../indicator/volume/negativeVolumeIndex'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * The negative volume index strategy uses the nvi values that are generated by @@ -16,10 +19,7 @@ import {Asset} from '../asset'; * @returns strategy actions. */ export function negativeVolumeIndexStrategy(asset: Asset): Action[] { - const nvi = negativeVolumeIndex( - asset.closings, - asset.volumes, - ); + const nvi = negativeVolumeIndex(asset.closings, asset.volumes); const nvi255 = ema(NVI_DEFAULT_PERIOD, nvi); diff --git a/src/strategy/volume/volumeWeightedAveragePriceStrategy.ts b/src/strategy/volume/volumeWeightedAveragePriceStrategy.ts index 5e5e773..21414fb 100644 --- a/src/strategy/volume/volumeWeightedAveragePriceStrategy.ts +++ b/src/strategy/volume/volumeWeightedAveragePriceStrategy.ts @@ -1,10 +1,10 @@ // Copyright (c) 2022 Onur Cinar. All Rights Reserved. // https://github.com/cinar/indicatorts -import {substract} from '../../helper/numArray'; -import {defaultVolumeWeightedAveragePrice} from '../../indicator/volume/volumeWeightedAveragePrice'; -import {Action} from '../action'; -import {Asset} from '../asset'; +import { substract } from '../../helper/numArray'; +import { defaultVolumeWeightedAveragePrice } from '../../indicator/volume/volumeWeightedAveragePrice'; +import { Action } from '../action'; +import { Asset } from '../asset'; /** * Volume weighted average price strategy uses the values that are generated @@ -16,10 +16,7 @@ import {Asset} from '../asset'; * @returns strategy actions. */ export function volumeWeightedAveragePriceStrategy(asset: Asset): Action[] { - const vwap = defaultVolumeWeightedAveragePrice( - asset.closings, - asset.volumes, - ); + const vwap = defaultVolumeWeightedAveragePrice(asset.closings, asset.volumes); const diff = substract(vwap, asset.closings); diff --git a/tsconfig.json b/tsconfig.json index eb6d95f..269de50 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -24,7 +24,7 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ /* Modules */ - "module": "esnext", /* Specify what module code is generated. */ + "module": "esnext" /* Specify what module code is generated. */, // "rootDir": "./", /* Specify the root folder within your source files. */ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ @@ -42,7 +42,7 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ @@ -69,12 +69,12 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ @@ -96,6 +96,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ } }