Dashboard {
MarketData: [
...{
marketIndex: String,
chart: {},
textData: String
}
],
CustomDataSelections: [
...{
name: 'MostActive',
memberStocks: [
...{
symbol: String,
chart: {}
}
]
},
{
name: 'MyPortfolio',
MemberStocks: [
{
symbol: Account.Portfolio[i].symbol,
}
]
}
]
}
Account {
email: String,
password: String,
Portfolio {
[
... {
symbol: String,
name: String,
quantity: Number,
price: Number,
totalValue: Number
}
]
}
}
Stock {
DisplayData {
chart: {},
textData: {
symbol: String,
name: String,
price: Number
}
}
Transaction {
date: Date,
symbol: String,
name: String,
type: String,
quantity: Number,
price: Number,
totalValue: Number,
execute: false
}
}
Main, Header, Footer, Landing, Home
Transaction
and Stock
relationshipsTransaction
instead of Stock
.current
, referring to the buy or sell request currently being executed; orhistorical
, referring to requests executed in the past.Transaction
should be a slave/child of Stock
Stock
makes a transaction requestTransaction
validates the requestTransaction
executes request or resolves promise and returns an error messageTransaction
records new transaction history in databaseTransaction
performs post-transaction actions: sending notification
Portfolio
: consider making a dictionary with symbols as keysPortfolio: {
'aapl': {
name: 'Apple Inc.',
price: Number,
quantity: Number,
totalValue: price * quantity
},
'fb': {
name: 'Facebook Inc.',
...
}
}
Portfolio.keys()
) is cheaper than sorting an array of objectssymbol
in the stockPortfolio: [
...{
symbol: 'aapl',
name: 'Apple Inc.'
...
},
{
symbol: 'fb',
name: 'Facebook Inc.',
...
}
]