Stock portfolio simulator.
Dependencies:
Install package dependencies:
npm install
Start the database:
mongod
Start the server; I use Nodemon to restart the server when changes are made:
nodemon
Run the default Gulp task to build files:
gulp
The app will now be running on http://localhost:3000
- Draw company graphs from external data.
Update holdings on new transaction.Add share purchase limit based on cash.- Compare current portfolio value to live value.
Deposit cash to portfolio, after creation.- Ability to edit portfolio name.
Add loading indicator to ticker search- Create new transaction from portfolio view.
- Responsive styling.
- Add client-side toggle to switch b/w light and dark themes.
- User authentication.
Returns a list of all users
GET /api/users
Response:
{
"users": [
{
"_id": "554385e8cd2d66a1562cd7b9",
"name": "Jaden Dessureault",
"username": "jadnco",
"avatar": "http://www.gravatar.com/avatar/ccbbc3448b0c2b0a6aae6500c5e1c4ad",
"email": "jaden.dessureault@gmail.com",
"portfolios": [
"555abecba8387370225707c6",
"557106c1c6b25f7e33fc0642",
"5587716a9c392f5353a0562f"
],
"created": "2015-05-01T13:55:52.039Z"
}
...
]
}
Create a new user record
POST /api/users
Request:
{
"user":{
"name": "Walter Flores",
"username": "walt89",
"email": "walter@example.com"
}
}
Response:
{
"user": {
"_id": "559443b15b95cfd61950bb65",
"name": "Walter Flores",
"username": "walt89",
"avatar": "http://www.gravatar.com/avatar/2b29126ce78c689dee1cf01dbdb26da7",
"email": "walter@example.com",
"portfolios": [],
"created": "2015-07-01T19:46:57.273Z"
}
}
Returns a single user by username
or _id
.
GET /api/users/:id
Response:
{
"user": [
{
"_id": "554385e8cd2d66a1562cd7b9",
"name": "Jaden Dessureault",
"username": "jadnco",
"avatar": "http://www.gravatar.com/avatar/ccbbc3448b0c2b0a6aae6500c5e1c4ad",
"email": "jaden.dessureault@gmail.com",
"portfolios": [
"555abecba8387370225707c6",
"557106c1c6b25f7e33fc0642",
"5587716a9c392f5353a0562f"
],
"created": "2015-05-01T13:55:52.039Z"
}
]
}
Update a single user by username
or _id
.
PUT /api/users/:id
Request:
{
"user":{
"username": "jadend"
}
}
Response:
200 OK
Returns a list of all portfolios
GET /api/portfolios
Response:
{
"portfolios": [
{
"_id": "555abecba8387370225707c6",
"slug": "large-cap-technology",
"name": "Large Cap Technology",
"owner": "554385e8cd2d66a1562cd7b9",
"modified": "2015-06-10T21:59:35.573Z",
"transactions": [
"555ac0b224ce427f24044338",
"555ac18a5d36a08725b602ee",
"555ac1be5d36a08725b602ef",
"555e58454997c1e936216fd5",
"555e58a04997c1e936216fd6"
],
"holdings": [
{
"ticker": "AAPL",
"value": 1562.28,
"overallReturn": 0.12,
"percent": 0.25,
"_id": "5578b3476d90a69e05520a15"
},
...
],
"created": "2015-05-19T04:40:43.397Z",
"overallReturn": 0.15,
"cash": 0,
"value": 7799.1
},
...
]
}
Create a new portfolio record
POST /api/portfolios
Request:
{
"portfolio": {
"name": "Blue Chips",
"owner": "554385e8cd2d66a1562cd7b9",
"cash": 25000
}
}
Response:
{
"portfolio": {
"slug": "blue-chips",
"name": "Blue Chips",
"owner": "554385e8cd2d66a1562cd7b9",
"_id": "55944998509e2ef62419471e",
"transactions": [],
"holdings": [],
"created": "2015-07-01T20:12:08.941Z",
"overallReturn": 0,
"cash": 25000,
"value": 25000
}
}
Returns a list of all transactions
GET /api/transactions
Response:
{
"transactions": [
{
"_id": "5546a465acfe54e7b13ab239",
"value": 1934.25,
"type": "buy",
"shares": 15,
"price": 128.95,
"portfolio": "554593cfff677a27261b8abb",
"__v": 0,
"close": "2015-05-03T22:42:45.355Z",
"stock": [
{
"name": "Apple Inc.",
"ticker": "AAPL",
"exchange": "NASDAQ"
}
]
},
...
]
}
Returns a list of all transactions of a portfolio
GET /api/portfolios/:id/transactions
:id
can either be a portfolio's slug
or _id
.
Response:
{
"transactions": [
{
"_id": "555ac0b224ce427f24044338",
"value": 384.08,
"type": "buy",
"shares": 8,
"price": 48.01,
"portfolio": "555abecba8387370225707c6",
"close": "2015-05-19T04:48:50.386Z",
"stock": [
{
"name": "Microsoft Corporation",
"ticker": "MSFT",
"exchange": "NASDAQ"
}
]
},
...
]
}
Returns a single transaction
GET /api/transactions/:id
Response:
{
"transaction": {
"_id": "5546a5fbacfe54e7b13ab23a",
"value": 1556.8,
"type": "buy",
"shares": 32,
"price": 48.65,
"portfolio": "554593cfff677a27261b8abb",
"close": "2015-05-03T22:49:31.556Z",
"stock": [
{
"name": "Microsoft Corporation",
"ticker": "MSFT",
"exchange": "NASDAQ"
}
]
}
}