Function name updates
This commit is contained in:
parent
9049af2a27
commit
0ba67dd6fa
1 changed files with 5 additions and 5 deletions
10
mongo.py
10
mongo.py
|
@ -43,7 +43,7 @@ def get_stocks(user):
|
||||||
stocks = Portfolio.objects.get(user=user).stocks
|
stocks = Portfolio.objects.get(user=user).stocks
|
||||||
decoded_stocks = {}
|
decoded_stocks = {}
|
||||||
for stock, amount in stocks.items():
|
for stock, amount in stocks.items():
|
||||||
decoded_stocks[decodeKey(stock)] = amount.to_decimal()
|
decoded_stocks[decode_key(stock)] = amount.to_decimal()
|
||||||
return decoded_stocks
|
return decoded_stocks
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ def add_stock(user, stock, amount):
|
||||||
if not (yfi.stock_exists(stock)):
|
if not (yfi.stock_exists(stock)):
|
||||||
# Stock ticker does not exist on yahoo finance
|
# Stock ticker does not exist on yahoo finance
|
||||||
return False
|
return False
|
||||||
stock = encodeKey(stock)
|
stock = encode_key(stock)
|
||||||
if stock in portfolio.stocks.keys():
|
if stock in portfolio.stocks.keys():
|
||||||
portfolio.stocks[stock] = Decimal128(
|
portfolio.stocks[stock] = Decimal128(
|
||||||
amount + portfolio.stocks[stock].to_decimal()
|
amount + portfolio.stocks[stock].to_decimal()
|
||||||
|
@ -68,7 +68,7 @@ def add_stock(user, stock, amount):
|
||||||
|
|
||||||
def delete_stock(user, stock):
|
def delete_stock(user, stock):
|
||||||
user_check(user)
|
user_check(user)
|
||||||
stock = encodeKey(stock)
|
stock = encode_key(stock)
|
||||||
portfolio = Portfolio.objects.get(user=user)
|
portfolio = Portfolio.objects.get(user=user)
|
||||||
if stock in portfolio.stocks.keys():
|
if stock in portfolio.stocks.keys():
|
||||||
del portfolio.stocks[stock]
|
del portfolio.stocks[stock]
|
||||||
|
@ -84,7 +84,7 @@ def get_watchlist(user):
|
||||||
wlist = Watchlist.objects.get(user=user).stocks
|
wlist = Watchlist.objects.get(user=user).stocks
|
||||||
decoded_stocks = {}
|
decoded_stocks = {}
|
||||||
for stock, val in wlist.items():
|
for stock, val in wlist.items():
|
||||||
decoded_stocks[decodeKey(stock)] = val.to_decimal()
|
decoded_stocks[decode_key(stock)] = val.to_decimal()
|
||||||
return decoded_stocks
|
return decoded_stocks
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ def watch(user, stock, est_price="0"):
|
||||||
if not (yfi.stock_exists(stock)):
|
if not (yfi.stock_exists(stock)):
|
||||||
# Stock ticker does not exist on yahoo finance
|
# Stock ticker does not exist on yahoo finance
|
||||||
return False
|
return False
|
||||||
stock = encodeKey(stock)
|
stock = encode_key(stock)
|
||||||
watchlist.stocks[stock] = Decimal128(Decimal(est_price))
|
watchlist.stocks[stock] = Decimal128(Decimal(est_price))
|
||||||
watchlist.save()
|
watchlist.save()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Reference in a new issue