Spaces:
Running
Running
File size: 1,508 Bytes
069fbff 74a62c2 da78865 36520c8 069fbff da78865 069fbff cef28d7 6e4fc50 069fbff c005445 da78865 a4c127d 069fbff 2702515 da78865 069fbff c332e90 069fbff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import gradio as gr
from modules.rebalancing import rebalancing_tool
from modules.utils import currency_codes, current_time
examples = [
["KRW", "458730 KRW 921 [8],\n368590 KRW 134 [2],\n458730 KRW 95 [8],\n368590 KRW 14 [2],", 0],
["KRW", "SCHD USD 54.440238 [8],\nQQQ USD 0.795350 [2],",0],
["USD", "AAPL USD 500 [20], \nMSFT USD 300 [15], \nGOOGL USD 400 [10], \nAMZN USD 50 [5], \nTSLA USD 200 [10], \nNVDA USD 250 [10], \nNFLX USD 150 [10], \nQQQ USD 450 [5], \nADBE USD 100 [10], \nPYPL USD 50 [5]", 10000]
]
# Define Gradio components
main_currency = gr.Dropdown(
label="Main Currency",
choices=currency_codes,
value="KRW",
# info="Assets converted to main currency"
)
holdings = gr.Textbox(
label="Portfolio [Target]",
lines=2,
# info="Format: Ticker Currency Quantity [Target_Weight], ...",
placeholder="Format: Ticker Currency Quantity [Target_Ratio], ...",
value="SCHD USD 354 [8],\nQQQ USD 4 [2]",
show_copy_button = True
)
cash_amount = gr.Number(
label="Contribution or withdrawal amount",
value=1000000
)
allow_sales = gr.Checkbox(
value=True,
label="If checked, the table below will display both buy and sell transactions. If unchecked, only buy transactions will be shown."
)
input = [main_currency, holdings, cash_amount, allow_sales]
output = gr.HTML()
component_rows = [holdings, [cash_amount, allow_sales], [main_currency]]
# Define the update function
def update_output(*args):
return rebalancing_tool(*args)
|