├── .editorconfig ├── .gcloudignore ├── .gitignore ├── .jshintrc ├── Dockerfile ├── LICENSE ├── README.md ├── angular.json ├── app.yaml ├── e2e ├── app.e2e-spec.ts ├── app.po.ts └── tsconfig.e2e.json ├── ecosystem.config.js ├── init ├── karma.conf.js ├── notes.txt ├── package-lock.json ├── package.json ├── protractor.conf.js ├── server-tests.js ├── server ├── .jshintrc ├── api │ ├── backtest │ │ ├── algo.service.ts │ │ ├── backtest-aggregation.service.ts │ │ ├── backtest.constants.ts │ │ ├── backtest.controller.ts │ │ ├── backtest.router.js │ │ ├── backtest.service.ts │ │ ├── bband-breakout.service.ts │ │ ├── daytrade-recommendations.ts │ │ ├── index.js │ │ └── mfi.service.ts │ ├── bonds │ │ ├── bonds.controller.ts │ │ ├── bonds.service.ts │ │ └── index.ts │ ├── machine-learning │ │ ├── daily-prediction.service.ts │ │ ├── index.ts │ │ ├── intraday-prediction.service.ts │ │ ├── machine-learning.controller.ts │ │ ├── pattern-finder.service.ts │ │ ├── prediction.service.ts │ │ ├── training.service.ts │ │ └── variable-daily-prediction.service.ts │ ├── mean-reversion │ │ ├── index.js │ │ ├── reversion-decision.service.js │ │ ├── reversion.controller.js │ │ ├── reversion.router.js │ │ └── reversion.service.js │ ├── options │ │ ├── index.ts │ │ ├── options.controller.ts │ │ └── options.service.ts │ ├── portfolio │ │ ├── index.js │ │ ├── portfolio.controller.ts │ │ ├── portfolio.router.js │ │ └── portfolio.service.ts │ ├── quote │ │ ├── index.js │ │ ├── quote.controller.ts │ │ ├── quote.model.json │ │ ├── quote.router.js │ │ └── quote.service.js │ ├── sms │ │ ├── index.ts │ │ ├── server-sms.controller.ts │ │ └── server-sms.service.ts │ ├── stock-info │ │ ├── index.ts │ │ ├── stock-info.controller.ts │ │ └── stock-info.service.ts │ ├── technical-analysis │ │ ├── technical-analysis.service.spec.js │ │ ├── technical-analysis.service.ts │ │ ├── zscore.service.spec.js │ │ └── zscore.service.ts │ └── templates │ │ └── base.controller.js ├── app.js ├── components │ └── errors │ │ └── baseErrors.js ├── config │ ├── environment │ │ ├── development.js │ │ ├── index.js │ │ └── production.js │ └── express.js ├── routes.js └── tsconfig.json ├── spec └── support │ └── jasmine.json ├── src ├── app │ ├── ai-picks │ │ ├── ai-picks.component.css │ │ ├── ai-picks.component.html │ │ ├── ai-picks.component.spec.ts │ │ └── ai-picks.component.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── app.routes.ts │ ├── auth.guard.spec.ts │ ├── auth.guard.ts │ ├── auto-backtest-switch │ │ ├── auto-backtest-switch.component.css │ │ ├── auto-backtest-switch.component.html │ │ ├── auto-backtest-switch.component.spec.ts │ │ └── auto-backtest-switch.component.ts │ ├── autopilot │ │ ├── autopilot-service.service.spec.ts │ │ ├── autopilot-service.service.ts │ │ ├── autopilot.component.css │ │ ├── autopilot.component.html │ │ ├── autopilot.component.spec.ts │ │ └── autopilot.component.ts │ ├── backtest-table │ │ ├── backtest-table.component.css │ │ ├── backtest-table.component.html │ │ ├── backtest-table.component.spec.ts │ │ ├── backtest-table.component.ts │ │ ├── backtest-table.service.spec.ts │ │ └── backtest-table.service.ts │ ├── bb-card │ │ ├── bb-card.component.css │ │ ├── bb-card.component.html │ │ ├── bb-card.component.spec.ts │ │ └── bb-card.component.ts │ ├── bulk-backtest │ │ ├── bulk-backtest.component.css │ │ ├── bulk-backtest.component.html │ │ ├── bulk-backtest.component.spec.ts │ │ ├── bulk-backtest.component.ts │ │ └── index.ts │ ├── chart-dialog │ │ ├── chart-dialog.component.css │ │ ├── chart-dialog.component.html │ │ ├── chart-dialog.component.spec.ts │ │ └── chart-dialog.component.ts │ ├── confirm-dialog │ │ ├── confirm-dialog.component.css │ │ ├── confirm-dialog.component.html │ │ ├── confirm-dialog.component.spec.ts │ │ └── confirm-dialog.component.ts │ ├── daytrade-score-board │ │ ├── daytrade-score-board.component.css │ │ ├── daytrade-score-board.component.html │ │ ├── daytrade-score-board.component.spec.ts │ │ └── daytrade-score-board.component.ts │ ├── default-order-lists │ │ ├── default-order-lists.component.html │ │ ├── default-order-lists.component.scss │ │ ├── default-order-lists.component.spec.ts │ │ └── default-order-lists.component.ts │ ├── determine-hedge │ │ ├── determine-hedge.component.css │ │ ├── determine-hedge.component.html │ │ ├── determine-hedge.component.spec.ts │ │ └── determine-hedge.component.ts │ ├── easy-orders-editor │ │ ├── easy-orders-editor.component.css │ │ ├── easy-orders-editor.component.html │ │ ├── easy-orders-editor.component.spec.ts │ │ └── easy-orders-editor.component.ts │ ├── find-buy │ │ ├── find-buy.component.css │ │ ├── find-buy.component.html │ │ ├── find-buy.component.spec.ts │ │ └── find-buy.component.ts │ ├── header │ │ ├── header.component.css │ │ ├── header.component.html │ │ ├── header.component.spec.ts │ │ └── header.component.ts │ ├── intraday-backtest-view │ │ ├── intraday-backtest-stocks.constant.ts │ │ ├── intraday-backtest-view.component.css │ │ ├── intraday-backtest-view.component.html │ │ ├── intraday-backtest-view.component.spec.ts │ │ └── intraday-backtest-view.component.ts │ ├── login-dialog │ │ ├── login-dialog.component.css │ │ ├── login-dialog.component.html │ │ ├── login-dialog.component.spec.ts │ │ └── login-dialog.component.ts │ ├── login │ │ ├── login.component.css │ │ ├── login.component.html │ │ ├── login.component.spec.ts │ │ └── login.component.ts │ ├── machine-daytrading │ │ ├── machine-daytrading.module.ts │ │ ├── machine-daytrading.service.spec.ts │ │ └── machine-daytrading.service.ts │ ├── machine-learning │ │ ├── ask-model │ │ │ ├── ask-model.component.css │ │ │ ├── ask-model.component.html │ │ │ ├── ask-model.component.spec.ts │ │ │ └── ask-model.component.ts │ │ ├── machine-learning-page │ │ │ ├── machine-learning-page.component.css │ │ │ ├── machine-learning-page.component.html │ │ │ ├── machine-learning-page.component.spec.ts │ │ │ └── machine-learning-page.component.ts │ │ ├── machine-learning.module.ts │ │ ├── ml-timeperiods │ │ │ ├── ml-timeperiods.component.css │ │ │ ├── ml-timeperiods.component.html │ │ │ ├── ml-timeperiods.component.spec.ts │ │ │ └── ml-timeperiods.component.ts │ │ ├── precog │ │ │ ├── precog.component.css │ │ │ ├── precog.component.html │ │ │ ├── precog.component.spec.ts │ │ │ └── precog.component.ts │ │ └── timeline-view │ │ │ ├── timeline-view.component.css │ │ │ ├── timeline-view.component.html │ │ │ ├── timeline-view.component.spec.ts │ │ │ └── timeline-view.component.ts │ ├── mini-card │ │ ├── mini-card.component.html │ │ ├── mini-card.component.scss │ │ ├── mini-card.component.spec.ts │ │ └── mini-card.component.ts │ ├── ml-batch-card │ │ ├── ml-batch-card.component.css │ │ ├── ml-batch-card.component.html │ │ ├── ml-batch-card.component.spec.ts │ │ └── ml-batch-card.component.ts │ ├── ml-card │ │ ├── ml-card.component.css │ │ ├── ml-card.component.html │ │ ├── ml-card.component.spec.ts │ │ └── ml-card.component.ts │ ├── neuro-card │ │ ├── neuro-card.component.css │ │ ├── neuro-card.component.html │ │ ├── neuro-card.component.spec.ts │ │ └── neuro-card.component.ts │ ├── options-view │ │ ├── options-view.component.css │ │ ├── options-view.component.html │ │ ├── options-view.component.spec.ts │ │ └── options-view.component.ts │ ├── order-dialog │ │ ├── order-dialog.component.css │ │ ├── order-dialog.component.html │ │ ├── order-dialog.component.spec.ts │ │ └── order-dialog.component.ts │ ├── orders-list │ │ ├── orders-list.component.css │ │ ├── orders-list.component.html │ │ ├── orders-list.component.spec.ts │ │ └── orders-list.component.ts │ ├── overview │ │ ├── overview.component.css │ │ ├── overview.component.html │ │ ├── overview.component.spec.ts │ │ ├── overview.component.ts │ │ ├── overview.module.ts │ │ └── todo-list │ │ │ ├── todo-list.component.css │ │ │ ├── todo-list.component.html │ │ │ ├── todo-list.component.spec.ts │ │ │ ├── todo-list.component.ts │ │ │ ├── todo.service.spec.ts │ │ │ └── todo.service.ts │ ├── pie-alloct │ │ ├── pie-alloct.component.css │ │ ├── pie-alloct.component.html │ │ ├── pie-alloct.component.spec.ts │ │ └── pie-alloct.component.ts │ ├── pokerhand │ │ ├── pokerhand.component.html │ │ ├── pokerhand.component.scss │ │ ├── pokerhand.component.spec.ts │ │ └── pokerhand.component.ts │ ├── portfolio-info │ │ ├── portfolio-info.component.html │ │ ├── portfolio-info.component.scss │ │ ├── portfolio-info.component.spec.ts │ │ └── portfolio-info.component.ts │ ├── portfolio-management │ │ ├── portfolio-management.component.css │ │ ├── portfolio-management.component.html │ │ ├── portfolio-management.component.spec.ts │ │ └── portfolio-management.component.ts │ ├── product-view │ │ ├── product-view.component.css │ │ ├── product-view.component.html │ │ ├── product-view.component.spec.ts │ │ └── product-view.component.ts │ ├── redirect-login-dialog │ │ ├── redirect-login-dialog.component.css │ │ ├── redirect-login-dialog.component.html │ │ ├── redirect-login-dialog.component.spec.ts │ │ └── redirect-login-dialog.component.ts │ ├── reporting │ │ ├── report-dialog.component.html │ │ ├── reporting.component.css │ │ ├── reporting.component.html │ │ ├── reporting.component.spec.ts │ │ └── reporting.component.ts │ ├── research-view │ │ ├── research-view.component.css │ │ ├── research-view.component.html │ │ ├── research-view.component.spec.ts │ │ └── research-view.component.ts │ ├── rh-input │ │ ├── rh-input.component.css │ │ ├── rh-input.component.html │ │ ├── rh-input.component.spec.ts │ │ └── rh-input.component.ts │ ├── rh-table │ │ ├── backtest-stocks.constant.ts │ │ ├── index.ts │ │ ├── rh-table.component.html │ │ ├── rh-table.component.scss │ │ ├── rh-table.component.spec.ts │ │ ├── rh-table.component.ts │ │ └── stock-list.constant.ts │ ├── score-board │ │ ├── score-board.component.css │ │ ├── score-board.component.html │ │ ├── score-board.component.spec.ts │ │ └── score-board.component.ts │ ├── settings │ │ ├── global-settings.service.spec.ts │ │ ├── global-settings.service.ts │ │ ├── setting-controls │ │ │ ├── setting-controls.component.css │ │ │ ├── setting-controls.component.html │ │ │ ├── setting-controls.component.spec.ts │ │ │ └── setting-controls.component.ts │ │ └── settings.module.ts │ ├── shared │ │ ├── account.ts │ │ ├── algo-param.interface.ts │ │ ├── daily-backtest.service.spec.ts │ │ ├── daily-backtest.service.ts │ │ ├── enums │ │ │ ├── daytrade-algorithms.enum.ts │ │ │ └── order-pref.enum.ts │ │ ├── index.ts │ │ ├── models │ │ │ ├── algo-chart-v2.ts │ │ │ ├── card-options.ts │ │ │ ├── holding.interface.ts │ │ │ ├── index.ts │ │ │ ├── indicators.ts │ │ │ ├── order-row.ts │ │ │ ├── order.ts │ │ │ ├── service-status.ts │ │ │ ├── smart-order.ts │ │ │ ├── stock-score.ts │ │ │ ├── trade.ts │ │ │ └── winloss.ts │ │ ├── options-data.service.spec.ts │ │ ├── options-data.service.ts │ │ ├── pipes │ │ │ ├── instrument.pipe.spec.ts │ │ │ └── instrument.pipe.ts │ │ ├── row.interface.ts │ │ ├── service │ │ │ ├── scheduler.service.spec.ts │ │ │ └── scheduler.service.ts │ │ ├── services │ │ │ ├── ai-picks.service.spec.ts │ │ │ ├── ai-picks.service.ts │ │ │ ├── algo.service.spec.ts │ │ │ ├── algo.service.ts │ │ │ ├── authentication.service.spec.ts │ │ │ ├── authentication.service.ts │ │ │ ├── backtest.service.spec.ts │ │ │ ├── backtest.service.ts │ │ │ ├── cart.service.spec.ts │ │ │ ├── cart.service.ts │ │ │ ├── client-sms.service.spec.ts │ │ │ ├── client-sms.service.ts │ │ │ ├── daytrade-manager.service.spec.ts │ │ │ ├── daytrade-manager.service.ts │ │ │ ├── daytrade.service.spec.ts │ │ │ ├── daytrade.service.ts │ │ │ ├── excel-service.service.spec.ts │ │ │ ├── excel-service.service.ts │ │ │ ├── global-task-queue.service.spec.ts │ │ │ ├── global-task-queue.service.ts │ │ │ ├── index.ts │ │ │ ├── indicators.service.spec.ts │ │ │ ├── indicators.service.ts │ │ │ ├── local-preferences.service.spec.ts │ │ │ ├── local-preferences.service.ts │ │ │ ├── machine-learning │ │ │ │ ├── machine-learning.service.spec.ts │ │ │ │ └── machine-learning.service.ts │ │ │ ├── ordering.service.spec.ts │ │ │ ├── ordering.service.ts │ │ │ ├── portfolio.service.spec.ts │ │ │ ├── portfolio.service.ts │ │ │ ├── reporting.service.spec.ts │ │ │ ├── reporting.service.ts │ │ │ ├── score-keeper.service.spec.ts │ │ │ ├── score-keeper.service.ts │ │ │ ├── score-signal-factory.service.spec.ts │ │ │ ├── score-signal-factory.service.ts │ │ │ ├── trade.service.spec.ts │ │ │ └── trade.service.ts │ │ ├── shared.module.ts │ │ └── stock.interface.ts │ ├── shopping-list │ │ ├── shopping-list.component.css │ │ ├── shopping-list.component.html │ │ ├── shopping-list.component.spec.ts │ │ └── shopping-list.component.ts │ ├── simple-card │ │ ├── simple-card.component.css │ │ ├── simple-card.component.html │ │ ├── simple-card.component.spec.ts │ │ └── simple-card.component.ts │ ├── sms-card │ │ ├── sms-card.component.css │ │ ├── sms-card.component.html │ │ ├── sms-card.component.spec.ts │ │ └── sms-card.component.ts │ ├── stocklist-cleanup │ │ ├── stocklist-cleanup.component.css │ │ ├── stocklist-cleanup.component.html │ │ ├── stocklist-cleanup.component.spec.ts │ │ └── stocklist-cleanup.component.ts │ ├── stocklist │ │ ├── stocklist.component.css │ │ ├── stocklist.component.html │ │ ├── stocklist.component.spec.ts │ │ └── stocklist.component.ts │ ├── strategies │ │ ├── find-pattern.service.spec.ts │ │ └── find-pattern.service.ts │ ├── terminal-view │ │ ├── terminal-view.component.css │ │ ├── terminal-view.component.html │ │ ├── terminal-view.component.spec.ts │ │ └── terminal-view.component.ts │ ├── test-results-table │ │ ├── test-results-table.component.css │ │ ├── test-results-table.component.html │ │ ├── test-results-table.component.spec.ts │ │ └── test-results-table.component.ts │ ├── trade-view │ │ ├── trade-view.component.html │ │ ├── trade-view.component.scss │ │ ├── trade-view.component.spec.ts │ │ └── trade-view.component.ts │ ├── watch-list │ │ ├── watch-list.component.css │ │ ├── watch-list.component.html │ │ ├── watch-list.component.spec.ts │ │ ├── watch-list.component.ts │ │ ├── watch-list.service.spec.ts │ │ └── watch-list.service.ts │ └── xls-import │ │ ├── xls-import.component.css │ │ ├── xls-import.component.html │ │ ├── xls-import.component.spec.ts │ │ └── xls-import.component.ts ├── assets │ ├── .gitkeep │ ├── bear.png │ └── bull.png ├── bootstrap.min.css ├── environments │ ├── client-config.ts │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── robinhood-merchant-theme.scss ├── styles.css ├── td req.json ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json └── typings.d.ts ├── station-client.bat ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gcloudignore: -------------------------------------------------------------------------------- 1 | # This file specifies files that are *not* uploaded to Google Cloud 2 | # using gcloud. It follows the same syntax as .gitignore, with the addition of 3 | # "#!include" directives (which insert the entries of the given .gitignore-style 4 | # file at that point). 5 | # 6 | # For more information, run: 7 | # $ gcloud topic gcloudignore 8 | # 9 | .gcloudignore 10 | # If you would like to upload your .git directory, .gitignore file or files 11 | # from your .gitignore file, remove the corresponding line 12 | # below: 13 | .git 14 | .gitignore 15 | 16 | # Node.js dependencies: 17 | node_modules/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | testem.log 34 | /typings 35 | 36 | # e2e 37 | /e2e/*.js 38 | /e2e/*.map 39 | 40 | # System Files 41 | .DS_Store 42 | Thumbs.db 43 | .vscode/settings.json 44 | server/config/environment/credentials.js 45 | 46 | server/config/environment/credentials\.ts 47 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "boss": true, 3 | "node": true, 4 | "eqeqeq": true, 5 | "strict": true, 6 | "newcap": false, 7 | "undef": true, 8 | "unused": true, 9 | "onecase": true, 10 | "lastsemic": true 11 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | FROM node:18-alpine 4 | WORKDIR /dist/app 5 | COPY . . 6 | RUN npm install && npm run build 7 | CMD ["node", "dist/app.js"] 8 | EXPOSE 9000 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE -------------------------------------------------------------------------------- /app.yaml: -------------------------------------------------------------------------------- 1 | runtime: nodejs16 2 | env_variables: 3 | CLIENT_ID: "0033" -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('robinhood-merchant App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | xit('createshould display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ecosystem.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apps: [ 3 | { 4 | name: "trader-main", 5 | script: "dist/app.js", 6 | instances: 1, 7 | exec_mode: "fork", 8 | watch: false 9 | }, 10 | ], 11 | deploy: { 12 | production: { 13 | user: "YOUR_SSH_USERNAME_HERE", 14 | host: "YOUR_SSH_HOST_ADDRESS", 15 | ref: "YOUR_GIT_BRANCH_REF (eg: origin/master)", 16 | repo: "GIT_REPOSITORY", 17 | path: "YOUR_DESTINATION_PATH_ON_SERVER", 18 | "pre-deploy-local": "", 19 | "post-deploy":"npm install && pm2 reload ecosystem.config.js --env production", 20 | "pre-setup": "", 21 | }, 22 | }, 23 | }; -------------------------------------------------------------------------------- /init: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/init -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /server-tests.js: -------------------------------------------------------------------------------- 1 | var Jasmine = require('jasmine'); 2 | var jasmine = new Jasmine(); 3 | 4 | jasmine.loadConfigFile('spec/support/jasmine.json'); 5 | jasmine.configureDefaultReporter({ 6 | showColors: false 7 | }); 8 | jasmine.execute(); 9 | -------------------------------------------------------------------------------- /server/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "eqeqeq": true, 6 | "immed": true, 7 | "latedef": "nofunc", 8 | "newcap": true, 9 | "noarg": true, 10 | "regexp": true, 11 | "undef": true, 12 | "smarttabs": true, 13 | "asi": true, 14 | "debug": true 15 | } 16 | -------------------------------------------------------------------------------- /server/api/backtest/backtest.constants.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface Recommendation { 3 | name?: string, 4 | time?: string, 5 | recommendation: OrderType; 6 | mfi?: DaytradeRecommendation; 7 | roc?: DaytradeRecommendation; 8 | bband?: DaytradeRecommendation; 9 | vwma?: DaytradeRecommendation; 10 | mfiTrade?: DaytradeRecommendation; 11 | macd?: DaytradeRecommendation; 12 | demark9?: DaytradeRecommendation; 13 | mfiLow?: DaytradeRecommendation; 14 | mfiDivergence?: DaytradeRecommendation; 15 | mfiDivergence2?: DaytradeRecommendation; 16 | overboughtMomentum?: DaytradeRecommendation; 17 | data?: any; 18 | bbandBreakout?: DaytradeRecommendation; 19 | } 20 | 21 | export enum DaytradeRecommendation { 22 | Bullish = 'Bullish', 23 | Bearish = 'Bearish', 24 | Neutral = 'Neutral' 25 | } 26 | 27 | export enum OrderType { 28 | Buy = 'Buy', 29 | Sell = 'Sell', 30 | None = 'None' 31 | } 32 | 33 | export interface Indicators { 34 | vwma: number; 35 | mfiLeft: number; 36 | bband80: any[]; 37 | mfiPrevious?: number; 38 | macd?: any; 39 | roc10?: number; 40 | roc10Previous?: number; 41 | roc70?: number; 42 | roc70Previous?: number; 43 | close?: number; 44 | recommendation?: Recommendation; 45 | action?: string; 46 | date?: string; 47 | demark9?: any; 48 | mfiLow?: number; 49 | high?: number; 50 | low?: number; 51 | mfiTrend?: boolean; 52 | macdPrevious?: any; 53 | bbandBreakout?: boolean; 54 | rsi?: number; 55 | } -------------------------------------------------------------------------------- /server/api/backtest/backtest.router.js: -------------------------------------------------------------------------------- 1 | import BacktestController from './backtest.controller'; 2 | 3 | export let backtest = (request, response) => { 4 | BacktestController.backtest(request, response); 5 | }; 6 | 7 | export let getMeanReversionChart = (request, response) => { 8 | BacktestController.getMeanReversionChart(request, response); 9 | }; 10 | 11 | export let indicator = (request, response) => { 12 | BacktestController.getIndicator(request, response); 13 | }; 14 | 15 | export let bollingerBands = (request, response) => { 16 | BacktestController.getBollingerBands(request, response); 17 | }; 18 | 19 | export let infoV2 = (request, response) => { 20 | BacktestController.getInfoV2(request, response); 21 | }; 22 | 23 | export let infoV2Chart = (request, response) => { 24 | BacktestController.getInfoV2Chart(request, response); 25 | }; 26 | 27 | export let timeline = (request, response) => { 28 | BacktestController.getHistoricalMatches(request, response); 29 | }; 30 | 31 | export let sma = (request, response) => { 32 | BacktestController.getSMA(request, response); 33 | }; 34 | 35 | export let roc = (request, response) => { 36 | BacktestController.getRateOfChange(request, response); 37 | }; 38 | 39 | export let mfi = (request, response) => { 40 | BacktestController.getMfi(request, response); 41 | }; 42 | 43 | export let vwma = (request, response) => { 44 | BacktestController.getVwma(request, response); 45 | }; 46 | -------------------------------------------------------------------------------- /server/api/backtest/bband-breakout.service.ts: -------------------------------------------------------------------------------- 1 | import * as _ from 'lodash'; 2 | import * as tulind from 'tulind'; 3 | 4 | class BBandBreakoutService { 5 | async isBreakout(quotes, previousMfi: number, currentMfi: number, currentBBand, bbandPeriod) { 6 | if (previousMfi < 16 && currentMfi > previousMfi){ 7 | const previousBband = await this.getBBands(quotes.slice(1, -1), bbandPeriod, 2); 8 | console.log('previousBband', previousBband); 9 | console.log('currentBBand', currentBBand); 10 | console.log('currentMfi', currentMfi); 11 | console.log('previousMfi', previousMfi); 12 | 13 | } 14 | return false; 15 | } 16 | 17 | getBBands(real, period, stddev) { 18 | return tulind.indicators.bbands.indicator([real], [period, stddev]); 19 | } 20 | } 21 | 22 | export default new BBandBreakoutService(); 23 | -------------------------------------------------------------------------------- /server/api/backtest/mfi.service.ts: -------------------------------------------------------------------------------- 1 | import * as _ from 'lodash'; 2 | import * as tulind from 'tulind'; 3 | 4 | class MfiService { 5 | async getMfiLow(highs: number[], 6 | lows: number[], 7 | reals: number[], 8 | volumes: number[], 9 | period: number) { 10 | let mfiLow = 30; 11 | if (period > volumes.length) { 12 | period = volumes.length - 1; 13 | } 14 | for (let i = 1; i < volumes.length - period; i++) { 15 | const highSubarray = highs.slice(i - 1, i + period); 16 | const lowSubarray = lows.slice(i - 1, i + period); 17 | const realSubarray = reals.slice(i - 1, i + period); 18 | const volumeSubarray = volumes.slice(i - 1, i + period); 19 | const mfi = await this.getMfi(highSubarray, lowSubarray, realSubarray, volumeSubarray, period); 20 | const mfiLeft = _.round(mfi[0][mfi[0].length - 1], 3); 21 | if (mfiLeft < mfiLow) { 22 | mfiLow = mfiLeft; 23 | } 24 | } 25 | 26 | return mfiLow; 27 | } 28 | 29 | getMfi(high, low, close, volume, period) { 30 | return tulind.indicators.mfi.indicator([high, low, close, volume], [period]); 31 | } 32 | } 33 | 34 | export default new MfiService(); 35 | -------------------------------------------------------------------------------- /server/api/bonds/bonds.controller.ts: -------------------------------------------------------------------------------- 1 | import * as _ from 'lodash'; 2 | 3 | import BaseController from '../templates/base.controller'; 4 | 5 | import BondsService from './bonds.service'; 6 | 7 | class BondsController extends BaseController { 8 | constructor() { 9 | super(); 10 | } 11 | 12 | getSpreadData(request, response) { 13 | BondsService.get10y2ySpread() 14 | .then((data) => BaseController.requestGetSuccessHandler(response, data)) 15 | .catch((err) => BaseController.requestErrorHandler(response, err)); 16 | } 17 | } 18 | 19 | export default new BondsController(); 20 | -------------------------------------------------------------------------------- /server/api/bonds/bonds.service.ts: -------------------------------------------------------------------------------- 1 | import * as RequestPromise from 'request-promise'; 2 | 3 | const dataUrl = 'https://quote.cnbc.com/quote-html-webservice/quote.htm'; 4 | 5 | class BondsService { 6 | get10y2ySpread() { 7 | const url = `${dataUrl}`; 8 | 9 | const options = { 10 | method: 'GET', 11 | uri: url, 12 | qs: { 13 | symbols: '10Y2YS', 14 | partnerId: 2, 15 | requestMethod: 'quick', 16 | exthrs: 1, 17 | noform: 1, 18 | fund: 1, 19 | output: 'jsonp', 20 | events: 1, 21 | '-': 'c8146822', 22 | callback: 'quoteHandler1' 23 | }, 24 | }; 25 | 26 | return RequestPromise(options) 27 | .then((data) => { 28 | data = data.replace('quoteHandler1(', ''); 29 | data = data.replace('})', '}'); 30 | return JSON.parse(data); 31 | }); 32 | } 33 | } 34 | 35 | export default new BondsService(); 36 | -------------------------------------------------------------------------------- /server/api/bonds/index.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import BondsController from './bonds.controller'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/10y2yspread', BondsController.getSpreadData); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /server/api/mean-reversion/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | import ReversionController from './reversion.controller'; 5 | 6 | router.post('/', ReversionController.getAlgoData); 7 | router.post('/backtest', ReversionController.runBacktest); 8 | router.post('/info', ReversionController.runBacktestQuick); 9 | 10 | module.exports = router; 11 | -------------------------------------------------------------------------------- /server/api/mean-reversion/reversion.router.js: -------------------------------------------------------------------------------- 1 | import ReversionController from './reversion.controller'; 2 | 3 | exports.reversion = function (req, res, next) { 4 | ReversionController.getAlgoData(req, res); 5 | }; 6 | 7 | exports.backtest = function (req, res, next) { 8 | ReversionController.runBacktest(req, res); 9 | }; 10 | 11 | exports.backtestQuick = function (req, res, next) { 12 | ReversionController.runBacktestQuick(req, res); 13 | }; 14 | 15 | exports.pricing = function (req, res, next) { 16 | ReversionController.getPrice(req, res); 17 | }; 18 | -------------------------------------------------------------------------------- /server/api/options/index.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import OptionsController from './options.controller'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/implied-move', OptionsController.getImpliedMove); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /server/api/options/options.controller.ts: -------------------------------------------------------------------------------- 1 | import BaseController from '../templates/base.controller'; 2 | import optionsService from './options.service'; 3 | 4 | class OptionsController extends BaseController { 5 | 6 | constructor() { 7 | super(); 8 | } 9 | 10 | getImpliedMove(request, response) { 11 | return optionsService.calculateImpliedMove(request.query.accountId, 12 | request.query.symbol.toUpperCase(), 13 | request.query.strikeCount, 14 | request.query.optionType, 15 | request.query.minExpiration, 16 | response) 17 | .then(optionsData => { 18 | response.status(200).send(optionsData); 19 | }) 20 | .catch((err) => BaseController.requestErrorHandler(response, err)); 21 | } 22 | } 23 | 24 | export default new OptionsController(); 25 | -------------------------------------------------------------------------------- /server/api/portfolio/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | import * as handler from './portfolio.router'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/', handler.portfolio); 7 | router.get('/positions', handler.positions); 8 | router.get('/intraday', handler.intraday); 9 | router.get('/v2/intraday', handler.intradayV2); 10 | router.get('/quote', handler.quote); 11 | router.get('/daily-quote', handler.dailyQuote); 12 | router.get('/v2/positions', handler.tdPosition); 13 | router.get('/balance', handler.tdBalance); 14 | router.get('/v3/equity-hours', handler.getEquityMarketHours); 15 | router.post('/login', handler.login); 16 | router.post('/mfa', handler.mfaLogin); 17 | router.post('/logout', handler.logout); 18 | router.post('/resources', handler.getResources); 19 | router.post('/sell', handler.sell); 20 | router.post('/buy', handler.buy); 21 | router.post('/instruments', handler.instruments); 22 | router.post('/v2/buy', handler.tdBuy); 23 | router.post('/v2/sell', handler.tdSell); 24 | router.post('/v3/set-account', handler.setAccount); 25 | router.post('/v3/check-account', handler.checkAccount); 26 | router.post('/v3/delete-cred', handler.checkAccount); 27 | router.get('/instrument', handler.getInstrument); 28 | 29 | module.exports = router; 30 | -------------------------------------------------------------------------------- /server/api/quote/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const handler = require('./quote.router'); 3 | 4 | const router = express.Router(); 5 | 6 | router.post('/', handler.quote); 7 | router.post('/current', handler.currentQuote); 8 | router.post('/raw', handler.rawQuote); 9 | router.post('/intraday', handler.intraday); 10 | router.post('/intraday2', handler.intradayv2); 11 | router.post('/historical-intraday', handler.postIntraday); 12 | router.get('/historical-intraday', handler.findIntraday); 13 | router.post('/optionchain', handler.optionChain); 14 | router.post('/intraday-tiingo', handler.intradayTiingo); 15 | 16 | module.exports = router; 17 | -------------------------------------------------------------------------------- /server/api/quote/quote.model.json: -------------------------------------------------------------------------------- 1 | { 2 | "quote": { 3 | "get": { 4 | "query": { 5 | "type": "object", 6 | "properties": { 7 | "symbol": { 8 | "type": "string" 9 | } 10 | }, 11 | "additionalProperties": false, 12 | "required": [ 13 | "symbol" 14 | ] 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/api/quote/quote.router.js: -------------------------------------------------------------------------------- 1 | import QuoteController from './quote.controller'; 2 | /** 3 | * Get quotes 4 | */ 5 | exports.quote = function (req, res, next) { 6 | QuoteController.getQuote(req, res); 7 | }; 8 | 9 | exports.currentQuote = function (req, res, next) { 10 | QuoteController.getCurrentQuote(req, res); 11 | }; 12 | 13 | exports.rawQuote = function (req, res, next) { 14 | QuoteController.getRawData(req, res); 15 | }; 16 | 17 | exports.intraday = function (req, res, next) { 18 | QuoteController.getIntraday(req, res); 19 | }; 20 | 21 | exports.intradayv2 = function (req, res, next) { 22 | QuoteController.getIntradayV2(req, res); 23 | }; 24 | 25 | exports.intradayTiingo = function (req, res, next) { 26 | QuoteController.getTiingoIntraday(req, res); 27 | }; 28 | 29 | exports.postIntraday = function (req, res, next) { 30 | QuoteController.postIntraday(req, res); 31 | }; 32 | 33 | exports.findIntraday = function (req, res) { 34 | QuoteController.findIntraday(req, res); 35 | }; 36 | 37 | exports.companySummary = function (req, res, next) { 38 | QuoteController.getCompanySummary(req, res); 39 | }; 40 | 41 | exports.optionChain = function (req, res, next) { 42 | QuoteController.getOptionChain(req, res); 43 | }; 44 | -------------------------------------------------------------------------------- /server/api/sms/index.ts: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | import ServerSmsController from './server-sms.controller'; 3 | 4 | const router = express.Router(); 5 | 6 | router.post('/buy', ServerSmsController.smsBuy); 7 | router.post('/sell', ServerSmsController.smsSell); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /server/api/sms/server-sms.controller.ts: -------------------------------------------------------------------------------- 1 | import BaseController from '../templates/base.controller'; 2 | import ServerSmsService from './server-sms.service'; 3 | import * as _ from 'lodash'; 4 | 5 | class ServerSmsController extends BaseController { 6 | 7 | constructor() { 8 | super(); 9 | } 10 | 11 | smsBuy(request, response) { 12 | if (_.isNil(request.body.phone) || 13 | _.isNil(request.body.stock)) { 14 | 15 | response.status(400).send(); 16 | } else { 17 | ServerSmsService.sendBuySms(request.body.phone, request.body.stock, request.body.price, request.body.quantity, request.body.message); 18 | response.status(200).send({}); 19 | } 20 | } 21 | 22 | smsSell(request, response) { 23 | if (_.isNil(request.body.phone) || 24 | _.isNil(request.body.stock)) { 25 | response.status(400).send(); 26 | } else { 27 | ServerSmsService.sendSellSms(request.body.phone, request.body.stock, request.body.price, request.body.quantity, request.body.message); 28 | response.status(200).send({}); 29 | } 30 | } 31 | } 32 | 33 | export default new ServerSmsController(); 34 | -------------------------------------------------------------------------------- /server/api/sms/server-sms.service.ts: -------------------------------------------------------------------------------- 1 | import * as configurations from '../../config/environment'; 2 | import * as twilio from 'twilio'; 3 | 4 | const authToken = configurations.twilio.key; 5 | const accountSid = configurations.twilio.id; 6 | const twilioNumber = configurations.twilio.num; 7 | 8 | class ServerSmsService { 9 | 10 | sendSms(phoneNumber: string, buy: boolean, stock: string, price: number, quantity: number, message: string = '') { 11 | const client = twilio(accountSid, authToken); 12 | client.messages.create({ 13 | body: (buy ? 'Buy ' : 'Sell ') + `${quantity} of ${stock} @ ${price}, ${message}`, 14 | to: '' + phoneNumber, // Text this number 15 | from: twilioNumber // From a valid Twilio number 16 | }).then((msg) => console.log('sent sms: ', msg.body)) 17 | .catch((error) => console.log('error sending sms: ', error)); 18 | } 19 | 20 | sendBuySms(phoneNumber: string, stock: string, price: number, quantity: number, message: string = '') { 21 | this.sendSms(phoneNumber, true, stock, price, quantity, message); 22 | } 23 | 24 | sendSellSms(phoneNumber: string, stock: string, price: number, quantity: number, message: string = '') { 25 | this.sendSms(phoneNumber, false, stock, price, quantity, message); 26 | } 27 | } 28 | 29 | export default new ServerSmsService(); 30 | -------------------------------------------------------------------------------- /server/api/stock-info/index.ts: -------------------------------------------------------------------------------- 1 | import * as express from 'express'; 2 | import StockInfoController from './stock-info.controller'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/test', StockInfoController.test); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /server/api/stock-info/stock-info.controller.ts: -------------------------------------------------------------------------------- 1 | import * as _ from 'lodash'; 2 | 3 | import BaseController from '../templates/base.controller'; 4 | 5 | class StockInfoController extends BaseController { 6 | constructor() { 7 | super(); 8 | } 9 | 10 | test() { 11 | 12 | } 13 | } 14 | 15 | export default new StockInfoController(); 16 | -------------------------------------------------------------------------------- /server/api/stock-info/stock-info.service.ts: -------------------------------------------------------------------------------- 1 | import * as RequestPromise from 'request-promise'; 2 | 3 | const dataUrl = 'https://quote.cnbc.com/quote-html-webservice/quote.htm'; 4 | 5 | class StockInfoService { 6 | get10y2ySpread() { 7 | const url = `${dataUrl}`; 8 | 9 | const options = { 10 | method: 'GET', 11 | uri: url, 12 | qs: { 13 | symbols: '10Y2YS', 14 | partnerId: 2, 15 | requestMethod: 'quick', 16 | exthrs: 1, 17 | noform: 1, 18 | fund: 1, 19 | output: 'jsonp', 20 | events: 1, 21 | '-': 'c8146822', 22 | callback: 'quoteHandler1' 23 | }, 24 | }; 25 | 26 | return RequestPromise(options) 27 | .then((data) => { 28 | data = data.replace('quoteHandler1(', ''); 29 | data = data.replace('})', '}'); 30 | return JSON.parse(data); 31 | }); 32 | } 33 | } 34 | 35 | export default new StockInfoService(); 36 | -------------------------------------------------------------------------------- /server/api/technical-analysis/technical-analysis.service.spec.js: -------------------------------------------------------------------------------- 1 | import TechnicalAnalysisService from '../technical-analysis/technical-analysis.service'; 2 | 3 | 4 | describe('Add functionality', () => { 5 | it('test', () => { 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /server/api/technical-analysis/technical-analysis.service.ts: -------------------------------------------------------------------------------- 1 | 2 | class TechnicalAnalysisService { 3 | } 4 | 5 | export default new TechnicalAnalysisService(); 6 | -------------------------------------------------------------------------------- /server/api/technical-analysis/zscore.service.spec.js: -------------------------------------------------------------------------------- 1 | import ZScore from '../technical-analysis/zscore.service'; 2 | 3 | 4 | describe('Zscore', () => { 5 | it('should get correct peak count', () => { 6 | let testData = [1, 1, 1.1, 1, 0.9, 1, 1, 1.1, 1, 0.9, 1, 1.1, 1, 1, 0.9, 1, 1, 1.1, 1, 1, 1, 1, 1.1, 0.9, 1, 1.1, 1, 1, 0.9, 7 | 1, 1.1, 1, 1, 1.1, 1, 0.8, 0.9, 1, 1.2, 0.9, 1, 1, 1.1, 1.2, 1, 1.5, 1, 3, 2, 5, 3, 2, 1, 1, 1, 0.9, 1, 1, 3, 8 | 2.6, 4, 3, 3.2, 2, 1, 1, 0.8, 4, 4, 2, 2.5, 1, 1, 1]; 9 | 10 | let lag = 30; 11 | let threshold = 5; 12 | let influence = 0; 13 | let results = ZScore.calc(testData, lag, threshold, influence); 14 | console.log('results: ', results); 15 | results.signals.forEach((val, idx) => { 16 | console.log(idx, ': ', val); 17 | }) 18 | expect(results.peakCount).toEqual(5); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /server/api/templates/base.controller.js: -------------------------------------------------------------------------------- 1 | const _ = require('lodash'); 2 | const Ajv = require('ajv'); 3 | const Boom = require('boom'); 4 | const errors = require('errors'); 5 | 6 | const ajv = new Ajv({ 7 | v5: true, 8 | allErrors: true, 9 | jsonPointers: true 10 | }); 11 | 12 | export default class BaseController { 13 | 14 | static requestGetSuccessHandler(reply, data) { 15 | reply.status(200).send(data); 16 | } 17 | 18 | static requestErrorHandler(reply, error) { 19 | console.log('Base Error: ', error.message); 20 | if (error && error.error && error.statusCode) { 21 | reply.status(error.statusCode).send(error.error); 22 | } else { 23 | reply.status(Boom.badImplementation().output.statusCode).send(error); 24 | } 25 | reply.end(); 26 | } 27 | 28 | static notFoundErrorHandler(reply, error) { 29 | console.log('Not found Error: ', error); 30 | reply.status(Boom.notFound().output.statusCode).send(Boom.notFound.output); 31 | } 32 | 33 | static UnhandledErrorHandler(error) { 34 | console.log('Unhandled error: ', error); 35 | } 36 | 37 | addSchema(schemaKey, schemaObject) { 38 | ajv.addSchema(schemaObject, schemaKey); 39 | } 40 | 41 | validate(schemaKey, data) { 42 | ajv.validate(schemaKey, data); 43 | return ajv.errors; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /server/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Main application file 3 | */ 4 | 5 | 'use strict'; 6 | 7 | // Set default node environment to development 8 | process.env.NODE_ENV = process.env.NODE_ENV || 'development'; 9 | 10 | process.on('unhandledRejection', (p, reason) => { 11 | console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); // application specific logging, throwing an error, or other logic here 12 | }); 13 | 14 | process.on('uncaughtException', function (exception) { 15 | console.log('uncaughtException', exception); 16 | }); 17 | const express = require('express'); 18 | 19 | const configurations = require('./config/environment'); 20 | 21 | // Setup server 22 | const app = express(); 23 | 24 | app.set('views', __dirname + '/modules') 25 | app.set('view engine', 'html'); 26 | 27 | const server = require('http').createServer(app); 28 | require('./config/express')(app); 29 | require('./routes')(app); 30 | 31 | // Start server 32 | const port = parseInt(process.env.PORT) || configurations.port; 33 | 34 | server.listen(port, configurations.ip, function () { 35 | console.log('Express server listening on %d, in %s mode', configurations.port, app.get('env')); 36 | }); 37 | 38 | // Expose app 39 | exports = module.exports = app; 40 | -------------------------------------------------------------------------------- /server/components/errors/baseErrors.js: -------------------------------------------------------------------------------- 1 | const errors = require('errors'); 2 | 3 | class BaseErrors { 4 | InvalidArgumentsError() { 5 | return errors.create({ 6 | name: 'InvalidArgumentsError', 7 | defaultExplanation: 'Input has invalid value' 8 | }); 9 | } 10 | 11 | NotFoundError() { 12 | return errors.create({ 13 | name: 'NotFoundError', 14 | defaultExplanation: 'Not found' 15 | }); 16 | } 17 | 18 | Http400Error(err) { 19 | return new errors.Http400Error(err); 20 | } 21 | } 22 | 23 | export default new BaseErrors(); 24 | -------------------------------------------------------------------------------- /server/config/environment/development.js: -------------------------------------------------------------------------------- 1 | // Development specific configuration 2 | // ================================== 3 | module.exports = { 4 | 5 | }; 6 | -------------------------------------------------------------------------------- /server/config/environment/production.js: -------------------------------------------------------------------------------- 1 | // Production specific configuration 2 | // ================================= 3 | module.exports = { 4 | // Server IP 5 | ip: process.env.OPENSHIFT_NODEJS_IP || 6 | process.env.IP || 7 | undefined, 8 | 9 | // Server port 10 | port: process.env.OPENSHIFT_NODEJS_PORT || 11 | process.env.PORT || 12 | 8080 13 | }; 14 | -------------------------------------------------------------------------------- /server/config/express.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Express configuration 3 | */ 4 | const express = require('express'); 5 | const favicon = require('serve-favicon'); 6 | const morgan = require('morgan'); 7 | const compression = require('compression'); 8 | const bodyParser = require('body-parser'); 9 | const methodOverride = require('method-override'); 10 | const cookieParser = require('cookie-parser'); 11 | const errorHandler = require('errorhandler'); 12 | const path = require('path'); 13 | const configurations = require('./environment'); 14 | 15 | 16 | module.exports = function(app) { 17 | const env = app.get('env'); 18 | 19 | app.set('views', configurations.root + '/server/views'); 20 | app.set('view engine', 'html'); 21 | app.use(compression()); 22 | app.use(bodyParser.json({limit: '50mb'})); 23 | app.use(bodyParser.urlencoded({ extended: true, limit: '50mb' })); 24 | app.use(methodOverride()); 25 | app.use(cookieParser()); 26 | 27 | if ('production' === env) { 28 | app.use(express.static(path.join(configurations.root, 'dist/public'))); 29 | app.set('appPath', 'dist/public'); 30 | app.use(morgan('dev')); 31 | app.use(errorHandler()); // Error handler - has to be last 32 | } 33 | 34 | if ('development' === env || 'test' === env) { 35 | app.use(express.static(path.join(configurations.root, 'dist/public'))); 36 | app.set('appPath', 'dist/public'); 37 | app.use(morgan('dev')); 38 | app.use(errorHandler()); // Error handler - has to be last 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /server/routes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Main application routes 3 | */ 4 | const express = require('express'); 5 | const path = require('path'); 6 | 7 | module.exports = function(app) { 8 | // Insert routes below 9 | app.use('/api/quote', require('./api/quote')); 10 | app.use('/api/mean-reversion', require('./api/mean-reversion')); 11 | app.use('/api/backtest', require('./api/backtest')); 12 | app.use('/api/portfolio', require('./api/portfolio')); 13 | app.use('/api/options', require('./api/options')); 14 | app.use('/api/machine-learning', require('./api/machine-learning')); 15 | app.use('/api/bonds', require('./api/bonds')); 16 | app.use('/api/sms', require('./api/sms')); 17 | app.use('/api/stock-info', require('./api/stock-info')); 18 | 19 | app.route('/*') 20 | .get(function(req, res) { 21 | res.sendfile('dist/public/index.html'); 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | "outDir": "../dist", 5 | "sourceMap": true, 6 | "allowJs": true 7 | } 8 | } -------------------------------------------------------------------------------- /spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "../dist/api/**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "helpers/**/*.js" 8 | ], 9 | "stopSpecOnExpectationFailure": false, 10 | "random": true 11 | } 12 | -------------------------------------------------------------------------------- /src/app/ai-picks/ai-picks.component.css: -------------------------------------------------------------------------------- 1 | .bullish-title { 2 | color: #0F9117; 3 | font-weight: 700; 4 | } 5 | 6 | .bearish-title { 7 | color: #ff0000; 8 | font-weight: 700; 9 | } 10 | 11 | .ai-picks { 12 | margin: 10px 13 | } 14 | 15 | .ai-picks-button { 16 | margin: 3px 0 3px 0; 17 | } 18 | 19 | .ai-picks-input-field { 20 | width: 8em; 21 | } -------------------------------------------------------------------------------- /src/app/ai-picks/ai-picks.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AiPicksComponent } from './ai-picks.component'; 4 | 5 | describe('AiPicksComponent', () => { 6 | let component: AiPicksComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AiPicksComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AiPicksComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- 1 | .main-toolbar { 2 | min-height: 25px; 3 | } 4 | 5 | .nav-item { 6 | font-weight: 600; 7 | } 8 | 9 | .toolbar-content { 10 | width: 100%; 11 | } 12 | 13 | mat-chip { 14 | max-width: 150px; 15 | } 16 | 17 | .mat-chip-list-stacked { 18 | min-width: 100px; 19 | padding: 3px 5px 3px 5px; 20 | } 21 | 22 | .status-on { 23 | width: 10px; 24 | height: 10px; 25 | border-radius: 50%; 26 | background-color: #7ab27d; 27 | } 28 | 29 | .status-off { 30 | width: 10px; 31 | height: 10px; 32 | border-radius: 50%; 33 | background-color: #941920; 34 | } 35 | 36 | .services-status { 37 | display: flex; 38 | flex-direction: row; 39 | align-content: flex-start; 40 | } 41 | 42 | .status-indicator { 43 | margin-left: 8px; 44 | margin-top: 1px; 45 | } 46 | 47 | .service-status-container { 48 | width: 150px; 49 | margin-left: 17px; 50 | margin-top: 10px; 51 | } -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
Data Service
6 |
7 |
10 |
11 |
12 |
13 |
Machine Learning Service
14 |
15 |
18 |
19 |
20 |
21 |
22 |
23 | 24 |
25 | 26 | -------------------------------------------------------------------------------- /src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { TradeViewComponent } from './trade-view/trade-view.component'; 2 | 3 | import { Routes } from '@angular/router'; 4 | import { ResearchViewComponent } from './research-view/research-view.component'; 5 | import { OptionsViewComponent } from './options-view/options-view.component'; 6 | import { IntradayBacktestViewComponent } from './intraday-backtest-view/intraday-backtest-view.component'; 7 | import { StocklistComponent } from './stocklist/stocklist.component'; 8 | import { PortfolioManagementComponent } from './portfolio-management/portfolio-management.component'; 9 | 10 | export const routes: Routes = [ 11 | { 12 | path: 'research', 13 | component: ResearchViewComponent 14 | }, 15 | { 16 | path: 'options', 17 | component: OptionsViewComponent 18 | }, 19 | { 20 | path: 'deep-analysis', 21 | loadChildren: './machine-learning/machine-learning.module#MachineLearningModule' 22 | }, 23 | { 24 | path: 'backtest', 25 | component: IntradayBacktestViewComponent 26 | }, 27 | { 28 | path: 'stock-list', 29 | component: StocklistComponent 30 | }, 31 | { 32 | path: 'portfolio-managment', 33 | component: PortfolioManagementComponent 34 | }, 35 | { 36 | path: '**', 37 | component: TradeViewComponent, 38 | pathMatch: 'full' 39 | } 40 | ]; 41 | -------------------------------------------------------------------------------- /src/app/auth.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { AuthGuard } from './auth.guard'; 4 | 5 | describe('AuthGuard', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [AuthGuard] 9 | }); 10 | }); 11 | 12 | it('should ...', inject([AuthGuard], (guard: AuthGuard) => { 13 | expect(guard).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { AuthenticationService } from './shared'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class AuthGuard implements CanActivate { 10 | constructor(public auth: AuthenticationService, public router: Router) {} 11 | 12 | canActivate( 13 | next: ActivatedRouteSnapshot, 14 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 15 | if (!this.auth.selectedTdaAccount) { 16 | this.router.navigate(['overview']); 17 | return false; 18 | } 19 | return true; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/app/auto-backtest-switch/auto-backtest-switch.component.css: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | flex-direction: row; 4 | } 5 | 6 | .item { 7 | width: 5rem; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/auto-backtest-switch/auto-backtest-switch.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
Next run: {{nextBacktestDate}}
7 |
8 | -------------------------------------------------------------------------------- /src/app/auto-backtest-switch/auto-backtest-switch.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AutoBacktestSwitchComponent } from './auto-backtest-switch.component'; 4 | 5 | describe('AutoBacktestSwitchComponent', () => { 6 | let component: AutoBacktestSwitchComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AutoBacktestSwitchComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AutoBacktestSwitchComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/auto-backtest-switch/auto-backtest-switch.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core'; 2 | import { GlobalSettingsService } from '../settings/global-settings.service'; 3 | import * as moment from 'moment-timezone'; 4 | 5 | @Component({ 6 | selector: 'app-auto-backtest-switch', 7 | templateUrl: './auto-backtest-switch.component.html', 8 | styleUrls: ['./auto-backtest-switch.component.css'] 9 | }) 10 | export class AutoBacktestSwitchComponent implements OnInit { 11 | @Output() switchActivate: EventEmitter = new EventEmitter(); 12 | nextBacktestDate; 13 | checked = false; 14 | interval; 15 | timer; 16 | 17 | constructor(private globalSettingsService: GlobalSettingsService) { } 18 | 19 | ngOnInit() { 20 | } 21 | 22 | handleChange(e) { 23 | if (e.checked) { 24 | this.nextBacktestDate = this.getBacktestDateTime(); 25 | this.executeTimer(); 26 | } else { 27 | clearTimeout(this.timer); 28 | this.nextBacktestDate = null; 29 | } 30 | } 31 | 32 | executeTimer() { 33 | this.timer = setTimeout(() => { 34 | this.switchActivate.emit(true); 35 | this.handleChange({checked: this.checked}); 36 | }, this.interval); 37 | } 38 | 39 | getBacktestDateTime() { 40 | const nextDateTime = this.globalSettingsService.getNextTradeDate().add({ hour: 18, minute: 30 }); 41 | this.interval = moment(nextDateTime).diff(moment().tz('America/New_York'), 'milliseconds'); 42 | return nextDateTime.format('LLL'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/app/autopilot/autopilot-service.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AutopilotServiceService } from './autopilot-service.service'; 4 | 5 | describe('AutopilotServiceService', () => { 6 | let service: AutopilotServiceService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AutopilotServiceService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/autopilot/autopilot-service.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { DaytradeAlgorithms } from '@shared/enums/daytrade-algorithms.enum'; 3 | 4 | @Injectable({ 5 | providedIn: 'root' 6 | }) 7 | export class AutopilotServiceService { 8 | localStorageKey = 'autopilot_settings'; 9 | algorithmList = [ 10 | DaytradeAlgorithms.DayTrade, 11 | DaytradeAlgorithms.Buy, 12 | DaytradeAlgorithms.BuyNearOpen, 13 | DaytradeAlgorithms.BuyNearClose 14 | ]; 15 | constructor() { } 16 | 17 | getValue() { 18 | return JSON.parse(localStorage.getItem(this.localStorageKey)); 19 | } 20 | 21 | getSetting(key: string) { 22 | const storage = JSON.parse(localStorage.getItem(this.localStorageKey)); 23 | if (storage && storage[key]) { 24 | return storage[key]; 25 | } 26 | return null; 27 | } 28 | 29 | saveSetting(key: string, value: any) { 30 | let storage = JSON.parse(localStorage.getItem(this.localStorageKey)); 31 | if (storage) { 32 | storage[key] = value; 33 | } else { 34 | storage = { key: value }; 35 | } 36 | localStorage.setItem(this.localStorageKey, JSON.stringify(storage)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/autopilot/autopilot.component.css: -------------------------------------------------------------------------------- 1 | .autopilot-container { 2 | display: block; 3 | position: fixed; 4 | width: 52px; 5 | height: 52px; 6 | bottom: 50px; 7 | right: 50px; 8 | z-index: 1; 9 | cursor: pointer; 10 | } 11 | 12 | .toolbar-header { 13 | display: flex; 14 | flex-direction: row; 15 | } 16 | 17 | .toolbar-header > h3, p-tag { 18 | margin-right: 1rem; 19 | } 20 | 21 | .p-toolbar-group-right > p-button { 22 | margin: 1rem 0.5rem; 23 | } -------------------------------------------------------------------------------- /src/app/autopilot/autopilot.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AutopilotComponent } from './autopilot.component'; 4 | 5 | describe('AutopilotComponent', () => { 6 | let component: AutopilotComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AutopilotComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AutopilotComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/backtest-table/backtest-table.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/backtest-table/backtest-table.component.css -------------------------------------------------------------------------------- /src/app/backtest-table/backtest-table.component.html: -------------------------------------------------------------------------------- 1 |

backtest-table works!

2 | -------------------------------------------------------------------------------- /src/app/backtest-table/backtest-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BacktestTableComponent } from './backtest-table.component'; 4 | 5 | describe('BacktestTableComponent', () => { 6 | let component: BacktestTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BacktestTableComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BacktestTableComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/backtest-table/backtest-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-backtest-table', 5 | templateUrl: './backtest-table.component.html', 6 | styleUrls: ['./backtest-table.component.css'] 7 | }) 8 | export class BacktestTableComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/backtest-table/backtest-table.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { BacktestTableService } from './backtest-table.service'; 4 | 5 | describe('BacktestTableService', () => { 6 | let service: BacktestTableService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(BacktestTableService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/bb-card/bb-card.component.css: -------------------------------------------------------------------------------- 1 | .banner { 2 | position: absolute; 3 | top: 0; 4 | left: 0; 5 | background-color: #ff0000; 6 | width: 100%; 7 | } 8 | 9 | .banner-content { 10 | width: 800px; 11 | padding: 10px; 12 | color: #ffffff; 13 | } 14 | 15 | .banner-warning { 16 | position: absolute; 17 | top: 0; 18 | left: 0; 19 | background-color: #FFD700; 20 | width: 100%; 21 | } 22 | 23 | .banner-content-warning { 24 | width: 800px; 25 | padding: 10px; 26 | color: #000000; 27 | } 28 | 29 | .padded { 30 | padding: 5px; 31 | margin: auto; 32 | position: absolute; 33 | } 34 | 35 | .progress-bar { 36 | display: flex; 37 | align-content: center; 38 | align-items: center; 39 | height: 18px; 40 | } 41 | 42 | .order-log { 43 | height: auto; 44 | width: auto; 45 | } 46 | 47 | .machine-switch { 48 | padding: 3px 0 5px 3px; 49 | } 50 | 51 | .bb-form { 52 | display: flex; 53 | margin: 1rem; 54 | } 55 | 56 | .bb-form-field { 57 | margin-right: 1rem; 58 | } 59 | 60 | :host ::ng-deep .p-chip.live-chip { 61 | background: var(--secondary-color); 62 | color: var(--secondary-color-text); 63 | } 64 | 65 | .card-form-main { 66 | overflow: auto; 67 | } 68 | 69 | button { 70 | margin-bottom: 0.5rem; 71 | margin-right: 0.5rem; 72 | } -------------------------------------------------------------------------------- /src/app/bb-card/bb-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BbCardComponent } from './bb-card.component'; 4 | 5 | describe('BbCardComponent', () => { 6 | let component: BbCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ BbCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BbCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/bulk-backtest/bulk-backtest.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/bulk-backtest/bulk-backtest.component.css -------------------------------------------------------------------------------- /src/app/bulk-backtest/bulk-backtest.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Import File 6 | 7 | 8 | Parses stocks from Stock column of Excel file 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Single Quote Search 17 | 18 | 19 | Type ticker, short term moving average, and long term moving average 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/app/bulk-backtest/bulk-backtest.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BulkBacktestComponent } from './bulk-backtest.component'; 4 | 5 | describe('BulkBacktestComponent', () => { 6 | let component: BulkBacktestComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ BulkBacktestComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BulkBacktestComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/bulk-backtest/bulk-backtest.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import 'rxjs/add/observable/of'; 3 | 4 | import { AlgoParam, Row } from '../shared'; 5 | 6 | @Component({ 7 | selector: 'app-bulk-backtest', 8 | templateUrl: './bulk-backtest.component.html', 9 | styleUrls: ['./bulk-backtest.component.css'] 10 | }) 11 | export class BulkBacktestComponent implements OnInit { 12 | public stocks: AlgoParam[] = []; 13 | headers: Array; 14 | 15 | constructor() {} 16 | 17 | ngOnInit() { 18 | this.headers = ['stock', 'totalReturns', 'lastVolume', 'lastPrice', 'totalTrades', 'trending']; 19 | } 20 | 21 | import(event) { 22 | this.stocks = []; 23 | event.forEach((row: Row) => { 24 | const params = { 25 | ticker: row.Stock, 26 | start: row.Start, 27 | end: row.End, 28 | short: row.Short || 30, 29 | long: row.Long || 90, 30 | deviation: row.Deviation 31 | }; 32 | 33 | this.stocks.push(params); 34 | }); 35 | } 36 | 37 | query(param) { 38 | this.stocks = []; 39 | const params = { 40 | ticker: param.query, 41 | start: param.start, 42 | end: param.end, 43 | short: param.short || 30, 44 | long: param.long || 90, 45 | deviation: param.deviation 46 | }; 47 | this.stocks.push(params); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/app/bulk-backtest/index.ts: -------------------------------------------------------------------------------- 1 | export * from './bulk-backtest.component'; 2 | -------------------------------------------------------------------------------- /src/app/chart-dialog/chart-dialog.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/chart-dialog/chart-dialog.component.css -------------------------------------------------------------------------------- /src/app/chart-dialog/chart-dialog.component.html: -------------------------------------------------------------------------------- 1 |

Load Chart

2 | 3 | 4 | Select a chart 5 | 6 | 7 | {{algo.viewValue}} 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/app/chart-dialog/chart-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ChartDialogComponent } from './chart-dialog.component'; 4 | 5 | describe('ChartDialogComponent', () => { 6 | let component: ChartDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ChartDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ChartDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/confirm-dialog/confirm-dialog.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/confirm-dialog/confirm-dialog.component.css -------------------------------------------------------------------------------- /src/app/confirm-dialog/confirm-dialog.component.html: -------------------------------------------------------------------------------- 1 |

{{data.title}}

2 | 3 |

{{data.message}}

4 |
5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/app/confirm-dialog/confirm-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ConfirmDialogComponent } from './confirm-dialog.component'; 4 | 5 | describe('ConfirmDialogComponent', () => { 6 | let component: ConfirmDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ConfirmDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ConfirmDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/confirm-dialog/confirm-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Inject } from '@angular/core'; 2 | import { MAT_DIALOG_DATA } from '@angular/material/dialog'; 3 | 4 | @Component({ 5 | selector: 'app-confirm-dialog', 6 | templateUrl: './confirm-dialog.component.html', 7 | styleUrls: ['./confirm-dialog.component.css'] 8 | }) 9 | export class ConfirmDialogComponent { 10 | constructor(@Inject(MAT_DIALOG_DATA) public data: { title: string, message: string }) { } 11 | } 12 | -------------------------------------------------------------------------------- /src/app/daytrade-score-board/daytrade-score-board.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/daytrade-score-board/daytrade-score-board.component.css -------------------------------------------------------------------------------- /src/app/daytrade-score-board/daytrade-score-board.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Stock 6 | 7 | 8 | Profit/Loss 9 | 10 | 11 | 12 | 13 | 14 | 15 | {{rowData.stock}} 16 | 17 | 18 | {{rowData.profit | currency}} 19 | 20 | 21 | 22 | 23 | Total Profit/Loss: {{ this.totalScore | currency }} 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/app/daytrade-score-board/daytrade-score-board.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DaytradeScoreBoardComponent } from './daytrade-score-board.component'; 4 | 5 | describe('DaytradeScoreBoardComponent', () => { 6 | let component: DaytradeScoreBoardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DaytradeScoreBoardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DaytradeScoreBoardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/daytrade-score-board/daytrade-score-board.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnChanges, SimpleChanges, Input, OnInit } from '@angular/core'; 2 | import { Order } from '../shared/models/order'; 3 | import { ScoreKeeperService } from '../shared'; 4 | 5 | @Component({ 6 | selector: 'app-daytrade-score-board', 7 | templateUrl: './daytrade-score-board.component.html', 8 | styleUrls: ['./daytrade-score-board.component.css'] 9 | }) 10 | export class DaytradeScoreBoardComponent implements OnChanges, OnInit { 11 | @Input() buyOrders: Order[]; 12 | @Input() otherOrders: Order[]; 13 | @Input() totalScore: number; 14 | scoreTable; 15 | 16 | constructor(private scoreKeeperService: ScoreKeeperService) { } 17 | 18 | ngOnInit() { 19 | } 20 | 21 | ngOnChanges(changes: SimpleChanges) { 22 | if (changes.totalScore) { 23 | this.getScores(); 24 | } 25 | } 26 | 27 | getScores() { 28 | this.scoreTable = []; 29 | 30 | this.buyOrders.forEach((order) => { 31 | const tableItem = { 32 | stock: order.holding.symbol, 33 | profit: this.scoreKeeperService.profitLossHash[order.holding.symbol] 34 | }; 35 | this.scoreTable.push(tableItem); 36 | }); 37 | 38 | this.otherOrders.forEach((order) => { 39 | const tableItem = { 40 | stock: order.holding.symbol, 41 | profit: this.scoreKeeperService.profitLossHash[order.holding.symbol] 42 | }; 43 | this.scoreTable.push(tableItem); 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/app/default-order-lists/default-order-lists.component.scss: -------------------------------------------------------------------------------- 1 | .actions-inputs { 2 | display: flex; 3 | flex-direction: row; 4 | align-items: flex-start; 5 | flex-wrap: wrap; 6 | .custom-controls { 7 | margin-top: 1em; 8 | margin-bottom: 1em; 9 | margin-right: 1em; 10 | } 11 | .custom-text-input { 12 | margin-top: 1em; 13 | margin-bottom: 1em; 14 | display: flex; 15 | .check-button { 16 | :host ::ng-deep .p-button.p-button-icon-only { 17 | font-size: 1em; 18 | } 19 | } 20 | } 21 | } 22 | 23 | .order-form-item { 24 | margin-top: 5px; 25 | margin-bottom: 5px; 26 | display: flex; 27 | flex-direction: row; 28 | align-items: flex-start; 29 | 30 | input { 31 | width: 3em; 32 | height: 2.5em; 33 | } 34 | } 35 | 36 | .card-form { 37 | margin: 5px; 38 | min-height: 8em; 39 | } 40 | 41 | .loading-screen { 42 | min-height: 18em; 43 | } 44 | 45 | .error-message { 46 | color: red; 47 | margin-left: 5px; 48 | } 49 | 50 | .order-cards { 51 | display: flex; 52 | } 53 | 54 | .default-list-actions { 55 | .pull-right { 56 | float: right; 57 | } 58 | } 59 | 60 | .order-list-container { 61 | flex-direction: row; 62 | .order-list-column { 63 | margin-left: 1em; 64 | } 65 | } -------------------------------------------------------------------------------- /src/app/default-order-lists/default-order-lists.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DefaultOrderListsComponent } from './default-order-lists.component'; 4 | 5 | describe('DefaultOrderListsComponent', () => { 6 | let component: DefaultOrderListsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DefaultOrderListsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DefaultOrderListsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/determine-hedge/determine-hedge.component.css: -------------------------------------------------------------------------------- 1 | .run-button { 2 | padding: 25px 0 10px 0; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/determine-hedge/determine-hedge.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | {{col.header}} 12 | 13 | 14 | 15 | 16 | 17 | {{holding.name}} 18 | {{holding.recommendation}} 19 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /src/app/determine-hedge/determine-hedge.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DetermineHedgeComponent } from './determine-hedge.component'; 4 | 5 | describe('DetermineHedgeComponent', () => { 6 | let component: DetermineHedgeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DetermineHedgeComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DetermineHedgeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/easy-orders-editor/easy-orders-editor.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/easy-orders-editor/easy-orders-editor.component.css -------------------------------------------------------------------------------- /src/app/easy-orders-editor/easy-orders-editor.component.html: -------------------------------------------------------------------------------- 1 |

2 | easy-orders-editor works! 3 |

4 | -------------------------------------------------------------------------------- /src/app/easy-orders-editor/easy-orders-editor.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EasyOrdersEditorComponent } from './easy-orders-editor.component'; 4 | 5 | describe('EasyOrdersEditorComponent', () => { 6 | let component: EasyOrdersEditorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ EasyOrdersEditorComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EasyOrdersEditorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/easy-orders-editor/easy-orders-editor.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-easy-orders-editor', 5 | templateUrl: './easy-orders-editor.component.html', 6 | styleUrls: ['./easy-orders-editor.component.css'] 7 | }) 8 | export class EasyOrdersEditorComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/find-buy/find-buy.component.css: -------------------------------------------------------------------------------- 1 | .find-recommendation-btn { 2 | padding: 0 10px 5px 0; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/find-buy/find-buy.component.html: -------------------------------------------------------------------------------- 1 | 3 | 4 |
5 | 7 |
8 | 9 | 10 |
11 | 12 | 13 | Stock 14 | Buy Reasons 15 | Buy Confidence 16 | Sell Reasons 17 | Sell Confidence 18 | 19 | 20 | 21 | 22 | {{holding.name}} 23 | {{holding.buyReasons}} 24 | {{holding.buyConfidence}} 25 | {{holding.sellReasons}} 26 | {{holding.sellConfidence}} 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/app/find-buy/find-buy.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FindBuyComponent } from './find-buy.component'; 4 | 5 | describe('FindBuyComponent', () => { 6 | let component: FindBuyComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ FindBuyComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FindBuyComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/header/header.component.css: -------------------------------------------------------------------------------- 1 | .header { 2 | padding: 5px 10px 5px 10px; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/header/header.component.html: -------------------------------------------------------------------------------- 1 |

{{header}}

2 |

{{summary}}

3 | -------------------------------------------------------------------------------- /src/app/header/header.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HeaderComponent } from './header.component'; 4 | 5 | describe('HeaderComponent', () => { 6 | let component: HeaderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ HeaderComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HeaderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/header/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-header', 5 | templateUrl: './header.component.html', 6 | styleUrls: ['./header.component.css'] 7 | }) 8 | export class HeaderComponent implements OnInit { 9 | @Input() header: string; 10 | @Input() summary: string; 11 | constructor() { } 12 | 13 | ngOnInit() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/app/intraday-backtest-view/intraday-backtest-stocks.constant.ts: -------------------------------------------------------------------------------- 1 | import { OrderRow } from '../shared/models/order-row'; 2 | import { stockList } from '../rh-table/backtest-stocks.constant'; 3 | 4 | function createRow(ticker: string): OrderRow { 5 | return { 6 | symbol: ticker, 7 | price: 10, 8 | quantity: 100, 9 | side: 'DayTrade', 10 | Stop: 0.003, 11 | TrailingStop: 0.001, 12 | Target: 0.02, 13 | StopLoss: true, 14 | TrailingStopLoss: true, 15 | TakeProfit: true, 16 | SellAtClose: true, 17 | OrderSize: 10 18 | }; 19 | } 20 | 21 | const IntradayStocks: OrderRow[] = []; 22 | 23 | for (const s of stockList) { 24 | IntradayStocks.push(createRow(s)); 25 | } 26 | 27 | export default IntradayStocks; 28 | -------------------------------------------------------------------------------- /src/app/intraday-backtest-view/intraday-backtest-view.component.css: -------------------------------------------------------------------------------- 1 | .card-container { 2 | min-height: 800px; 3 | } 4 | 5 | .backtest-progress { 6 | margin-bottom:10px; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/intraday-backtest-view/intraday-backtest-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { IntradayBacktestViewComponent } from './intraday-backtest-view.component'; 4 | 5 | describe('IntradayBacktestViewComponent', () => { 6 | let component: IntradayBacktestViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ IntradayBacktestViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(IntradayBacktestViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/login-dialog/login-dialog.component.css: -------------------------------------------------------------------------------- 1 | .login-container { 2 | height: 100%; 3 | width: 100%; 4 | } 5 | 6 | .login-input { 7 | width: 250px; 8 | } -------------------------------------------------------------------------------- /src/app/login-dialog/login-dialog.component.html: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /src/app/login-dialog/login-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginDialogComponent } from './login-dialog.component'; 4 | 5 | describe('LoginDialogComponent', () => { 6 | let component: LoginDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/login-dialog/login-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { MatSnackBar } from '@angular/material/snack-bar'; 3 | import { AuthenticationService } from '../shared'; 4 | 5 | @Component({ 6 | selector: 'app-login-dialog', 7 | templateUrl: './login-dialog.component.html', 8 | styleUrls: ['./login-dialog.component.css'] 9 | }) 10 | export class LoginDialogComponent implements OnInit { 11 | hide = true; 12 | model: any = {}; 13 | loading = false; 14 | error = ''; 15 | 16 | constructor( 17 | public snackBar: MatSnackBar, 18 | private authenticationService: AuthenticationService) { } 19 | 20 | ngOnInit() { } 21 | 22 | login() { 23 | this.loading = true; 24 | this.authenticationService.login(this.model.username, this.model.password) 25 | .subscribe(result => { 26 | if (result === true) { 27 | this.loading = false; 28 | } else { 29 | this.loading = false; 30 | } 31 | }, 32 | error => { 33 | this.snackBar.open('Username or password is incorrect', 'Dismiss', { 34 | duration: 2000, 35 | }); 36 | this.loading = false; 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/login/login.component.css: -------------------------------------------------------------------------------- 1 | .login-button { 2 | padding-left: 16px; 3 | } 4 | 5 | .login-input { 6 | width: 250px; 7 | } 8 | 9 | .available-accounts { 10 | text-align: left; 11 | display: flex; 12 | } 13 | 14 | .item-container { 15 | display: flex; 16 | } 17 | 18 | .action-icon { 19 | display: flex; 20 | margin-left: 1rem; 21 | } 22 | 23 | .action-button { 24 | margin-right: 1rem; 25 | } 26 | 27 | .save-btn { 28 | margin-left: 0px; 29 | } 30 | 31 | .login-send-btn { 32 | margin-left: 8em; 33 | margin-top: 1em; 34 | } 35 | 36 | .available-accounts-title { 37 | font-weight: 700; 38 | } -------------------------------------------------------------------------------- /src/app/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/machine-daytrading/machine-daytrading.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | 5 | 6 | @NgModule({ 7 | declarations: [], 8 | imports: [ 9 | CommonModule 10 | ] 11 | }) 12 | export class MachineDaytradingModule { } 13 | -------------------------------------------------------------------------------- /src/app/machine-daytrading/machine-daytrading.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { MachineDaytradingService } from './machine-daytrading.service'; 4 | 5 | describe('MachineDaytradingService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: MachineDaytradingService = TestBed.get(MachineDaytradingService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/machine-learning/ask-model/ask-model.component.css: -------------------------------------------------------------------------------- 1 | .data-cell { 2 | white-space: nowrap; 3 | overflow: hidden; 4 | text-overflow: ellipsis; 5 | } 6 | 7 | button { 8 | margin: 5px; 9 | } 10 | 11 | .buy-color { 12 | color: green; 13 | font-weight: bolder; 14 | } -------------------------------------------------------------------------------- /src/app/machine-learning/ask-model/ask-model.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AskModelComponent } from './ask-model.component'; 4 | 5 | describe('AskModelComponent', () => { 6 | let component: AskModelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AskModelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AskModelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/machine-learning/machine-learning-page/machine-learning-page.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/machine-learning/machine-learning-page/machine-learning-page.component.css -------------------------------------------------------------------------------- /src/app/machine-learning/machine-learning-page/machine-learning-page.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/app/machine-learning/machine-learning-page/machine-learning-page.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MachineLearningPageComponent } from './machine-learning-page.component'; 4 | 5 | describe('MachineLearningPageComponent', () => { 6 | let component: MachineLearningPageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MachineLearningPageComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MachineLearningPageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/machine-learning/machine-learning-page/machine-learning-page.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-machine-learning-page', 5 | templateUrl: './machine-learning-page.component.html', 6 | styleUrls: ['./machine-learning-page.component.css'] 7 | }) 8 | export class MachineLearningPageComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/machine-learning/ml-timeperiods/ml-timeperiods.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/machine-learning/ml-timeperiods/ml-timeperiods.component.css -------------------------------------------------------------------------------- /src/app/machine-learning/ml-timeperiods/ml-timeperiods.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Start Time 5 | End Time 6 | Algorithm 7 | Guesses 8 | Correct 9 | Percent Correct 10 | 11 | 12 | 13 | 14 | {{backtest.startTime}} 15 | {{backtest.endTime}} 16 | {{backtest.algorithm}} 17 | {{backtest.guesses}} 18 | {{holding.correct}} 19 | {{holding.percentCorrect}} 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/app/machine-learning/ml-timeperiods/ml-timeperiods.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MlTimeperiodsComponent } from './ml-timeperiods.component'; 4 | 5 | describe('MlTimeperiodsComponent', () => { 6 | let component: MlTimeperiodsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MlTimeperiodsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MlTimeperiodsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/machine-learning/ml-timeperiods/ml-timeperiods.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BacktestService } from '@shared/services'; 3 | import * as moment from 'moment-timezone'; 4 | 5 | @Component({ 6 | selector: 'app-ml-timeperiods', 7 | templateUrl: './ml-timeperiods.component.html', 8 | styleUrls: ['./ml-timeperiods.component.css'] 9 | }) 10 | export class MlTimeperiodsComponent implements OnInit { 11 | backtest = []; 12 | constructor(private backtestService: BacktestService) { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | init() { 18 | this.train().subscribe((training) => { 19 | console.log('initial training: ', training); 20 | this.testModel().subscribe((data) => { 21 | console.log('test model ', data); 22 | }); 23 | }); 24 | } 25 | 26 | train() { 27 | return this.backtestService.runLstmV2('SPY', 28 | moment().subtract({ day: 100 }).format('YYYY-MM-DD'), 29 | moment().subtract({ day: 300}).format('YYYY-MM-DD'), 30 | 0.9); 31 | } 32 | 33 | testModel() { 34 | return this.backtestService.runLstmV2('SPY', 35 | moment().subtract({ day: 1 }).format('YYYY-MM-DD'), 36 | moment().subtract({ day: 50 }).format('YYYY-MM-DD'), 37 | 0.1); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/machine-learning/precog/precog.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/machine-learning/precog/precog.component.css -------------------------------------------------------------------------------- /src/app/machine-learning/precog/precog.component.html: -------------------------------------------------------------------------------- 1 |

2 | precog works! 3 |

4 | -------------------------------------------------------------------------------- /src/app/machine-learning/precog/precog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PrecogComponent } from './precog.component'; 4 | 5 | describe('PrecogComponent', () => { 6 | let component: PrecogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PrecogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PrecogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/machine-learning/precog/precog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-precog', 5 | templateUrl: './precog.component.html', 6 | styleUrls: ['./precog.component.css'] 7 | }) 8 | export class PrecogComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/machine-learning/timeline-view/timeline-view.component.css: -------------------------------------------------------------------------------- 1 | .table-container { 2 | clear: both; 3 | border: 1px solid #963; 4 | height: 1080px; 5 | overflow: auto; 6 | } -------------------------------------------------------------------------------- /src/app/machine-learning/timeline-view/timeline-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TimelineViewComponent } from './timeline-view.component'; 4 | 5 | describe('TimelineViewComponent', () => { 6 | let component: TimelineViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TimelineViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TimelineViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/mini-card/mini-card.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |

6 | {{order.holding.symbol}} 7 |

8 |
{{order.holding.name}}
9 |
    10 |
  • 11 | Type {{order.side}} 12 |
  • 13 |
  • 14 | Quantity {{order.quantity}} 15 |
  • 16 |
  • 17 | Order {{order.orderSize}} 18 |
  • 19 |
20 |
21 |
22 | 23 | 25 | 26 |
27 |
28 | -------------------------------------------------------------------------------- /src/app/mini-card/mini-card.component.scss: -------------------------------------------------------------------------------- 1 | .close-icon { 2 | font-size: 1.5em; 3 | top: 16px; 4 | left: 80px; 5 | cursor: pointer; 6 | opacity: .5; 7 | position: relative 8 | } 9 | 10 | .close-icon:focus, .close-icon:hover { 11 | color: #000; 12 | opacity: .75; 13 | } 14 | 15 | .mini-card-container { 16 | margin: 5px; 17 | } 18 | 19 | .detail-list { 20 | list-style-type:none; 21 | padding: 0; 22 | } 23 | 24 | .card-content { 25 | max-width: 8em; 26 | max-height: 10em; 27 | } 28 | 29 | .mini-card-button { 30 | margin: 1px; 31 | } 32 | 33 | .mini-card-input { 34 | .ui-inputgroup{ 35 | input { 36 | width: 3em; 37 | height: 2.5em; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/mini-card/mini-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MiniCardComponent } from './mini-card.component'; 4 | 5 | describe('MiniCardComponent', () => { 6 | let component: MiniCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MiniCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MiniCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/mini-card/mini-card.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; 2 | import { SmartOrder } from '../shared/models/smart-order'; 3 | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; 4 | import * as _ from 'lodash'; 5 | 6 | @Component({ 7 | selector: 'app-mini-card', 8 | templateUrl: './mini-card.component.html', 9 | styleUrls: ['./mini-card.component.scss'] 10 | }) 11 | export class MiniCardComponent implements OnInit { 12 | @Input() order: SmartOrder; 13 | @Input() canEdit: boolean; 14 | @Output() delete: EventEmitter = new EventEmitter(); 15 | @Output() updatedOrder: EventEmitter = new EventEmitter(); 16 | firstFormGroup: FormGroup; 17 | changeText; 18 | detailMode: boolean; 19 | actionMode: boolean; 20 | 21 | constructor(private _formBuilder: FormBuilder) { } 22 | 23 | ngOnInit() { 24 | this.firstFormGroup = this._formBuilder.group({ 25 | amount: [this.order.amount, Validators.required] 26 | }); 27 | } 28 | 29 | deleteCard() { 30 | this.delete.emit(this.order.holding.symbol); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/app/ml-batch-card/ml-batch-card.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/ml-batch-card/ml-batch-card.component.css -------------------------------------------------------------------------------- /src/app/ml-batch-card/ml-batch-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MlBatchCardComponent } from './ml-batch-card.component'; 4 | 5 | describe('MlBatchCardComponent', () => { 6 | let component: MlBatchCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MlBatchCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MlBatchCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/ml-card/ml-card.component.css: -------------------------------------------------------------------------------- 1 | .ml-setting-switch { 2 | margin-left: 2px; 3 | margin-right: 2px; 4 | } 5 | 6 | .position-close-setting { 7 | margin-right: 2.5em; 8 | } 9 | 10 | .ml-title { 11 | font-weight: 700; 12 | } 13 | -------------------------------------------------------------------------------- /src/app/neuro-card/neuro-card.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/neuro-card/neuro-card.component.css -------------------------------------------------------------------------------- /src/app/neuro-card/neuro-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NeuroCardComponent } from './neuro-card.component'; 4 | 5 | describe('NeuroCardComponent', () => { 6 | let component: NeuroCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ NeuroCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NeuroCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/options-view/options-view.component.css: -------------------------------------------------------------------------------- 1 | .options-container { 2 | min-height: 500px; 3 | } -------------------------------------------------------------------------------- /src/app/options-view/options-view.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Under Construction

4 | 5 |
6 |
7 | -------------------------------------------------------------------------------- /src/app/options-view/options-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { OptionsViewComponent } from './options-view.component'; 4 | 5 | describe('OptionsViewComponent', () => { 6 | let component: OptionsViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ OptionsViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(OptionsViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/options-view/options-view.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BacktestService } from '../shared'; 3 | import * as moment from '../../../node_modules/moment'; 4 | import * as _ from 'lodash'; 5 | 6 | @Component({ 7 | selector: 'app-options-view', 8 | templateUrl: './options-view.component.html', 9 | styleUrls: ['./options-view.component.css'] 10 | }) 11 | export class OptionsViewComponent implements OnInit { 12 | optionsChain: any; 13 | expirationDates: string[]; 14 | constructor(private backtestService: BacktestService) { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | getChain() { 20 | this.backtestService.getOptionChain('AA').subscribe((chain) => { 21 | console.log('chain: ', chain); 22 | 23 | _.forEach(chain.optionChain.result.expirationDates, (expiry: number) => { 24 | this.expirationDates.push(moment.unix(expiry).format()); 25 | }); 26 | }); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/app/order-dialog/order-dialog.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/order-dialog/order-dialog.component.css -------------------------------------------------------------------------------- /src/app/order-dialog/order-dialog.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{data.side}} 6 | 7 | 8 | {{data.holding.symbol}} 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 | 22 |
23 |
24 | 25 |
26 | 27 | 28 | 31 | 32 |
33 |
34 |
-------------------------------------------------------------------------------- /src/app/order-dialog/order-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { OrderDialogComponent } from './order-dialog.component'; 4 | 5 | describe('OrderDialogComponent', () => { 6 | let component: OrderDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ OrderDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(OrderDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/orders-list/orders-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/orders-list/orders-list.component.css -------------------------------------------------------------------------------- /src/app/orders-list/orders-list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 |

No orders found.

17 |
18 |
19 |
-------------------------------------------------------------------------------- /src/app/orders-list/orders-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { OrdersListComponent } from './orders-list.component'; 4 | 5 | describe('OrdersListComponent', () => { 6 | let component: OrdersListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ OrdersListComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(OrdersListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/orders-list/orders-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { CartService } from '@shared/services/cart.service'; 3 | 4 | @Component({ 5 | selector: 'app-orders-list', 6 | templateUrl: './orders-list.component.html', 7 | styleUrls: ['./orders-list.component.css'] 8 | }) 9 | export class OrdersListComponent implements OnInit { 10 | 11 | constructor(public cartService: CartService) { } 12 | 13 | ngOnInit() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/app/overview/overview.component.css: -------------------------------------------------------------------------------- 1 | .overview-container { 2 | width: 100%; 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/overview/overview.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /src/app/overview/overview.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { OverviewComponent } from './overview.component'; 4 | 5 | describe('OverviewComponent', () => { 6 | let component: OverviewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ OverviewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(OverviewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/overview/overview.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-overview', 5 | templateUrl: './overview.component.html', 6 | styleUrls: ['./overview.component.css'] 7 | }) 8 | export class OverviewComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/overview/overview.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { TodoListComponent } from './todo-list/todo-list.component'; 4 | import { OverviewComponent } from './overview.component'; 5 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 6 | import { SharedModule } from '../shared/shared.module'; 7 | import { LoginComponent } from '../login/login.component'; 8 | import { CheckboxModule } from 'primeng/checkbox'; 9 | 10 | @NgModule({ 11 | declarations: [TodoListComponent, OverviewComponent, LoginComponent], 12 | imports: [ 13 | CommonModule, 14 | FormsModule, 15 | ReactiveFormsModule, 16 | SharedModule, 17 | CheckboxModule 18 | ], 19 | exports: [TodoListComponent, LoginComponent] 20 | }) 21 | export class OverviewModule { } 22 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo-list.component.css: -------------------------------------------------------------------------------- 1 | .todo-card { 2 | margin: 10px; 3 | max-width: 125px; 4 | } 5 | 6 | .checkbox-label { 7 | word-wrap: break-word; 8 | } 9 | 10 | .todo-item { 11 | margin-bottom: 10px; 12 | } 13 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo-list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Todo List 4 | 5 | 6 | 7 | 8 | 9 |
10 | Market Analysis 11 |
12 |
13 |
14 | 15 | 16 |
17 | Screen Stocks 18 |
19 |
20 |
21 | 22 | 23 |
24 | Intraday Backtest 25 |
26 |
27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoListComponent } from './todo-list.component'; 4 | 5 | describe('TodoListComponent', () => { 6 | let component: TodoListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TodoListComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TodoListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { TodoService } from './todo.service'; 3 | 4 | @Component({ 5 | selector: 'app-todo-list', 6 | templateUrl: './todo-list.component.html', 7 | styleUrls: ['./todo-list.component.css'] 8 | }) 9 | export class TodoListComponent { 10 | constructor(public todoService: TodoService) { } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoService } from './todo.service'; 4 | 5 | describe('TodoService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: TodoService = TestBed.get(TodoService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/overview/todo-list/todo.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class TodoService { 7 | marketAnalysis: boolean; 8 | screenStocks: boolean; 9 | intradayBacktest: boolean; 10 | 11 | constructor() { } 12 | 13 | setMarketAnalysis() { 14 | this.marketAnalysis = true; 15 | } 16 | 17 | setScreenStocks() { 18 | this.screenStocks = true; 19 | } 20 | 21 | setIntradayBacktest() { 22 | this.intradayBacktest = true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/pie-alloct/pie-alloct.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/pie-alloct/pie-alloct.component.css -------------------------------------------------------------------------------- /src/app/pie-alloct/pie-alloct.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/pie-alloct/pie-alloct.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PieAlloctComponent } from './pie-alloct.component'; 4 | 5 | describe('PieAlloctComponent', () => { 6 | let component: PieAlloctComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PieAlloctComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PieAlloctComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/pie-alloct/pie-alloct.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-pie-alloct', 5 | templateUrl: './pie-alloct.component.html', 6 | styleUrls: ['./pie-alloct.component.css'] 7 | }) 8 | export class PieAlloctComponent implements OnInit { 9 | data: any; 10 | 11 | constructor() { } 12 | 13 | ngOnInit() { 14 | this.data = { 15 | labels: ['A', 'B', 'C'], 16 | datasets: [ 17 | { 18 | data: [300, 50, 100], 19 | backgroundColor: [ 20 | this.getRandomColor(), 21 | this.getRandomColor(), 22 | this.getRandomColor() 23 | ] 24 | }] 25 | }; 26 | } 27 | 28 | getRandomColor() { 29 | const letters = '0123456789ABCDEF'; 30 | let color = '#'; 31 | for (let i = 0; i < 6; i++) { 32 | color += letters[Math.floor(Math.random() * 16)]; 33 | } 34 | return color; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/app/pokerhand/pokerhand.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 | 13 |
14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 |
22 | 23 | 24 |
25 |
26 |
-------------------------------------------------------------------------------- /src/app/pokerhand/pokerhand.component.scss: -------------------------------------------------------------------------------- 1 | .single-card { 2 | position: relative; 3 | margin: 1em; 4 | } 5 | 6 | .card-hover { 7 | width: 100%; 8 | height: 100%; 9 | } 10 | 11 | .poker-hand-list { 12 | max-height: 30em; 13 | overflow-y: scroll; 14 | display: flex; 15 | flex-direction: row; 16 | flex-wrap: wrap; 17 | } 18 | -------------------------------------------------------------------------------- /src/app/pokerhand/pokerhand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PokerhandComponent } from './pokerhand.component'; 4 | 5 | describe('PokerhandComponent', () => { 6 | let component: PokerhandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PokerhandComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PokerhandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/pokerhand/pokerhand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { SmartOrder } from '../shared/models/smart-order'; 3 | import { Holding } from '../shared/models'; 4 | import { CartService } from '../shared/services/cart.service'; 5 | 6 | @Component({ 7 | selector: 'app-pokerhand', 8 | templateUrl: './pokerhand.component.html', 9 | styleUrls: ['./pokerhand.component.scss'] 10 | }) 11 | export class PokerhandComponent implements OnInit { 12 | pokerhand: SmartOrder[]; 13 | 14 | constructor(public cartService: CartService) { } 15 | 16 | ngOnInit() { 17 | const newHolding: Holding = { 18 | instrument: '', 19 | symbol: 'VTI' 20 | }; 21 | 22 | const order: SmartOrder = { 23 | holding: newHolding, 24 | quantity: 10, 25 | price: 28.24, 26 | submitted: false, 27 | pending: false, 28 | side: 'DayTrade', 29 | useTakeProfit: true, 30 | useStopLoss: true, 31 | lossThreshold: -0.002, 32 | profitTarget: 0.004, 33 | sellAtClose: true 34 | }; 35 | 36 | this.pokerhand = [ 37 | order 38 | ]; 39 | } 40 | 41 | delete(order: SmartOrder) { 42 | switch (order.side.toLowerCase()) { 43 | case 'daytrade': { 44 | this.cartService.deleteDaytrade(order); 45 | break; 46 | } 47 | case 'buy': { 48 | this.cartService.deleteBuy(order); 49 | break; 50 | } 51 | case 'sell': { 52 | this.cartService.deleteSell(order); 53 | break; 54 | } 55 | } 56 | } 57 | 58 | updateOrder(order: SmartOrder) { 59 | this.cartService.updateOrder(order); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/app/portfolio-info/portfolio-info.component.scss: -------------------------------------------------------------------------------- 1 | .no-positions { 2 | left: 40%; 3 | position: relative; 4 | } 5 | 6 | .control-switch { 7 | margin-left: 1em; 8 | } -------------------------------------------------------------------------------- /src/app/portfolio-info/portfolio-info.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PortfolioInfoComponent } from './portfolio-info.component'; 4 | 5 | describe('PortfolioInfoComponent', () => { 6 | let component: PortfolioInfoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PortfolioInfoComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PortfolioInfoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/portfolio-management/portfolio-management.component.css: -------------------------------------------------------------------------------- 1 | .portfolio-management { 2 | margin: 50px 25px 0 25px; 3 | } 4 | 5 | .stepper-button { 6 | padding: 25px 0 25px 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/portfolio-management/portfolio-management.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | 7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 | -------------------------------------------------------------------------------- /src/app/portfolio-management/portfolio-management.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PortfolioManagementComponent } from './portfolio-management.component'; 4 | 5 | describe('PortfolioManagementComponent', () => { 6 | let component: PortfolioManagementComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PortfolioManagementComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PortfolioManagementComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/portfolio-management/portfolio-management.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { MenuItem } from 'primeng/api'; 3 | 4 | @Component({ 5 | selector: 'app-portfolio-management', 6 | templateUrl: './portfolio-management.component.html', 7 | styleUrls: ['./portfolio-management.component.css'] 8 | }) 9 | export class PortfolioManagementComponent implements OnInit { 10 | steps: MenuItem[]; 11 | activeIndex; 12 | constructor() { } 13 | 14 | ngOnInit() { 15 | this.steps = [{ 16 | label: 'Review Holdings', 17 | command: () => { 18 | this.activeIndex = 0; 19 | } 20 | }, 21 | { 22 | label: 'Find New Buys', 23 | command: () => { 24 | this.activeIndex = 1; 25 | } 26 | }, 27 | { 28 | label: 'Determine Hedge', 29 | command: () => { 30 | this.activeIndex = 2; 31 | } 32 | }, 33 | { 34 | label: 'Confirmation', 35 | command: () => { 36 | this.activeIndex = 3; 37 | } 38 | }]; 39 | this.activeIndex = 0; 40 | } 41 | 42 | nextStep() { 43 | this.activeIndex++; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/app/product-view/product-view.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/product-view/product-view.component.css -------------------------------------------------------------------------------- /src/app/product-view/product-view.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 |
8 |
9 |
10 |

Results

11 | 12 | 13 | 14 | Algorithm 15 | Invested 16 | Last Price 17 | Last Volume 18 | Recommendation 19 | Total Trades 20 | Returns 21 | 22 | 23 | 24 | 25 | {{result.algo}} 26 | {{result.invested | currency}} 27 | {{result.lastPrice | currency}} 28 | {{result.lastVolume | number}} 29 | {{result.recommendation}} 30 | {{result.totalTrades | number}} 31 | {{result.returns | percent}} 32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /src/app/product-view/product-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ProductViewComponent } from './product-view.component'; 4 | 5 | describe('ProductViewComponent', () => { 6 | let component: ProductViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ProductViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ProductViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/redirect-login-dialog/redirect-login-dialog.component.css: -------------------------------------------------------------------------------- 1 | .login-action { 2 | margin-left: auto; 3 | } 4 | 5 | .welcome-text { 6 | text-align: center; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/redirect-login-dialog/redirect-login-dialog.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Please provide your TDA credentials.

4 |
5 | 6 |
7 | 8 |
-------------------------------------------------------------------------------- /src/app/redirect-login-dialog/redirect-login-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RedirectLoginDialogComponent } from './redirect-login-dialog.component'; 4 | 5 | describe('RedirectLoginDialogComponent', () => { 6 | let component: RedirectLoginDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ RedirectLoginDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RedirectLoginDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/redirect-login-dialog/redirect-login-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { DynamicDialogRef } from 'primeng/dynamicdialog'; 4 | 5 | @Component({ 6 | selector: 'app-redirect-login-dialog', 7 | templateUrl: './redirect-login-dialog.component.html', 8 | styleUrls: ['./redirect-login-dialog.component.css'] 9 | }) 10 | export class RedirectLoginDialogComponent implements OnInit { 11 | 12 | constructor(public ref: DynamicDialogRef, private router: Router) { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | closeDialog() { 18 | this.ref.close(); 19 | } 20 | 21 | redirectToLogin() { 22 | this.router.navigate(['/overview']); 23 | this.ref.close(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/reporting/report-dialog.component.html: -------------------------------------------------------------------------------- 1 |

Audit logs

2 | 3 |

4 | 5 | Sign Me Out 6 | 7 |

8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/app/reporting/reporting.component.css: -------------------------------------------------------------------------------- 1 | .reporting-button-container { 2 | margin-left: 25px; 3 | } 4 | 5 | .reporting-button-container .ui-button { 6 | background-color: #35573b; 7 | border: 1px solid #35573b; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/reporting/reporting.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | -------------------------------------------------------------------------------- /src/app/reporting/reporting.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ReportingComponent } from './reporting.component'; 4 | 5 | describe('ReportingComponent', () => { 6 | let component: ReportingComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ReportingComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ReportingComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/reporting/reporting.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Inject } from '@angular/core'; 2 | import { MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; 3 | 4 | import { AuthenticationService, ReportingService } from '../shared'; 5 | 6 | @Component({ 7 | selector: 'app-report-dialog', 8 | templateUrl: './report-dialog.component.html', 9 | }) 10 | export class ReportDialogComponent { 11 | constructor(@Inject(MAT_DIALOG_DATA) public data: any) { } 12 | } 13 | 14 | @Component({ 15 | selector: 'app-reporting', 16 | templateUrl: './reporting.component.html', 17 | styleUrls: ['./reporting.component.css'] 18 | }) 19 | export class ReportingComponent { 20 | signout = true; 21 | constructor(public dialog: MatDialog, 22 | private authenticationService: AuthenticationService, 23 | private reportingService: ReportingService) { } 24 | 25 | openDialog() { 26 | const dialogRef = this.dialog.open(ReportDialogComponent, { 27 | width: '500px', 28 | height: '500px', 29 | data: { signout: this.signout } 30 | }); 31 | 32 | dialogRef.afterClosed().subscribe(result => { 33 | if (result) { 34 | this.reportingService.exportAuditHistory(); 35 | if (result.signout) { 36 | this.authenticationService.logout(); 37 | } 38 | } 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/app/research-view/research-view.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/research-view/research-view.component.css -------------------------------------------------------------------------------- /src/app/research-view/research-view.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/app/research-view/research-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ResearchViewComponent } from './research-view.component'; 4 | 5 | describe('ResearchViewComponent', () => { 6 | let component: ResearchViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ResearchViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ResearchViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/research-view/research-view.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { TodoService } from '../overview/todo-list/todo.service'; 3 | 4 | @Component({ 5 | selector: 'app-research-view', 6 | templateUrl: './research-view.component.html', 7 | styleUrls: ['./research-view.component.css'] 8 | }) 9 | export class ResearchViewComponent implements OnInit { 10 | 11 | constructor(private todoService: TodoService) { } 12 | 13 | ngOnInit() { 14 | this.todoService.setScreenStocks(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/app/rh-input/rh-input.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/rh-input/rh-input.component.css -------------------------------------------------------------------------------- /src/app/rh-input/rh-input.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /src/app/rh-input/rh-input.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RhInputComponent } from './rh-input.component'; 4 | 5 | describe('RhInputComponent', () => { 6 | let component: RhInputComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ RhInputComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RhInputComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/rh-input/rh-input.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Output, EventEmitter } from '@angular/core'; 2 | import { FormControl, FormGroup, FormBuilder } from '@angular/forms'; 3 | 4 | @Component({ 5 | selector: 'app-rh-input', 6 | templateUrl: './rh-input.component.html', 7 | styleUrls: ['./rh-input.component.css'] 8 | }) 9 | export class RhInputComponent implements OnInit { 10 | @Output() onQuery: EventEmitter = new EventEmitter(); 11 | form: FormGroup; 12 | 13 | constructor(fb: FormBuilder) { 14 | this.form = fb.group({ 15 | query: new FormControl('') 16 | }, {}); 17 | } 18 | 19 | ngOnInit() { 20 | } 21 | 22 | submit() { 23 | if (this.form.value.query) { 24 | this.form.value.query = this.form.value.query.toUpperCase(); 25 | } 26 | this.onQuery.emit(this.form.value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/rh-table/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rh-table.component'; 2 | -------------------------------------------------------------------------------- /src/app/rh-table/rh-table.component.scss: -------------------------------------------------------------------------------- 1 | .table-commands { 2 | text-align: left; 3 | } 4 | 5 | .table-setteings { 6 | text-align: center; 7 | } 8 | 9 | .table-filters { 10 | text-align: right; 11 | .filter { 12 | padding: 0 5px 0 5px; 13 | } 14 | } 15 | 16 | .empty-table { 17 | padding: 25px; 18 | text-align: center; 19 | } 20 | 21 | .table-title { 22 | padding: 5px 10px 5px 10px; 23 | } 24 | 25 | .global-filter { 26 | padding: 3px; 27 | } 28 | 29 | :host ::ng-deep .ui-table .ui-table-thead > tr > th { 30 | position: -webkit-sticky; 31 | position: sticky; 32 | top: 70px; 33 | } 34 | 35 | @media screen and (max-width: 64em) { 36 | :host ::ng-deep .ui-table .ui-table-thead > tr > th { 37 | top: 100px; 38 | } 39 | } 40 | 41 | .summary-title { 42 | font-weight: 500; 43 | } 44 | 45 | .more-options { 46 | padding-right: 10px; 47 | } 48 | 49 | .more-options-container { 50 | width: 11rem; 51 | } 52 | 53 | .bullish-sentiment { 54 | color: #0F9117; 55 | font-weight: 700; 56 | } 57 | 58 | .bearish-sentiment { 59 | color: #ff0000; 60 | font-weight: 700; 61 | } 62 | 63 | .hide-sentiment { 64 | display: none; 65 | } 66 | 67 | .sentiment-title { 68 | font-weight: 500; 69 | } 70 | 71 | .table-commands { 72 | > button, > app-watch-list { 73 | margin-left: 1rem; 74 | } 75 | } -------------------------------------------------------------------------------- /src/app/rh-table/rh-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RhTableComponent } from './rh-table.component'; 4 | 5 | describe('RhTableComponent', () => { 6 | let component: RhTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ RhTableComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RhTableComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/score-board/score-board.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/score-board/score-board.component.css -------------------------------------------------------------------------------- /src/app/score-board/score-board.component.html: -------------------------------------------------------------------------------- 1 | 2 | {{title}} {{score}} 3 | 4 | -------------------------------------------------------------------------------- /src/app/score-board/score-board.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ScoreBoardComponent } from './score-board.component'; 4 | 5 | describe('ScoreBoardComponent', () => { 6 | let component: ScoreBoardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ScoreBoardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ScoreBoardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/score-board/score-board.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnChanges, Input, SimpleChanges } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-score-board', 5 | templateUrl: './score-board.component.html', 6 | styleUrls: ['./score-board.component.css'] 7 | }) 8 | export class ScoreBoardComponent implements OnChanges { 9 | @Input() title: string; 10 | @Input() score: number; 11 | 12 | constructor() { } 13 | 14 | ngOnChanges(changes: SimpleChanges) { 15 | if (changes.score) { 16 | this.score = changes.score.currentValue; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/settings/global-settings.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GlobalSettingsService } from './global-settings.service'; 4 | 5 | describe('GlobalSettingsService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GlobalSettingsService = TestBed.get(GlobalSettingsService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/settings/setting-controls/setting-controls.component.css: -------------------------------------------------------------------------------- 1 | .setting-controls-container { 2 | margin: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/settings/setting-controls/setting-controls.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SettingControlsComponent } from './setting-controls.component'; 4 | 5 | describe('SettingControlsComponent', () => { 6 | let component: SettingControlsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ SettingControlsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SettingControlsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/settings/setting-controls/setting-controls.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { GlobalSettingsService, Brokerage } from '../global-settings.service'; 3 | import * as moment from 'moment-timezone'; 4 | 5 | @Component({ 6 | selector: 'app-setting-controls', 7 | templateUrl: './setting-controls.component.html', 8 | styleUrls: ['./setting-controls.component.css'] 9 | }) 10 | export class SettingControlsComponent { 11 | ismeridian = true; 12 | constructor(public globalSettingsService: GlobalSettingsService) { } 13 | 14 | toggleMode(): void { 15 | this.ismeridian = !this.ismeridian; 16 | } 17 | 18 | toggleBrokerage(): void { 19 | if (this.globalSettingsService.brokerage === Brokerage.Robinhood) { 20 | this.globalSettingsService.brokerage = Brokerage.Td; 21 | } else if (this.globalSettingsService.brokerage === Brokerage.Td) { 22 | this.globalSettingsService.brokerage = Brokerage.Robinhood; 23 | } 24 | } 25 | 26 | toggleBacktesting(): void { 27 | this.globalSettingsService.backtesting = !this.globalSettingsService.backtesting; 28 | } 29 | 30 | toggleAutostart(): void { 31 | this.globalSettingsService.setAutoStart(); 32 | } 33 | 34 | setTradeDate(event) { 35 | console.log(event); 36 | this.globalSettingsService.tradeDate = moment(event); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/settings/settings.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { SettingControlsComponent } from './setting-controls/setting-controls.component'; 4 | import { TimepickerModule } from 'ngx-bootstrap/timepicker'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { MatGridListModule } from '@angular/material/grid-list'; 7 | import { MatTooltipModule } from '@angular/material/tooltip'; 8 | import { MatSlideToggleModule } from '@angular/material/slide-toggle'; 9 | 10 | import { DropdownModule } from 'primeng/dropdown'; 11 | 12 | @NgModule({ 13 | declarations: [SettingControlsComponent], 14 | imports: [ 15 | CommonModule, 16 | TimepickerModule.forRoot(), 17 | FormsModule, 18 | MatGridListModule, 19 | MatTooltipModule, 20 | MatSlideToggleModule, 21 | DropdownModule 22 | ], 23 | exports: [ 24 | SettingControlsComponent 25 | ] 26 | }) 27 | export class SettingsModule { } 28 | -------------------------------------------------------------------------------- /src/app/shared/account.ts: -------------------------------------------------------------------------------- 1 | export interface Account { 2 | unsettled_funds?: number; 3 | uncleared_deposits?: number; 4 | unsettled_debit?: number; 5 | account?: string; 6 | cash?: number; 7 | cash_held_for_orders?: number; 8 | buying_power?: number; 9 | stocks?: number; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/shared/algo-param.interface.ts: -------------------------------------------------------------------------------- 1 | export interface AlgoParam { 2 | ticker: string; 3 | start: string; 4 | end: string; 5 | deviation?: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/shared/daily-backtest.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { DailyBacktestService } from './daily-backtest.service'; 4 | 5 | describe('DailyBacktestService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: DailyBacktestService = TestBed.get(DailyBacktestService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/daily-backtest.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { environment } from '../../environments/environment'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { Observable } from 'rxjs'; 5 | 6 | const BASE_URL = environment.appUrl; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class DailyBacktestService { 12 | 13 | constructor(private http: HttpClient) { } 14 | 15 | getSignalScores(signals: any): Observable { 16 | 17 | const data = { 18 | signals 19 | }; 20 | 21 | return this.http.post(`${BASE_URL}api/backtest/score-signals`, data, {}); 22 | } 23 | 24 | getPop(bullishIndicators: string[], bearishIndicators: string[], signals: any): Observable { 25 | const data = { 26 | bullishActiveIndicators: bullishIndicators, 27 | bearishActiveIndicators: bearishIndicators, 28 | signals 29 | }; 30 | 31 | return this.http.post(`${BASE_URL}api/backtest/pop`, data, {}); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/shared/enums/daytrade-algorithms.enum.ts: -------------------------------------------------------------------------------- 1 | export enum DaytradeAlgorithms { 2 | Default = 'default', 3 | DayTrade = 'daytrade', 4 | Buy = 'buy', 5 | Sell = 'sell', 6 | BuyNearOpen = 'buyNearOpen', 7 | BuyNearClose = 'buyNearClose' 8 | } 9 | -------------------------------------------------------------------------------- /src/app/shared/enums/order-pref.enum.ts: -------------------------------------------------------------------------------- 1 | export enum OrderPref { 2 | TakeProfit = 'Take Profit', 3 | StopLoss = 'Stop Loss', 4 | SellAtClose = 'Sell positions on the close', 5 | TrailingStopLoss = 'Trailing Stop Loss', 6 | BuyCloseSellOpen = 'Buy on the Close, Sell on the Open', 7 | SellAtOpen = 'Sell positions on the Open', 8 | BuyAt3SellBeforeClose = 'Buy at 3pm, Sell before the Close', 9 | MlBuySellAtClose = 'ML model Buy/Sell on the close', 10 | ExecuteOrderIfOpenUp = 'Execute order only if stock opens up', 11 | ExecuteOrderIfOpenDown = 'Execute order only if stock opens down', 12 | } 13 | -------------------------------------------------------------------------------- /src/app/shared/index.ts: -------------------------------------------------------------------------------- 1 | export { Stock } from './stock.interface'; 2 | export { 3 | BacktestService, 4 | AuthenticationService, 5 | PortfolioService, 6 | DaytradeService, 7 | ReportingService, 8 | ScoreKeeperService, 9 | IndicatorsService, 10 | AlgoService, 11 | TradeService 12 | } from './services'; 13 | export { AlgoParam } from './algo-param.interface'; 14 | export { Row } from './row.interface'; 15 | export { MachineLearningService } from './services/machine-learning/machine-learning.service'; 16 | export { SmartOrder } from './models/smart-order'; 17 | -------------------------------------------------------------------------------- /src/app/shared/models/algo-chart-v2.ts: -------------------------------------------------------------------------------- 1 | export interface AlgoChartV2 { 2 | date: number; 3 | action: string; 4 | deviation: number; 5 | shortTermAverage: number; 6 | longTermAverage: number; 7 | volumeChange: number; 8 | close: number; 9 | volume: number; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/shared/models/card-options.ts: -------------------------------------------------------------------------------- 1 | export interface CardOptions { 2 | TakeProfit: boolean; 3 | StopLoss: boolean; 4 | SellAtClose: boolean; 5 | TrailingStopLoss: boolean; 6 | MlBuySellAtClose: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/shared/models/holding.interface.ts: -------------------------------------------------------------------------------- 1 | export interface Holding { 2 | quantity?: number; 3 | average_buy_price?: number; 4 | created_at?: Date; 5 | updated_at?: Date; 6 | instrument: string; 7 | symbol: string; 8 | realtime_price?: number; 9 | Volume?: number; 10 | gainz?: number; 11 | diversification?: number; 12 | shares_held_for_sells?: number; 13 | name?: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/app/shared/models/index.ts: -------------------------------------------------------------------------------- 1 | export { Holding } from './holding.interface'; 2 | -------------------------------------------------------------------------------- /src/app/shared/models/indicators.ts: -------------------------------------------------------------------------------- 1 | export interface Indicators { 2 | mfi: number; 3 | momentum: number; 4 | vwma: number; 5 | roc10: number; 6 | band: any[]; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/shared/models/order-row.ts: -------------------------------------------------------------------------------- 1 | export interface OrderRow { 2 | symbol: string; 3 | quantity: number; 4 | price: number; 5 | side: string; 6 | Stop?: number; 7 | TrailingStop?: number; 8 | Target?: number; 9 | StopLoss?: boolean; 10 | TrailingStopLoss?: boolean; 11 | TakeProfit?: boolean; 12 | MeanReversion1?: boolean; 13 | Mfi?: boolean; 14 | SpyMomentum?: boolean; 15 | SellAtClose?: boolean; 16 | YahooData?: boolean; 17 | OrderSize?: number; 18 | } 19 | -------------------------------------------------------------------------------- /src/app/shared/models/order.ts: -------------------------------------------------------------------------------- 1 | import { Holding } from './holding.interface'; 2 | 3 | export interface Order { 4 | holding: Holding; 5 | quantity: number; 6 | price: number; 7 | submitted: boolean; 8 | pending: boolean; 9 | side: string; 10 | amount?: number; 11 | id?: string; 12 | } 13 | -------------------------------------------------------------------------------- /src/app/shared/models/service-status.ts: -------------------------------------------------------------------------------- 1 | export interface ServiceStatus { 2 | status: String; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/shared/models/smart-order.ts: -------------------------------------------------------------------------------- 1 | import { Order } from './order'; 2 | 3 | export interface SmartOrder extends Order { 4 | splits?: number; 5 | positionCount?: number; 6 | timeSubmitted?: string; 7 | signalTime?: number; 8 | lossThreshold?: number; 9 | profitTarget?: number; 10 | trailingStop?: number; 11 | useStopLoss?: boolean; 12 | useTrailingStopLoss?: boolean; 13 | useTakeProfit?: boolean; 14 | sellAtClose?: boolean; 15 | yahooData?: boolean; 16 | orderSize?: number; 17 | init?: boolean; 18 | stopped?: boolean; 19 | lastUpdated?: string; 20 | allocation?: number; 21 | } 22 | -------------------------------------------------------------------------------- /src/app/shared/models/stock-score.ts: -------------------------------------------------------------------------------- 1 | export interface StockScore { 2 | stock: string; 3 | profitLoss: number; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/shared/models/trade.ts: -------------------------------------------------------------------------------- 1 | export interface Trade { 2 | stock: string; 3 | entryPrice: number; 4 | exitPrice: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/shared/models/winloss.ts: -------------------------------------------------------------------------------- 1 | export interface Winloss { 2 | wins: number; 3 | losses: number; 4 | total: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/shared/options-data.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { OptionsDataService } from './options-data.service'; 4 | 5 | describe('OptionsDataService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: OptionsDataService = TestBed.get(OptionsDataService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/options-data.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class OptionsDataService { 9 | 10 | constructor(private http: HttpClient) { } 11 | 12 | getImpliedMove(symbol: string): Observable { 13 | const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); 14 | 15 | const options = { 16 | headers, 17 | params: { 18 | symbol, 19 | strikeCount: '4', 20 | optionType: 'S' 21 | } 22 | }; 23 | 24 | return this.http.get('/api/options/implied-move', options); } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/app/shared/pipes/instrument.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | // import { InstrumentPipe } from './instrument.pipe'; 2 | // import {PortfolioService } from '.././services/portfolio.service'; 3 | // describe('InstrumentPipe', () => { 4 | 5 | // xit('createcreate an instance', () => { 6 | // const pipe = new InstrumentPipe(); 7 | // expect(pipe).toBeTruthy(); 8 | // }); 9 | // }); 10 | -------------------------------------------------------------------------------- /src/app/shared/pipes/instrument.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { PortfolioService } from '../services'; 3 | 4 | @Pipe({ 5 | name: 'instrument', 6 | pure: false 7 | }) 8 | export class InstrumentPipe implements PipeTransform { 9 | private cachedData: any = null; 10 | private cachedUrl = ''; 11 | 12 | constructor(private portfolioService: PortfolioService) { } 13 | 14 | transform(url: any, args?: any): any { 15 | if (url !== this.cachedUrl) { 16 | this.cachedData = null; 17 | this.cachedUrl = url; 18 | this.portfolioService.getResource(url) 19 | .subscribe( result => this.cachedData = result.symbol ); 20 | } 21 | 22 | return this.cachedData; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/shared/row.interface.ts: -------------------------------------------------------------------------------- 1 | export interface Row { 2 | Stock: string; 3 | Start: string; 4 | End: string; 5 | Short: number; 6 | Long: number; 7 | Deviation?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/shared/service/scheduler.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { SchedulerService } from './scheduler.service'; 4 | 5 | describe('SchedulerService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: SchedulerService = TestBed.get(SchedulerService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/ai-picks.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AiPicksService } from './ai-picks.service'; 4 | 5 | describe('AiPicksService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: AiPicksService = TestBed.get(AiPicksService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/algo.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { AlgoService } from './algo.service'; 4 | 5 | describe('AlgoService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [AlgoService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([AlgoService], (service: AlgoService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/algo.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import * as _ from 'lodash'; 3 | 4 | @Injectable() 5 | export class AlgoService { 6 | 7 | constructor() { } 8 | 9 | isOversoldBullish(roc10: number, momentum: number, mfi: number): boolean { 10 | const momentumDiff = _.round(_.divide(momentum, roc10), 3); 11 | const rocDiffRange = [-0.5, 0.6]; 12 | 13 | if (momentumDiff < rocDiffRange[0] || momentumDiff > rocDiffRange[1]) { 14 | if (mfi < 9) { 15 | return true; 16 | } 17 | } 18 | return false; 19 | } 20 | 21 | 22 | isMomentumBullish(price: number, mid: number, mfi: number, roc10: number, momentum: number): boolean { 23 | const momentumDiff = _.round(_.divide(momentum, roc10), 3); 24 | const rocDiffRange = [-0.5, 0.6]; 25 | 26 | if (momentumDiff > rocDiffRange[1]) { 27 | if (price >= mid) { 28 | if (mfi < 15) { 29 | return true; 30 | } 31 | } 32 | } 33 | return false; 34 | } 35 | 36 | isBBandMeanReversionBullish(price: number, low: number, mfi: number, roc10: number, momentum: number): boolean { 37 | const momentumDiff = _.round(_.divide(momentum, roc10), 4); 38 | const rocDiffRange = [-0.4, 1.8]; 39 | 40 | if (momentumDiff < rocDiffRange[0] || momentumDiff > rocDiffRange[1]) { 41 | if (price <= low) { 42 | if (mfi < 15) { 43 | return true; 44 | } 45 | } 46 | } 47 | return false; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/app/shared/services/authentication.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { AuthenticationService } from './authentication.service'; 4 | 5 | describe('AuthenticationService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [AuthenticationService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([AuthenticationService], (service: AuthenticationService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/backtest.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { BacktestService } from './backtest.service'; 4 | 5 | describe('Backtest.ServiceService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [BacktestService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([BacktestService], (service: BacktestService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/cart.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { CartService } from './cart.service'; 4 | 5 | describe('CartService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [CartService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([CartService], (service: CartService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/client-sms.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ClientSmsService } from './client-sms.service'; 4 | 5 | describe('ClientSmsService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: ClientSmsService = TestBed.get(ClientSmsService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/client-sms.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { environment } from '../../../environments/environment'; 5 | 6 | const BASE_URL = environment.appUrl; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class ClientSmsService { 12 | 13 | constructor(private http: HttpClient) { } 14 | 15 | sendBuySms(symbol: string, phoneNumber: string, price: number, quantity: number, message: string = ''): Observable { 16 | const data = { 17 | phone: phoneNumber, 18 | stock: symbol, 19 | price, 20 | quantity, 21 | message 22 | }; 23 | 24 | return this.http.post(`${BASE_URL}api/sms/buy`, data, {}); 25 | } 26 | 27 | sendSellSms(symbol: string, phoneNumber: string, price: number, quantity: number, message: string = ''): Observable { 28 | const data = { 29 | phone: phoneNumber, 30 | stock: symbol, 31 | price, 32 | quantity, 33 | message 34 | }; 35 | 36 | return this.http.post(`${BASE_URL}api/sms/sell`, data, {}); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/shared/services/daytrade-manager.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { DaytradeManagerService } from './daytrade-manager.service'; 4 | 5 | describe('DaytradeManagerService', () => { 6 | let service: DaytradeManagerService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(DaytradeManagerService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/shared/services/daytrade-manager.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class DaytradeManagerService { 7 | allocationSizes = [0.05, 0.1, 0.25, 0.5]; 8 | alive = false; 9 | ordersCount = 1; 10 | constructor() { } 11 | 12 | initialize() { 13 | 14 | } 15 | 16 | executeDaytrade() {} 17 | 18 | trimLosers() { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/app/shared/services/excel-service.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { ExcelService } from './excel-service.service'; 4 | 5 | describe('ExcelServiceService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [ExcelService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([ExcelService], (service: ExcelService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/excel-service.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import * as XLSX from 'xlsx'; 3 | 4 | const EXCEL_EXTENSION = '.xlsx'; 5 | 6 | @Injectable() 7 | export class ExcelService { 8 | 9 | constructor() { } 10 | 11 | public exportAsExcelFile(json: any[], excelFileName: string): void { 12 | /* generate worksheet */ 13 | const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json); 14 | 15 | /* generate workbook and add the worksheet */ 16 | const wb: XLSX.WorkBook = XLSX.utils.book_new(); 17 | XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); 18 | 19 | /* save to file */ 20 | XLSX.writeFile(wb, excelFileName + '_export' + EXCEL_EXTENSION); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/shared/services/global-task-queue.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GlobalTaskQueueService } from './global-task-queue.service'; 4 | 5 | describe('GlobalTaskQueueService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GlobalTaskQueueService = TestBed.get(GlobalTaskQueueService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/index.ts: -------------------------------------------------------------------------------- 1 | export { BacktestService } from './backtest.service'; 2 | export { AuthenticationService } from './authentication.service'; 3 | export { PortfolioService, PortfolioInfoHolding } from './portfolio.service'; 4 | export { DaytradeService } from './daytrade.service'; 5 | export { ReportingService } from './reporting.service'; 6 | export { ScoreKeeperService } from './score-keeper.service'; 7 | export { IndicatorsService } from './indicators.service'; 8 | export { AlgoService } from './algo.service'; 9 | export { TradeService } from './trade.service'; 10 | export { CartService } from './cart.service'; 11 | export { AiPicksService } from './ai-picks.service'; 12 | export { MachineLearningService } from './machine-learning/machine-learning.service'; 13 | -------------------------------------------------------------------------------- /src/app/shared/services/indicators.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { IndicatorsService } from './indicators.service'; 4 | 5 | describe('IndicatorsService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [IndicatorsService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([IndicatorsService], (service: IndicatorsService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/local-preferences.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { LocalPreferences } from './local-preferences.service'; 4 | 5 | describe('MlBuyAtCloseService', () => { 6 | let service: LocalPreferences; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(LocalPreferences); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/shared/services/local-preferences.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class LocalPreferences { 7 | constructor() { } 8 | 9 | setLocalStorage(storageKey: string, preferenceKey: string, preferenceObj: any) { 10 | const mlBuyAtCloseServicePref = JSON.parse(localStorage.getItem(storageKey)); 11 | if (mlBuyAtCloseServicePref) { 12 | mlBuyAtCloseServicePref[preferenceKey] = preferenceObj; 13 | localStorage.setItem(storageKey, JSON.stringify(mlBuyAtCloseServicePref)); 14 | } else { 15 | const newStorageObj = {}; 16 | newStorageObj[preferenceKey] = true; 17 | localStorage.setItem(preferenceObj, JSON.stringify(newStorageObj)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/shared/services/machine-learning/machine-learning.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { MachineLearningService } from './machine-learning.service'; 4 | 5 | describe('MachineLearningService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: MachineLearningService = TestBed.get(MachineLearningService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/ordering.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { OrderingService } from './ordering.service'; 4 | 5 | describe('OrderingService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: OrderingService = TestBed.get(OrderingService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/portfolio.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { PortfolioService } from './portfolio.service'; 4 | 5 | describe('PortfolioService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [PortfolioService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([PortfolioService], (service: PortfolioService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/reporting.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { ReportingService } from './reporting.service'; 4 | 5 | describe('ReportingService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [ReportingService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([ReportingService], (service: ReportingService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/score-keeper.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { ScoreKeeperService } from './score-keeper.service'; 4 | 5 | describe('ScoreKeeperService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [ScoreKeeperService] 9 | }); 10 | }); 11 | 12 | xit('createshould be created', inject([ScoreKeeperService], (service: ScoreKeeperService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/score-signal-factory.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ScoreSignalFactoryService } from './score-signal-factory.service'; 4 | 5 | describe('ScoreSignalFactoryService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: ScoreSignalFactoryService = TestBed.get(ScoreSignalFactoryService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/shared/services/trade.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { TradeService } from './trade.service'; 4 | 5 | describe('TradeService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [TradeService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([TradeService], (service: TradeService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/services/trade.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Subject } from 'rxjs'; 3 | 4 | export interface AlgoQueueItem { 5 | symbol: string; 6 | id?: string; 7 | reset: boolean; 8 | updateOrder?: boolean; 9 | triggerMlBuySell?: boolean; 10 | } 11 | 12 | @Injectable() 13 | export class TradeService { 14 | algoQueue: Subject = new Subject(); 15 | 16 | constructor() { } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/app/shopping-list/shopping-list.component.css: -------------------------------------------------------------------------------- 1 | .shopping-list { 2 | margin: 25px; 3 | } 4 | 5 | .order-card { 6 | margin-top: 10px; 7 | } 8 | 9 | .default-orders-button { 10 | margin-left: 10px; 11 | } 12 | 13 | .action-buttons { 14 | margin-bottom: 1rem; 15 | margin-top: 1rem; 16 | } -------------------------------------------------------------------------------- /src/app/shopping-list/shopping-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 |

Shopping List

16 | 17 |
18 | 20 | 21 |
22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /src/app/shopping-list/shopping-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ShoppingListComponent } from './shopping-list.component'; 4 | 5 | describe('ShoppingListComponent', () => { 6 | let component: ShoppingListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ShoppingListComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ShoppingListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/simple-card/simple-card.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/simple-card/simple-card.component.css -------------------------------------------------------------------------------- /src/app/simple-card/simple-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SimpleCardComponent } from './simple-card.component'; 4 | 5 | describe('SimpleCardComponent', () => { 6 | let component: SimpleCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ SimpleCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SimpleCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/sms-card/sms-card.component.css: -------------------------------------------------------------------------------- 1 | .sms-form { 2 | display: flex; 3 | } -------------------------------------------------------------------------------- /src/app/sms-card/sms-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SmsCardComponent } from './sms-card.component'; 4 | 5 | describe('SmsCardComponent', () => { 6 | let component: SmsCardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ SmsCardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SmsCardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/stocklist-cleanup/stocklist-cleanup.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/stocklist-cleanup/stocklist-cleanup.component.css -------------------------------------------------------------------------------- /src/app/stocklist-cleanup/stocklist-cleanup.component.html: -------------------------------------------------------------------------------- 1 |

2 | stocklist-cleanup works! 3 |

4 | -------------------------------------------------------------------------------- /src/app/stocklist-cleanup/stocklist-cleanup.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { StocklistCleanupComponent } from './stocklist-cleanup.component'; 4 | 5 | describe('StocklistCleanupComponent', () => { 6 | let component: StocklistCleanupComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ StocklistCleanupComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(StocklistCleanupComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/stocklist-cleanup/stocklist-cleanup.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-stocklist-cleanup', 5 | templateUrl: './stocklist-cleanup.component.html', 6 | styleUrls: ['./stocklist-cleanup.component.css'] 7 | }) 8 | export class StocklistCleanupComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/stocklist/stocklist.component.css: -------------------------------------------------------------------------------- 1 | .actions { 2 | margin: 100px; 3 | } 4 | 5 | .clean-stock-list{ 6 | margin: 50px 0 50px 250px; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/stocklist/stocklist.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 | '{{stock}}', 8 |
9 |
10 | -------------------------------------------------------------------------------- /src/app/stocklist/stocklist.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { StocklistComponent } from './stocklist.component'; 4 | 5 | describe('StocklistComponent', () => { 6 | let component: StocklistComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ StocklistComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(StocklistComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/stocklist/stocklist.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { stockList } from '../rh-table/backtest-stocks.constant'; 3 | import { PortfolioService } from '@shared/services'; 4 | import { GlobalTaskQueueService } from '@shared/services/global-task-queue.service'; 5 | 6 | @Component({ 7 | selector: 'app-stocklist', 8 | templateUrl: './stocklist.component.html', 9 | styleUrls: ['./stocklist.component.css'] 10 | }) 11 | export class StocklistComponent implements OnInit { 12 | messages = []; 13 | cleanList: string[] = []; 14 | constructor(private portfolioService: PortfolioService, 15 | private globalTaskQueueService: GlobalTaskQueueService) { } 16 | 17 | ngOnInit() { 18 | } 19 | 20 | removeStock(stock: string) { 21 | this.messages.push({ severity: 'info', summary: stock, detail: 'Removed' }); 22 | } 23 | 24 | isInvalidStock(stock, price) { 25 | if (price < 15) { 26 | return true; 27 | } 28 | 29 | const foundIdx = this.cleanList.findIndex((value) => value === stock); 30 | 31 | if (foundIdx !== -1) { 32 | return true; 33 | } 34 | } 35 | 36 | addStock(stock: string) { 37 | this.cleanList.push(stock); 38 | } 39 | 40 | async cleanStockList() { 41 | for (const stock of stockList) { 42 | const getPrice = (price) => { 43 | if (this.isInvalidStock(stock, price)) { 44 | this.removeStock(stock); 45 | } else { 46 | this.addStock(stock); 47 | } 48 | }; 49 | this.globalTaskQueueService.addTask(this.portfolioService.getPrice(stock), getPrice, () => { }); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/app/strategies/find-pattern.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FindPatternService } from './find-pattern.service'; 4 | 5 | describe('MlBuyAtCloseService', () => { 6 | let service: FindPatternService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(FindPatternService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/terminal-view/terminal-view.component.html: -------------------------------------------------------------------------------- 1 |
2 |

/Users/cashmoney/Documents/merchant/

3 |
    4 |
  • 5 | 6 |
  • 7 |
  • 8 | 9 |
  • 10 |
11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 28 | 29 | 30 | 31 | 32 | 35 | 38 | 39 | 40 | 41 |
PID#
23 | {{buys.holding.symbol}} 24 | 26 | {{buys.positionCount}} 27 |
33 | {{other.holding.symbol}} 34 | 36 | {{other.positionCount}} 37 |
42 |
43 |
    44 |
  • 45 |
    46 | {{log.time}} {{log.symbol}} {{log.message}} 47 |
    48 |
  • 49 |
50 |
51 | -------------------------------------------------------------------------------- /src/app/terminal-view/terminal-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TerminalViewComponent } from './terminal-view.component'; 4 | 5 | describe('TerminalViewComponent', () => { 6 | let component: TerminalViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TerminalViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TerminalViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/terminal-view/terminal-view.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ReportingService, ScoreKeeperService } from '../shared'; 3 | import { CartService } from '../shared/services/cart.service'; 4 | 5 | @Component({ 6 | selector: 'app-terminal-view', 7 | templateUrl: './terminal-view.component.html', 8 | styleUrls: ['./terminal-view.component.css'] 9 | }) 10 | export class TerminalViewComponent implements OnInit { 11 | 12 | constructor(public cartService: CartService, 13 | public reportingService: ReportingService, 14 | public scoreKeeperService: ScoreKeeperService) { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/app/test-results-table/test-results-table.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/app/test-results-table/test-results-table.component.css -------------------------------------------------------------------------------- /src/app/test-results-table/test-results-table.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 21 |
ResultsWinnersLosers
12 | Number of trades 13 |
17 | Maximum Profit/Loss 18 |
22 | -------------------------------------------------------------------------------- /src/app/test-results-table/test-results-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TestResultsTableComponent } from './test-results-table.component'; 4 | 5 | describe('TestResultsTableComponent', () => { 6 | let component: TestResultsTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TestResultsTableComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TestResultsTableComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/test-results-table/test-results-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-test-results-table', 5 | templateUrl: './test-results-table.component.html', 6 | styleUrls: ['./test-results-table.component.css'] 7 | }) 8 | export class TestResultsTableComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/trade-view/trade-view.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/app/trade-view/trade-view.component.scss: -------------------------------------------------------------------------------- 1 | .robinhood { 2 | color: #ffff; 3 | background-color: #21ce99; 4 | } 5 | 6 | .td { 7 | color: #1b1b1d; 8 | background-color: #FAFAFA; 9 | .mat-tab-label-content { 10 | color: #1b1b1d; 11 | } 12 | } 13 | 14 | /* Styles for tab labels */ 15 | .mat-tab-label { 16 | min-width: 25px; 17 | padding: 5px; 18 | background-color: transparent; 19 | color: #ffff; 20 | opacity: 0.7; 21 | font-weight: 700; 22 | } 23 | 24 | /* Styles for the active tab label */ 25 | .mat-tab-label.mat-tab-label-active { 26 | min-width: 25px; 27 | padding: 5px; 28 | background-color: transparent; 29 | color: #ffff; 30 | font-weight: 700; 31 | } 32 | -------------------------------------------------------------------------------- /src/app/trade-view/trade-view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TradeViewComponent } from './trade-view.component'; 4 | 5 | describe('MainViewComponent', () => { 6 | let component: TradeViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TradeViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TradeViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/trade-view/trade-view.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { AuthenticationService } from '../shared'; 3 | import { GlobalSettingsService } from '../settings/global-settings.service'; 4 | import { ViewEncapsulation } from '@angular/core'; 5 | 6 | @Component({ 7 | selector: 'app-trade-view', 8 | templateUrl: './trade-view.component.html', 9 | styleUrls: ['./trade-view.component.scss'], 10 | encapsulation: ViewEncapsulation.None 11 | }) 12 | export class TradeViewComponent { 13 | isLinear = false; 14 | 15 | constructor(private authenticationService: AuthenticationService, public globalSettingsService: GlobalSettingsService) { } 16 | 17 | isAuthenticated() { 18 | return this.authenticationService.isAuthenticated(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/watch-list/watch-list.component.css: -------------------------------------------------------------------------------- 1 | .uppercase { 2 | text-transform: uppercase; 3 | } 4 | 5 | .order-form-item { 6 | padding-top: 1rem; 7 | padding-bottom: 1rem; 8 | } 9 | 10 | .action-buttons { 11 | padding-top: 3px; 12 | 13 | } 14 | 15 | .add-button { 16 | float: right; 17 | } 18 | 19 | .remove-button { 20 | float: left; 21 | } -------------------------------------------------------------------------------- /src/app/watch-list/watch-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { WatchListComponent } from './watch-list.component'; 4 | 5 | describe('WatchListComponent', () => { 6 | let component: WatchListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ WatchListComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(WatchListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/watch-list/watch-list.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { WatchListService } from './watch-list.service'; 4 | 5 | describe('WatchListService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: WatchListService = TestBed.get(WatchListService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/watch-list/watch-list.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class WatchListService { 7 | public watchList = []; 8 | constructor() { 9 | if (sessionStorage.getItem('watchList')) { 10 | const savedList = JSON.parse(sessionStorage.getItem('watchList')); 11 | this.watchList = savedList; 12 | } 13 | } 14 | 15 | saveWatchList() { 16 | sessionStorage.setItem('watchList', JSON.stringify(this.watchList)); 17 | } 18 | 19 | addWatchItem(stock: string, phoneNumber: string) { 20 | this.watchList.push({ stock, phoneNumber }); 21 | this.saveWatchList(); 22 | } 23 | 24 | removeWatchItem(stock: string, phoneNumber: string) { 25 | const index = this.watchList.findIndex(item => { 26 | if (item.stock === stock && item.phoneNumber === phoneNumber) { 27 | return true; 28 | } 29 | return false; 30 | }); 31 | this.watchList.splice(index, 1); 32 | this.saveWatchList(); 33 | } 34 | 35 | removeAll() { 36 | this.watchList = []; 37 | this.saveWatchList(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/xls-import/xls-import.component.css: -------------------------------------------------------------------------------- 1 | .import-card { 2 | width: auto; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/xls-import/xls-import.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/xls-import/xls-import.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { XlsImportComponent } from './xls-import.component'; 4 | 5 | describe('XlsImportComponent', () => { 6 | let component: XlsImportComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ XlsImportComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(XlsImportComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | xit('createshould create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/xls-import/xls-import.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild, Output, EventEmitter } from '@angular/core'; 2 | import * as XLSX from 'xlsx'; 3 | 4 | @Component({ 5 | selector: 'app-xls-import', 6 | templateUrl: './xls-import.component.html', 7 | styleUrls: ['./xls-import.component.css'] 8 | }) 9 | export class XlsImportComponent implements OnInit { 10 | @ViewChild('fileInput', {static: false}) fileInput; 11 | @Output() onImport: EventEmitter = new EventEmitter(); 12 | constructor() { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | upload() { 18 | const reader = new FileReader(); 19 | const fileBrowser = this.fileInput.nativeElement; 20 | 21 | const overwriteOnload = function (evt: any) { 22 | const data = evt.target.result; 23 | 24 | const workbook = XLSX.read(data, { type: 'binary' }); 25 | 26 | const parsedData = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]); 27 | 28 | this.onImport.emit(parsedData); 29 | }; 30 | 31 | reader.onload = overwriteOnload.bind(this); 32 | 33 | reader.readAsBinaryString(fileBrowser.files[0]); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/bear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/assets/bear.png -------------------------------------------------------------------------------- /src/assets/bull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/assets/bull.png -------------------------------------------------------------------------------- /src/environments/client-config.ts: -------------------------------------------------------------------------------- 1 | const configurations = { 2 | port: 9000, 3 | goliathDataServiceUrl: 'http://localhost:8100/', 4 | armidilloMlServiceUrl: 'http://localhost:3000/' 5 | }; 6 | 7 | export default configurations; 8 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | envName: 'prod', 4 | appUrl: '/' 5 | }; 6 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | import * as credentials from './client-config'; 6 | import * as _ from 'lodash'; 7 | 8 | const goliathDataServiceUrl = _.get(credentials, 9 | 'default.goliathDataServiceUrl', _.get(credentials, 'goliathDataServiceUrl', null)) || 9000; 10 | const armidilloMlServiceUrl = _.get(credentials, 11 | 'default.goliathDataServiceUrl', _.get(credentials, 'goliathDataServiceUrl', null)) || 9000; 12 | 13 | export const environment = { 14 | production: false, 15 | envName: 'dev', 16 | appUrl: '/', 17 | goliathDataServiceUrl, 18 | armidilloMlServiceUrl 19 | }; 20 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Artimatic/td-algorithmic-trading-in-angular/1e87833e9d54ef0bc67f89c74997aa1cb4424af2/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Algo Trader 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Loading... 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/robinhood-merchant-theme.scss: -------------------------------------------------------------------------------- 1 | @import '~@angular/material/theming'; 2 | 3 | // Plus imports for other components in your app. 4 | 5 | // Include the common styles for Angular Material. We include this here so that you only 6 | // have to load a single css file for Angular Material in your app. 7 | // Be sure that you only ever include this mixin once! 8 | @include mat-core(); 9 | 10 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 11 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 12 | // hue. 13 | $robinhood-merchant-primary: mat-palette($mat-green); 14 | $robinhood-merchant-accent: mat-palette($mat-amber, A200, A100, A400); 15 | 16 | // The warn palette is optional (defaults to red). 17 | $robinhood-merchant-warn: mat-palette($mat-red); 18 | 19 | // Create the theme object (a Sass map containing all of the palettes). 20 | $robinhood-merchant-theme: mat-light-theme($robinhood-merchant-primary, $robinhood-merchant-accent, $robinhood-merchant-warn); 21 | 22 | // Include theme styles for core and each component used in your app. 23 | // Alternatively, you can import and @include the theme mixins for each component 24 | // that you are using. 25 | @include angular-material-theme($robinhood-merchant-theme); 26 | 27 | a { 28 | .p-steps .p-steps-item .p-menuitem-link { 29 | background: transparent; 30 | transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; 31 | border-radius: 3px; 32 | background: transparent; 33 | } 34 | } -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import '~@angular/material/prebuilt-themes/indigo-pink.css'; 3 | @import '~primeng/resources/primeng.min.css'; 4 | 5 | @import '~primeng/resources/themes/arya-blue/theme.css'; 6 | 7 | html body { 8 | display: block; 9 | margin: 0; 10 | background: #2a281c; 11 | color: #f5f5f5; 12 | } 13 | 14 | mat-card.mat-card.mat-focus-indicator { 15 | background: #a0b0b0; 16 | } 17 | 18 | .mat-form-field-label { 19 | color: white; 20 | } 21 | 22 | button.nav-item { 23 | width:160px; 24 | text-align: left; 25 | } 26 | 27 | .button-separator { 28 | margin-right: 1rem; 29 | } 30 | 31 | .mat-checkbox-layout { 32 | white-space: pre-wrap !important; 33 | } 34 | 35 | .table-cell { 36 | overflow: hidden; 37 | text-overflow: ellipsis; 38 | -o-text-overflow: ellipsis; 39 | white-space: nowrap; 40 | width: 100%; 41 | } 42 | 43 | .app-title { 44 | color: white; 45 | font-weight: 800; 46 | font-family: monospace; 47 | font-size: larger; 48 | } 49 | 50 | .mat-drawer-inner-container { 51 | background-color: #2c2c52; 52 | color: white; 53 | } 54 | 55 | .online-status-text { 56 | font-size: 10px; 57 | cursor: pointer; 58 | } 59 | 60 | .ui-button { 61 | margin: 1em; 62 | } 63 | 64 | .uppercase { 65 | text-transform: uppercase; 66 | } 67 | 68 | .ui-g { 69 | display: flex; 70 | flex-direction: column; 71 | } 72 | 73 | .p-steps .p-steps-item .p-menuitem-link { 74 | background: transparent; 75 | transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; 76 | border-radius: 3px; 77 | background: transparent; 78 | } -------------------------------------------------------------------------------- /src/td req.json: -------------------------------------------------------------------------------- 1 | { 2 | "orderType": "LIMIT", 3 | "session": "NORMAL", 4 | "duration": "DAY", 5 | "orderStrategyType": "SINGLE", 6 | "price": 10.90, 7 | "taxLotMethod": "FIFO", 8 | "orderLegCollection": [ 9 | { 10 | "instruction": "Buy", 11 | "quantity": 1, 12 | "instrument": { 13 | "symbol": "FEYE", 14 | "assetType": "EQUITY" 15 | } 16 | } 17 | ] 18 | } 19 | 20 | { 21 | "orderType": "LIMIT", 22 | "session": "SEAMLESS", 23 | "duration": "DAY", 24 | "orderStrategyType": "SINGLE", 25 | "price": 11.90, 26 | "taxLotMethod": "FIFO", 27 | "orderLegCollection": [ 28 | { 29 | "instruction": "Buy", 30 | "quantity": 1, 31 | "instrument": { 32 | "symbol": "FEYE", 33 | "assetType": "EQUITY" 34 | } 35 | } 36 | ] 37 | } 38 | 39 | { 40 | "orderType": "MARKET", 41 | "session": "NORMAL", 42 | "duration": "DAY", 43 | "orderStrategyType": "SINGLE", 44 | "taxLotMethod": "FIFO", 45 | "orderLegCollection": [ 46 | { 47 | "instruction": "Sell", 48 | "quantity": 1, 49 | "instrument": { 50 | "symbol": "FEYE", 51 | "assetType": "EQUITY" 52 | } 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "es2015", 6 | "types": [] 7 | }, 8 | "exclude": [ 9 | "test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts", "polyfills.ts" 15 | 16 | ], 17 | "include": [ 18 | "**/*.spec.ts", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /station-client.bat: -------------------------------------------------------------------------------- 1 | echo on 2 | npm i && npm run build:all && npm run serve -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "importHelpers": true, 5 | "outDir": "./dist/public", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "commonjs", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2017", 18 | "dom" 19 | ], 20 | "baseUrl": "./", 21 | "paths": { 22 | "@shared/*": ["src/app/shared/*"] 23 | } 24 | }, 25 | "exclude": [ 26 | "node_modules/*", 27 | "dist/*" 28 | ] 29 | } 30 | --------------------------------------------------------------------------------