Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andy-wu12/paper-profit
Web application that allows you to test trades in the stock market without using any real money. Real-time market data is provided through TD Ameritrade's Websocket API. NOTE: Both the Yahoo and TD Ameritrade APIs used are currently unavailable, so the application might be broken. This project is no longer being maintained.
https://github.com/andy-wu12/paper-profit
koa koa-router mongodb nextjs nodejs react real-time-data stock-data stock-trading tdameritrade-api websockets
Last synced: 27 days ago
JSON representation
Web application that allows you to test trades in the stock market without using any real money. Real-time market data is provided through TD Ameritrade's Websocket API. NOTE: Both the Yahoo and TD Ameritrade APIs used are currently unavailable, so the application might be broken. This project is no longer being maintained.
- Host: GitHub
- URL: https://github.com/andy-wu12/paper-profit
- Owner: Andy-Wu12
- License: mit
- Created: 2022-10-10T23:47:14.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-19T18:42:16.000Z (over 1 year ago)
- Last Synced: 2024-12-07T04:12:21.618Z (27 days ago)
- Topics: koa, koa-router, mongodb, nextjs, nodejs, react, real-time-data, stock-data, stock-trading, tdameritrade-api, websockets
- Language: TypeScript
- Homepage:
- Size: 28 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stock Trading Simulator
Web application that allows you to simulate trades in the stock market without
using any real money.## Demo
Sign Up:
https://user-images.githubusercontent.com/33229522/233168224-17dfdce6-baf6-4a90-9ccf-78c8f12068df.mov
Stock Search:
https://user-images.githubusercontent.com/33229522/233168488-70504926-f63f-4047-bd11-6642b5e189fc.mov
Held Positions:
https://user-images.githubusercontent.com/33229522/233168592-d2cd35ff-9680-4abe-a85a-d2ca04311add.mov
Watchlist:
https://user-images.githubusercontent.com/33229522/233168615-d3c56cc1-60f4-4ec4-8233-0303637dcf28.mov
Portfolio Reset:
https://user-images.githubusercontent.com/33229522/233168627-33cf1154-0924-4b9e-a611-064372b355ae.mov
## Dependencies:
1. Next.js - `npm install next`
2. React.js - `npm install react`
3. react-dom - `npm install react-dom`Run all these commands at once with `npm install next react react-dom`
## To run this project locally you will need:
1. MongoDB either through the cloud with [Atlas](https://www.mongodb.com/atlas/database) or locally (preferably along with [Compass](https://www.mongodb.com/products/compass))
2. A TD Ameritrade [developer](https://developer.tdameritrade.com/) account
- After signing up, you need to get your [User Principal Details](https://developer.tdameritrade.com/user-principal/apis/get/userprincipals-0) manually (everyday).
**I plan to make this a process that can be done programmatically, but for now:**
- Enter `streamerSubscriptionKeys,streamerConnectionInfo` into the fields parameter
- Click on the **OAuth 2.0** Button and authenticate with your TD Ameritrade account.
- Click *Send*, and copy the JSON from the *Response* section, making sure that `streamerSubscriptionKeys` is part of the response.
- Paste this json in a file named `userprincipal.json` in the **pages/api** folder inside the **client** directory.
3. A RapidAPI account
1. Create an app by clicking *My Apps* then *Add New App*
2. Enter a name of your choosing then click **Save**.
3. Under the **My Apps** section, click on the name of your app.
4. Click *Security* then the eye icon to reveal your Application key
5. Copy that key into a **.env** file in the **server** folder, with the key name *RAPID_API_YAHOO_KEY*
6. Subscribe to the [YFINANCE](https://rapidapi.com/asepscareer/api/yfinance-stock-market-data/) API
4. `.env` file for **server**
1. `FRONTEND_BASE_URL="http://localhost:3000"` or whatever port your frontend is running on.
2. `RAPID_API_YAHOO_KEY=[insert your api key here]`
5. `.env.local` for **client**
1. `NEXT_PUBLIC_API_BASE_URL="http://localhost:3011"` or whatever port your backend is running on.Once everything is set up open two terminals, one each for both the client and server programs.
### Run the server
Assuming you start at the root of the project:
1. `cd server`
2. `npm install`
3. `npm run start`
4. The server will be used to respond to various requests in the client-side
5. You can see the various endpoints set up by accessing the index at *http://localhost:3011*### Run the client
In the other terminal instance,
1. `cd client`
2. `npm install`
3. `npm run dev` OR `npm run deploy` for a production build.
4. Open a browser and head to *http://localhost:3000*