i have question ,i want to implement a function ,it’s using panel to list many trader account cards which show the position,pnl or other infos. because there many trader account ,so i want to use python class to implement, now i just implement a funtion can return a card.
eg.
def get_user_card(account_id,nick_name,uid):
header_title=f"{account_id} {nick_name} {uid}"
account_balance_number = pn.indicators.Number(
name='Account_balance', value=72, format='{value}%',
default_color="GOLD",font_size="20pt"
)
total_pnl_trend = pn.indicators.Trend(name='Price', data=data, width=200, height=200,plot_type="bar")
close_all_position_button=pn.widgets.Button(name="Close_all_position", button_type="primary", button_style="solid")
update_account_button=pn.widgets.Button(name="updata", button_type="info", button_style="solid")
open_trade_button=pn.widgets.Button(name="Open Trade", button_type="success", button_style="solid")
user_close_func=partial(close_order,uid)
user_open_func=partial(open_order,uid)
user_update_func=partial(update_account_func,uid)
close_all_position_button.on_click(user_close_func)
update_account_button.on_click(user_update_func)
open_trade_button.on_click(user_open_func)
button_accordion=pn.Accordion(("Trade bot",pn.Row(update_account_button,
open_trade_button)))
card_cols=pn.Column(account_balance_number,total_pnl_trend,button_accordion)
user_card=pn.Card(card_cols,title=header_title,header_color='white',header_background='#2f2f2f',collapsed=False,collapsible=True,styles={'background': 'WhiteSmoke'})
return user_card
i find many demos class are based param.Parameterized but i don’t know why
use the param.Parameterized exactly ,so how can i design the user card class? whether based param or not?
- List item