This is a Node.js server application for managing ETRADE portfolio data. It allows you to authorize access to your ETRADE account, retrieve portfolio data, account balances, and transactions, and view 10-K filings.
- OAuth authorization with E*TRADE
- Retrieve and persist account balances, portfolio data, and transactions
- Fetch and display 10-K filings from the SEC
-
Clone the repository:
git clone https://github.com/bveber/etrade-portfolio-server.git cd etrade-portfolio-server
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with your E*TRADE API credentials:CONSUMER_KEY=your_consumer_key CONSUMER_SECRET=your_consumer_secret
-
Start the server:
npm start
- Open your browser and go to
http://localhost:3000
. - Click on the "Get Authorization URL" button to get the authorization URL.
- Authorize the application by visiting the provided URL.
- Enter the OAuth verifier in the callback form to complete the authorization process.
- Account Balances: Click the "Get Account Balances" button to fetch and display account balances.
- Portfolio Data: Click the "Get Portfolio Data" button to fetch and display portfolio data.
- Transactions Data: Click the "Get Transactions Data" button to fetch and display transactions data.
- Navigate to
http://localhost:3000/filings
. - Enter a stock ticker and click "Get 10-K Data" to fetch and display 10-K filings.
etrade-portfolio-server/
│
├── public/ # Static HTML files
│ ├── filings.html
│ └── index.html
│
├── src/ # Source files
│ ├── routes/ # Route handlers
│ │ ├── accountBalances.js
│ │ ├── portfolio.js
│ │ ├── transactions.js
│ │ └── edgar.js
│ │
│ ├── services/ # Business logic
│ │ ├── oauth.js
│ │ ├── cache.js
│ │ └── utils.js
│ │
│ └── server.js # Main server file
│
├── .gitignore
├── .nvmrc
├── package.json
└── README.md
This project uses Jest for unit testing. To run the tests, follow these steps:
-
Install the dependencies (if you haven't already):
npm install
-
Run the tests:
npm test
The tests are located in the tests
directory and cover various functionalities of the application, including OAuth, portfolio data, transactions data, account balances, and 10-K filings.
This project uses GitHub Actions for Continuous Integration. The CI pipeline is configured to run on every pull request targeting the main
branch. The pipeline performs the following steps:
- Checkout Code: Checks out the code from the repository.
- Set Up Node.js: Sets up the Node.js environment.
- Install Dependencies: Installs project dependencies using
npm install
. - Run ESLint: Lints the codebase to ensure code quality.
- Run Jest Tests: Runs the test suite to ensure all tests pass.
To view the workflow configuration, check the pull_request.yaml file.
This project is licensed under the MIT License.
- Add ability to drill down into stocks
- Cache logos
- Get overall portfolio performace over time (compared to indices)
- Improve logging
- Fix re-authentication logic