Exemple #1
0
 def save_to_mongo(self):
     StockDatabase.insert(self.collection, self.get_stock_data())
Exemple #2
0
 def remove_from_mongo(self):
     StockDatabase.remove(self.collection, self.json())
Exemple #3
0
 def get_all_stocks(cls) -> List:
     """return a list of class objects"""
     db_stocks = StockDatabase.find('stocks', {})
     return [cls(stock['stock_symbol'], stock['shares'], stock['purchase_price'], stock['_id']) for stock in db_stocks]
Exemple #4
0
 def remove_from_mongo(id):
     StockDatabase.remove('stocks', id)