mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-09 02:42:36 +00:00
Updated positiontype -> productype, fixed symbol api fetch
This commit is contained in:
@@ -32,7 +32,7 @@ def show_holdings():
|
||||
|
||||
print("")
|
||||
print(
|
||||
"PositionType\t Stonk\t Size\t last price \t prev close \t breakeven \t % Change"
|
||||
"ProductType\t Stonk\t Size\t last price \t prev close \t breakeven \t % Change"
|
||||
)
|
||||
print("")
|
||||
|
||||
@@ -40,17 +40,17 @@ def show_holdings():
|
||||
# showcase portfolio
|
||||
for stock in portfolio:
|
||||
if stock["positionType"] == "PRODUCT":
|
||||
pos_type = stock["positionType"]
|
||||
size = stock["size"]
|
||||
break_even = stock["breakEvenPrice"]
|
||||
stock_info = degiro.product_info(stock["id"])
|
||||
real_time_info = degiro.real_time_price(
|
||||
stock["id"], degiroapi.Interval.Type.One_Day
|
||||
)
|
||||
stonk = real_time_info[0]["data"]["alfa"]
|
||||
pos_type = stock_info["productType"]
|
||||
size = stock["size"]
|
||||
break_even = stock["breakEvenPrice"]
|
||||
stonk = stock_info["symbol"]
|
||||
last_price = real_time_info[0]["data"]["lastPrice"]
|
||||
prev_close = real_time_info[0]["data"]["previousClosePrice"]
|
||||
pct_change = round((last_price - prev_close) / prev_close, 3)
|
||||
|
||||
to_pr = f"{pos_type}\t\t {stonk}\t {size}\t {last_price}\t\t {prev_close}\t\t {break_even}\t\t {pct_change}"
|
||||
if last_price >= prev_close:
|
||||
print(colored(to_pr, "green"))
|
||||
|
||||
Reference in New Issue
Block a user