cryman38 commited on
Commit
cf2f23e
ยท
verified ยท
1 Parent(s): 77eeb81

Delete interface

Browse files
interface/.DS_Store DELETED
Binary file (6.15 kB)
 
interface/__init__.py DELETED
File without changes
interface/about_interface.py DELETED
@@ -1,513 +0,0 @@
1
- import gradio as gr
2
-
3
- def render_about_tab():
4
- with gr.TabItem("๐Ÿค Support Us"):
5
-
6
- # def create_tool_section(tool_name, korean_description, english_description):
7
- # with gr.Accordion(tool_name, open=False):
8
- # with gr.Accordion("ํ•œ๊ตญ์–ด", open=False):
9
- # gr.Markdown(korean_description)
10
- # with gr.Accordion("English", open=False):
11
- # gr.Markdown(english_description)
12
-
13
- # # Portfolio Rebalancing Tool Section
14
- # create_tool_section(
15
- # "RE-BALANCING CALCULATOR",
16
- # """
17
- # ## ๐Ÿ“Š ๋ฆฌ๋ฐธ๋Ÿฐ์‹ฑ ๊ณ„์‚ฐ๊ธฐ
18
-
19
- # ์ด ๋„๊ตฌ๋Š” ์ฃผ์–ด์ง„ ์ฃผ์‹ ๋ณด์œ ๋Ÿ‰, ํ˜„๊ธˆ ๊ธˆ์•ก ๋ฐ ํ˜„๊ธˆ ๋น„์œจ์„ ๋ฐ”ํƒ•์œผ๋กœ ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ๋ถ„์„ํ•˜๊ณ  ์žฌ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
20
-
21
- # ### ์ž…๋ ฅ๊ฐ’
22
-
23
- # - **์ฃผ์‹ ๋ณด์œ ๋Ÿ‰ (holdings)**: ๊ฐ ์ฃผ์‹์˜ ์ฝ”๋“œ, ํ†ตํ™” ์ฝ”๋“œ, ์ˆ˜๋Ÿ‰, ๋ชฉํ‘œ ๋น„์œจ์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์ฃผ์‹ ์ข…๋ชฉ์€ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ: `AAPL USD 10 0.30,TSLA USD 5 0.20`
24
- # - **ํ˜„๊ธˆ ๊ธˆ์•ก (cash_amount)**: ํฌํŠธํด๋ฆฌ์˜ค์— ํฌํ•จ๋œ ํ˜„๊ธˆ์˜ ๊ธˆ์•ก์ž…๋‹ˆ๋‹ค. ์˜ˆ: `1000`
25
- # - **ํ˜„๊ธˆ ๋น„์œจ (cash_ratio)**: ํฌํŠธํด๋ฆฌ์˜ค์—์„œ ํ˜„๊ธˆ์ด ์ฐจ์ง€ํ•˜๋Š” ๋น„์œจ์ž…๋‹ˆ๋‹ค. ์˜ˆ: `10` (10%)
26
-
27
- # ### ๊ธฐ๋Šฅ
28
-
29
- # 1. **์ž…๋ ฅ ํŒŒ์‹ฑ**: ์ฃผ์‹ ๋ณด์œ ๋Ÿ‰, ํ˜„๊ธˆ ๊ธˆ์•ก ๋ฐ ๋น„์œจ์„ ๋ถ„์„ํ•˜์—ฌ ๊ฐ ์ฃผ์‹์˜ ๋ชฉํ‘œ ๋น„์œจ์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
30
- # 2. **ํ™˜์œจ ์กฐํšŒ**: ๊ฐ ์ฃผ์‹์˜ ํ†ตํ™” ์ฝ”๋“œ์™€ ๋ฉ”์ธ ํ†ตํ™” ๊ฐ„์˜ ํ™˜์œจ์„ ์กฐํšŒํ•˜์—ฌ ์ฃผ์‹ ๊ฐ€๊ฒฉ์„ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
31
- # 3. **ํฌํŠธํด๋ฆฌ์˜ค ๊ตฌ์ถ•**: ์ฃผ์‹๊ณผ ํ˜„๊ธˆ ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ๊ตฌ์ถ•ํ•ฉ๋‹ˆ๋‹ค.
32
- # 4. **ํฌํŠธํด๋ฆฌ์˜ค ์žฌ์กฐ์ • ์ •๋ณด ์ œ๊ณต**: ํ˜„์žฌ ํฌํŠธํด๋ฆฌ์˜ค์˜ ๊ฐ€์น˜์™€ ๋ชฉํ‘œ ๋น„์œจ์„ ๋น„๊ตํ•˜์—ฌ ์žฌ์กฐ์ • ํ•„์š”์„ฑ์„ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.
33
- # - **ํ˜„์žฌ ๋ณด์œ ๋Ÿ‰ ๋ฐ ๊ฐ€์น˜**: ๊ฐ ์ฃผ์‹ ๋ฐ ํ˜„๊ธˆ์˜ ํ˜„์žฌ ๋ณด์œ ๋Ÿ‰๊ณผ ๊ฐ€์น˜๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
34
- # - **์žฌ์กฐ์ • ํ•ญ๋ชฉ**: ๋ชฉํ‘œ ๋น„์œจ์— ๋งž์ถ”๊ธฐ ์œ„ํ•ด ๋งค์ˆ˜ ๋˜๋Š” ๋งค๋„ํ•ด์•ผ ํ•  ์ฃผ์‹ ์ˆ˜๋Ÿ‰๊ณผ ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
35
- # - **ํ†ตํ™”๋ณ„ ์š”์•ฝ**: ํฌํŠธํด๋ฆฌ์˜ค์˜ ํ†ตํ™”๋ณ„ ๋ถ„ํฌ๋ฅผ ์š”์•ฝํ•ฉ๋‹ˆ๋‹ค.
36
-
37
- # ### ๊ฒฐ๊ณผ
38
-
39
- # - **ํฌํŠธํด๋ฆฌ์˜ค ์ •๋ณด**: ํ˜„์žฌ ํฌํŠธํด๋ฆฌ์˜ค์˜ ์ด ๊ฐ€์น˜ ๋ฐ ํ˜„๊ธˆ ์ •๋ณด๋ฅผ ํฌํ•จํ•œ HTML ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.
40
- # - **ํ˜„์žฌ ๋ณด์œ ๋Ÿ‰ ๋ฐ ๊ฐ€์น˜**: ๊ฐ ์ฃผ์‹์˜ ํ˜„์žฌ ๋น„์œจ ๋ฐ ๊ฐ€์น˜์— ๋Œ€ํ•œ ์ •๋ณด์ž…๋‹ˆ๋‹ค.
41
- # - **์žฌ์กฐ์ • ๋ถ„์„**: ์ฃผ์‹์˜ ๋งค์ˆ˜/๋งค๋„ ์กฐ์ •์ด ํ•„์š”ํ•œ ํ•ญ๋ชฉ ๋ฐ ๊ธˆ์•ก์— ๋Œ€ํ•œ ์ƒ์„ธ ๋ถ„์„์ž…๋‹ˆ๋‹ค.
42
- # - **ํ†ตํ™”๋ณ„ ์š”์•ฝ**: ํฌํŠธํด๋ฆฌ์˜ค์˜ ํ†ตํ™”๋ณ„ ๋น„์œจ ๋ฐ ์ด ๊ฐ€์น˜๋ฅผ ์š”์•ฝํ•œ ์ •๋ณด์ž…๋‹ˆ๋‹ค.
43
-
44
- # ์ด ๋„๊ตฌ๋ฅผ ํ†ตํ•ด ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ํšจ์œจ์ ์œผ๋กœ ์žฌ์กฐ์ •ํ•˜๊ณ , ์ฃผ์‹ ๋ฐ ํ˜„๊ธˆ์˜ ๋น„์œจ์„ ์ตœ์ ํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค! ๐Ÿ“ˆ๐Ÿ’ผ
45
-
46
- # ### ์ค‘์š” ์‚ฌํ•ญ
47
- # - ์ฃผ์‹ ์ฝ”๋“œ์™€ ํ†ตํ™” ์ฝ”๋“œ๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธํ•˜์„ธ์š”.
48
- # - ์ด ๋„๊ตฌ๋Š” ์ฃผ๊ฐ€์™€ ํ™˜์œจ์˜ ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
49
- # - Yahoo Finance ๋ฐ FinanceDataReader์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
50
-
51
- # ### ๋ฉด์ฑ… ์กฐํ•ญ
52
- # ์ด ๋„๊ตฌ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ •๋ณด๋Š” ์ผ๋ฐ˜์ ์ธ ์ •๋ณด ์ œ๊ณต ๋ชฉ์ ๋งŒ์„ ์œ„ํ•ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ๋ชจ๋“  ์ •๋ณด๋Š” ์„ ์˜๋กœ ์ œ๊ณต๋˜์ง€๋งŒ, ์‚ฌ์ดํŠธ์˜ ์ •๋ณด์˜ ์ •ํ™•์„ฑ, ์ ์ ˆ์„ฑ, ์œ ํšจ์„ฑ, ์‹ ๋ขฐ์„ฑ, ๊ฐ€์šฉ์„ฑ ๋˜๋Š” ์™„์ „์„ฑ์— ๋Œ€ํ•ด ๋ช…์‹œ์ ์ด๋“  ๋ฌต์‹œ์ ์ด๋“  ์–ด๋– ํ•œ ์ข…๋ฅ˜์˜ ์ง„์ˆ ์ด๋‚˜ ๋ณด์ฆ์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ์‚ฌ์šฉ๊ณผ ์‚ฌ์ดํŠธ์˜ ์ •๋ณด๋ฅผ ์‹ ๋ขฐํ•˜๋Š” ๊ฒƒ์€ ์ „์ ์œผ๋กœ ์‚ฌ์šฉ์ž์˜ ์ฑ…์ž„์ž…๋‹ˆ๋‹ค.
53
- # """,
54
- # """
55
- # ## ๐Ÿ“Š RE-BALANCING CALCULATOR
56
-
57
- # This tool analyzes and rebalances a portfolio based on given stock holdings, cash amount, and cash ratio.
58
-
59
- # ### Input Values
60
-
61
- # - **Stock Holdings (holdings)**: Enter the stock code, currency code, quantity, and target weight for each stock. Separate multiple stocks with commas. Example: `AAPL USD 10 0.30,TSLA USD 5 0.20`
62
- # - **Cash Amount (cash_amount)**: The amount of cash in the portfolio. Example: `1000`
63
- # - **Cash Ratio (cash_ratio)**: The proportion of cash in the portfolio. Example: `10` (10%)
64
-
65
- # ### Functionality
66
-
67
- # 1. **Parse Input**: Analyzes stock holdings, cash amount, and ratio to calculate the target weights for each stock.
68
- # 2. **Exchange Rate Lookup**: Retrieves exchange rates between each stock's currency code and the main currency to convert stock prices.
69
- # 3. **Build Portfolio**: Constructs the portfolio based on stock and cash information.
70
- # 4. **Get Portfolio Rebalancing Information**: Compares the current portfolio value and target weights to analyze rebalancing needs.
71
- # - **Current Holdings and Value**: Calculates the current holdings and value of each stock and cash.
72
- # - **Rebalancing Items**: Calculates the quantities and amounts of stocks to buy or sell to meet target weights.
73
- # - **Currency Summary**: Summarizes the portfolio's distribution by currency.
74
-
75
- # ### Results
76
-
77
- # - **Portfolio Information**: HTML code containing the total value of the current portfolio and cash information.
78
- # - **Current Holdings and Value**: Information on the current weights and values of each stock.
79
- # - **Rebalancing Analysis**: Detailed analysis of the adjustments needed to buy/sell stocks to meet target weights.
80
- # - **Currency Summary**: Summary of portfolio distribution by currency, including total value.
81
-
82
- # Use this tool to efficiently rebalance your portfolio and optimize the ratio of stocks and cash! ๐Ÿ“ˆ๐Ÿ’ผ
83
-
84
- # ### Important Notes
85
- # - Ensure stock codes and currency codes are valid.
86
- # - This tool requires an internet connection as it uses real-time stock prices and exchange rates.
87
- # - Data is sourced from Yahoo Finance and FinanceDataReader.
88
-
89
- # ### Disclaimer
90
- # The information provided by this tool is for general informational purposes only. All information on the site is provided in good faith, but we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information on the site. Your use of the site and reliance on any information on the site is solely at your own risk.
91
- # """
92
- # )
93
-
94
- # # Stock Comparison Tool Section
95
- # create_tool_section(
96
- # "STOCK PRICE TREND VISUALIZATION",
97
- # """
98
- # ## ๐Ÿ“ˆ ์ฃผ์‹ ๊ฐ€๊ฒฉ ์ถ”์„ธ ์‹œ๊ฐํ™”
99
-
100
- # ์ด ์ฝ”๋“œ๋Š” ์ฃผ์–ด์ง„ ์ฃผ์‹ ์ฝ”๋“œ๋“ค์˜ ๊ฐ€๊ฒฉ ์ถ”์„ธ๋ฅผ ์‹œ๊ฐํ™”ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ์ถ”์ ํ•˜๊ณ  ๋น„๊ตํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๐Ÿ“Š
101
-
102
- # ### ์ž…๋ ฅ๊ฐ’
103
-
104
- # - **์ฃผ์‹ ์ฝ”๋“œ (stock_codes)**: ๊ฐ€๊ฒฉ์„ ์ถ”์ ํ•  ์ฃผ์‹์˜ ์ฝ”๋“œ๋“ค์ž…๋‹ˆ๋‹ค. ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋œ ๋ฌธ์ž์—ด ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ: `AAPL,GOOGL,MSFT`
105
- # - **์ผ์ˆ˜ (days)**: ๊ฐ€๊ฒฉ์„ ์กฐํšŒํ•  ๊ธฐ๊ฐ„์ž…๋‹ˆ๋‹ค. ์˜ˆ: `30` (์ตœ๊ทผ 30์ผ)
106
-
107
- # ### ๊ธฐ๋Šฅ
108
-
109
- # 1. **์ฃผ์‹ ๊ฐ€๊ฒฉ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ**: ์ฃผ์–ด์ง„ ์ฃผ์‹ ์ฝ”๋“œ์™€ ๊ธฐ๊ฐ„์— ๋Œ€ํ•ด ์ฃผ์‹ ๊ฐ€๊ฒฉ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
110
- # 2. **๊ฐ€๊ฒฉ ๋ณ€๋™ ์‹œ๊ฐํ™”**: ๊ฐ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ ๋ณ€๋™์„ ์‹œ๊ฐํ™”ํ•˜์—ฌ ๋น„๊ตํ•  ์ˆ˜ ์žˆ๋Š” ๊ทธ๋ž˜ํ”„๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
111
- # - **์ƒ๋Œ€ ๊ฐ€๊ฒฉ**: ๊ฐ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ์ฒ˜์Œ ๊ฐ€๊ฒฉ์— ๋Œ€ํ•ด ์ƒ๋Œ€์ ์œผ๋กœ ๋ณ€๋™์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
112
- # - **์Šคํƒ€์ผ**: ๊ทธ๋ž˜ํ”„์—๋Š” ์ƒ‰์ƒ ๊ทธ๋ผ๋””์–ธํŠธ์™€ ๊ทธ๋ฆผ์ž ํšจ๊ณผ๊ฐ€ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.
113
- # - **์• ๋‹ˆ๋ฉ”์ด์…˜**: ์„ ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ์‹œ๊ฐ์ ์œผ๋กœ ๋”์šฑ ๋งค๋ ฅ์ ์ž…๋‹ˆ๋‹ค.
114
- # 3. **๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์ƒ์„ฑ**: ๊ฐ ๋‚ ์งœ์™€ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ํฌํ•จํ•œ HTML ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
115
-
116
- # ### ๊ฒฐ๊ณผ
117
-
118
- # - **๊ทธ๋ž˜ํ”„**: ์ตœ๊ทผ `days` ์ผ ๋™์•ˆ์˜ ์ƒ๋Œ€ ์ฃผ์‹ ๊ฐ€๊ฒฉ ์ถ”์„ธ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ๊ทธ๋ž˜ํ”„์ž…๋‹ˆ๋‹ค.
119
- # - **๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ”**: ๋‚ ์งœ๋ณ„๋กœ ๊ฐ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ํฌํ•จํ•˜๋Š” HTML ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค.
120
-
121
- # ### ์‚ฌ์šฉ ์˜ˆ์ œ
122
-
123
- # ์ฃผ์‹ ์ฝ”๋“œ์™€ ๊ธฐ๊ฐ„์„ ์ž…๋ ฅํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
124
-
125
- # - **์ฃผ์‹ ์ฝ”๋“œ**: `AAPL,GOOGL,MSFT`
126
- # - **์ผ์ˆ˜**: `30`
127
-
128
- # ๊ฒฐ๊ณผ๋Š” ์ตœ๊ทผ 30์ผ ๋™์•ˆ์˜ ์ฃผ์‹ ๊ฐ€๊ฒฉ ๋ณ€๋™์„ ๋ณด์—ฌ์ฃผ๋Š” ๊ทธ๋ž˜ํ”„์™€ ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ”์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
129
-
130
- # ์ด ๋„๊ตฌ๋ฅผ ํ†ตํ•ด ์ฃผ์‹ ๊ฐ€๊ฒฉ์˜ ๋ณ€๋™ ์ถ”์„ธ๋ฅผ ํ•œ๋ˆˆ์— ํ™•์ธํ•˜๊ณ  ๋ถ„์„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค! ๐Ÿ“ˆ๐Ÿ’ก
131
-
132
- # ### ์ค‘์š” ์‚ฌํ•ญ
133
- # - ์ฃผ์‹ ์ฝ”๋“œ๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธํ•˜์„ธ์š”.
134
- # - ์ด ๋„๊ตฌ๋Š” ์ฃผ๊ฐ€์˜ ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
135
- # - Yahoo Finance ๋ฐ FinanceDataReader์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
136
-
137
- # ### ๋ฉด์ฑ… ์กฐํ•ญ
138
- # ์ด ๋„๊ตฌ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ •๋ณด๋Š” ์ผ๋ฐ˜์ ์ธ ์ •๋ณด ์ œ๊ณต ๋ชฉ์ ๋งŒ์„ ์œ„ํ•ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ๋ชจ๋“  ์ •๋ณด๋Š” ์„ ์˜๋กœ ์ œ๊ณต๋˜์ง€๋งŒ, ์‚ฌ์ดํŠธ์˜ ์ •๋ณด์˜ ์ •ํ™•์„ฑ, ์ ์ ˆ์„ฑ, ์œ ํšจ์„ฑ, ์‹ ๋ขฐ์„ฑ, ๊ฐ€์šฉ์„ฑ ๋˜๋Š” ์™„์ „์„ฑ์— ๋Œ€ํ•ด ๋ช…์‹œ์ ์ด๋“  ๋ฌต์‹œ์ ์ด๋“  ์–ด๋– ํ•œ ์ข…๋ฅ˜์˜ ์ง„์ˆ ์ด๋‚˜ ๋ณด์ฆ์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ์‚ฌ์šฉ๊ณผ ์‚ฌ์ดํŠธ์˜ ์ •๋ณด๋ฅผ ์‹ ๋ขฐํ•˜๋Š” ๊ฒƒ์€ ์ „์ ์œผ๋กœ ์‚ฌ์šฉ์ž์˜ ์ฑ…์ž„์ž…๋‹ˆ๋‹ค.
139
- # """,
140
- # """
141
- # ## ๐Ÿ“ˆ Stock Price Trend Visualization
142
-
143
- # This script visualizes the price trends of given stock codes over a specified period. It allows you to track and compare the price movements of multiple stocks. ๐Ÿ“Š
144
-
145
- # ### Input Values
146
-
147
- # - **Stock Codes (stock_codes)**: The codes of the stocks you want to track. Enter them as a comma-separated string. Example: `AAPL,GOOGL,MSFT`
148
- # - **Days (days)**: The period for which you want to fetch the price data. Example: `30` (last 30 days)
149
-
150
- # ### Functionality
151
-
152
- # 1. **Fetch Stock Price Data**: Retrieves stock price data for the given stock codes and period.
153
- # 2. **Visualize Price Trends**: Creates a graph to visualize and compare the price trends of each stock.
154
- # - **Relative Price**: Shows each stock's price relative to its initial price.
155
- # - **Style**: The graph includes color gradients and shadow effects.
156
- # - **Animation**: Line animation effects are added for visual appeal.
157
- # 3. **Generate Data Table**: Creates an HTML table with the price data for each stock and date.
158
-
159
- # ### Results
160
-
161
- # - **Graph**: A graph showing the relative stock price trends over the last `days` days.
162
- # - **Data Table**: An HTML table displaying the prices of each stock by date.
163
-
164
- # ### Example Usage
165
-
166
- # Given stock codes and days, you can obtain results such as:
167
-
168
- # - **Stock Codes**: `AAPL,GOOGL,MSFT`
169
- # - **Days**: `30`
170
-
171
- # The result will include a graph showing the price trends over the last 30 days and an HTML table with the price data.
172
-
173
- # Use this tool to easily analyze and visualize stock price movements! ๐Ÿ“ˆ๐Ÿ’ก
174
-
175
- # ### Important Notes
176
- # - Ensure stock codes are valid.
177
- # - This tool requires an internet connection as it uses real-time stock prices.
178
- # - Data is sourced from Yahoo Finance and FinanceDataReader.
179
-
180
- # ### Disclaimer
181
- # The information provided by this tool is for general informational purposes only. All information on the site is provided in good faith, but we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information on the site. Your use of the site and reliance on any information on the site is solely at your own risk.
182
- # """
183
- # )
184
-
185
- # # Cost Averaging Tool Section
186
- # create_tool_section(
187
- # "DOLLAR-COST AVERAGING CALCULATOR",
188
- # """
189
- # ## ๐Ÿ’ธ ๋ฌผํƒ€๊ธฐ ๊ณ„์‚ฐ๊ธฐ
190
-
191
- # ๋ฌผํƒ€๊ธฐ(Dollar-Cost Averaging, DCA) ๊ณ„์‚ฐ๊ธฐ๋ฅผ ์ด์šฉํ•ด ๋ณด์„ธ์š”! ์ด ๊ณ„์‚ฐ๊ธฐ๋Š” ํŠน์ • ์ฃผ์‹์— ๋Œ€ํ•œ ์ถ”๊ฐ€ ํˆฌ์ž๋ฅผ ํ•  ๋•Œ ํ‰๊ท  ๊ตฌ๋งค ๊ฐ€๊ฒฉ์„ ๊ณ„์‚ฐํ•ด์ค๋‹ˆ๋‹ค. ๐Ÿ“ˆ
192
-
193
- # ### ์ž…๋ ฅ๊ฐ’ ์„ค์ • ๐Ÿ“Š
194
-
195
- # ๋‹ค์Œ์˜ ๊ฐ’์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”:
196
-
197
- # - **์ด์ „ ํ‰๊ท  ๊ฐ€๊ฒฉ (old_avg_price)**: ๊ธฐ์กด ์ฃผ์‹์˜ ํ‰๊ท  ๊ฐ€๊ฒฉ ๐Ÿ’ต
198
- # - **์ด์ „ ์ˆ˜๋Ÿ‰ (old_quantity)**: ๊ธฐ์กด ์ฃผ์‹์˜ ์ˆ˜๋Ÿ‰ ๐Ÿ“ฆ
199
- # - **์ƒˆ ๊ฐ€๊ฒฉ (new_price)**: ์ƒˆ๋กœ ๊ตฌ๋งคํ•œ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ ๐Ÿ’ฒ
200
- # - **์ƒˆ ์ˆ˜๋Ÿ‰ (new_quantity)**: ์ƒˆ๋กœ ๊ตฌ๋งคํ•œ ์ฃผ์‹์˜ ์ˆ˜๋Ÿ‰ ๐Ÿ“ˆ
201
-
202
- # ### ๊ณ„์‚ฐ ๋ฐฉ๋ฒ• ๐Ÿ”ข
203
-
204
- # 1. **ํ˜„์žฌ ํˆฌ์ž ๊ธˆ์•ก ๊ณ„์‚ฐ**: ์ด์ „ ํ‰๊ท  ๊ฐ€๊ฒฉ๊ณผ ์ด์ „ ์ˆ˜๋Ÿ‰์„ ๊ณฑํ•˜์—ฌ ํ˜„์žฌ ํˆฌ์ž ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
205
- # 2. **์ถ”๊ฐ€ ํˆฌ์ž ๊ธˆ์•ก ๊ณ„์‚ฐ**: ์ƒˆ ๊ฐ€๊ฒฉ๊ณผ ์ƒˆ ์ˆ˜๋Ÿ‰์„ ๊ณฑํ•˜์—ฌ ์ถ”๊ฐ€ ํˆฌ์ž ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
206
- # 3. **์ด ํˆฌ์ž ๊ธˆ์•ก ๋ฐ ์ด ์ฃผ์‹ ์ˆ˜ ๊ณ„์‚ฐ**: ํ˜„์žฌ ํˆฌ์ž ๊ธˆ์•ก๊ณผ ์ถ”๊ฐ€ ํˆฌ์ž ๊ธˆ์•ก์„ ํ•ฉ์ณ์„œ ์ด ํˆฌ์ž ๊ธˆ์•ก์„ ๊ณ„์‚ฐํ•˜๊ณ , ์ด์ „ ์ˆ˜๋Ÿ‰๊ณผ ์ƒˆ ์ˆ˜๋Ÿ‰์„ ๋”ํ•˜์—ฌ ์ด ์ฃผ์‹ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
207
- # 4. **์ƒˆ ํ‰๊ท  ๊ฐ€๊ฒฉ ๊ณ„์‚ฐ**: ์ด ํˆฌ์ž ๊ธˆ์•ก์„ ์ด ์ฃผ์‹ ์ˆ˜๋กœ ๋‚˜๋ˆ„์–ด ์ƒˆ๋กœ์šด ํ‰๊ท  ๊ฐ€๊ฒฉ์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
208
- # 5. **์ˆ˜์ต๋ฅ  ๊ณ„์‚ฐ**: ์ด์ „๊ณผ ์ƒˆ๋กœ์šด ์ˆ˜์ต๋ฅ ์„ ๊ณ„์‚ฐํ•˜์—ฌ ํˆฌ์ž ๊ฒฐ๊ณผ๋ฅผ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.
209
-
210
- # ### ๊ฒฐ๊ณผ ๐ŸŽฏ
211
-
212
- # **1) ์ด์ „ ์ˆ˜์ต๋ฅ  (Old Return)**
213
-
214
- # ์ด์ „ ํ‰๊ท  ๊ฐ€๊ฒฉ์„ ๊ธฐ์ค€์œผ๋กœ ํ•œ ์ˆ˜์ต๋ฅ ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
215
-
216
- # **2) ์ƒˆ๋กœ์šด ์ˆ˜์ต๋ฅ  (New Return)**
217
-
218
- # ์ƒˆ๋กœ์šด ํ‰๊ท  ๊ฐ€๊ฒฉ์„ ๊ธฐ์ค€์œผ๋กœ ํ•œ ์ˆ˜์ต๋ฅ ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
219
-
220
- # **3) ์ถ”๊ฐ€ ํˆฌ์ž ๊ธˆ์•ก (Additional Investment)**
221
-
222
- # ์ถ”๊ฐ€๋กœ ํˆฌ์žํ•œ ๊ธˆ์•ก์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
223
-
224
- # **4) ์ƒˆ๋กœ์šด ํ‰๊ท  ๊ฐ€๊ฒฉ (Average Price)**
225
-
226
- # ์ƒˆ๋กญ๊ฒŒ ๊ณ„์‚ฐ๋œ ํ‰๊ท  ๊ฐ€๊ฒฉ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
227
-
228
- # **5) ์ด ์ˆ˜๋Ÿ‰ (Total Quantity)**
229
-
230
- # ์ด ์ฃผ์‹ ์ˆ˜๋Ÿ‰์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
231
-
232
- # **6) ์ด ํˆฌ์ž ๊ธˆ์•ก (Total Investment)**
233
-
234
- # ์ด ํˆฌ์ž ๊ธˆ์•ก์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
235
-
236
- # ### ์˜ˆ์ œ ๐Ÿ“‰
237
-
238
- # - **์ด์ „ ํ‰๊ท  ๊ฐ€๊ฒฉ**: 100
239
- # - **์ด์ „ ์ˆ˜๋Ÿ‰**: 10
240
- # - **์ƒˆ ๊ฐ€๊ฒฉ**: 120
241
- # - **์ƒˆ ์ˆ˜๋Ÿ‰**: 5
242
-
243
- # ๊ฒฐ๊ณผ:
244
- # - ์ƒˆ๋กœ์šด ํ‰๊ท  ๊ฐ€๊ฒฉ: 105
245
- # - ์ด ์ˆ˜๋Ÿ‰: 15
246
- # - ์ด ํˆฌ์ž ๊ธˆ์•ก: 1,575
247
- # - ์ด์ „ ์ˆ˜์ต๋ฅ : 20.00%
248
- # - ์ƒˆ๋กœ์šด ์ˆ˜์ต๋ฅ : 14.29%
249
- # - ์ถ”๊ฐ€ ํˆฌ์ž ๊ธˆ์•ก: 600
250
-
251
- # ๋ฌผํƒ€๊ธฐ ๊ณ„์‚ฐ๊ธฐ๋ฅผ ํ†ตํ•ด ํˆฌ์ž์˜ ํ‰๊ท  ๊ตฌ๋งค ๊ฐ€๊ฒฉ์„ ์‰ฝ๊ฒŒ ๊ณ„์‚ฐํ•ด ๋ณด์„ธ์š”! ๐Ÿ“Š๐Ÿ’ฐ
252
-
253
- # ### ๋ฉด์ฑ… ์กฐํ•ญ
254
- # ์ด ๋„๊ตฌ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ •๋ณด๋Š” ์ผ๋ฐ˜์ ์ธ ์ •๋ณด ์ œ๊ณต ๋ชฉ์ ๋งŒ์„ ์œ„ํ•ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ๋ชจ๋“  ์ •๋ณด๋Š” ์„ ์˜๋กœ ์ œ๊ณต๋˜์ง€๋งŒ, ์‚ฌ์ดํŠธ์˜ ์ •๋ณด์˜ ์ •ํ™•์„ฑ, ์ ์ ˆ์„ฑ, ์œ ํšจ์„ฑ, ์‹ ๋ขฐ์„ฑ, ๊ฐ€์šฉ์„ฑ ๋˜๋Š” ์™„์ „์„ฑ์— ๋Œ€ํ•ด ๋ช…์‹œ์ ์ด๋“  ๋ฌต์‹œ์ ์ด๋“  ์–ด๋– ํ•œ ์ข…๋ฅ˜์˜ ์ง„์ˆ ์ด๋‚˜ ๋ณด์ฆ์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ์‚ฌ์šฉ๊ณผ ์‚ฌ์ดํŠธ์˜ ์ •๋ณด๋ฅผ ์‹ ๋ขฐํ•˜๋Š” ๊ฒƒ์€ ์ „์ ์œผ๋กœ ์‚ฌ์šฉ์ž์˜ ์ฑ…์ž„์ž…๋‹ˆ๋‹ค.
255
- # """,
256
- # """
257
- # ## ๐Ÿ’ธ Dollar-Cost Averaging Calculator
258
-
259
- # Try out the Dollar-Cost Averaging (DCA) calculator! This tool helps you calculate the average purchase price of stocks when making additional investments. ๐Ÿ“ˆ
260
-
261
- # ### Input Values ๐Ÿ“Š
262
-
263
- # Please enter the following details:
264
-
265
- # - **Old Average Price (old_avg_price)**: The average price of the existing stocks ๐Ÿ’ต
266
- # - **Old Quantity (old_quantity)**: The quantity of the existing stocks ๐Ÿ“ฆ
267
- # - **New Price (new_price)**: The price of the newly purchased stocks ๐Ÿ’ฒ
268
- # - **New Quantity (new_quantity)**: The quantity of the newly purchased stocks ๐Ÿ“ˆ
269
-
270
- # ### Calculation Process ๐Ÿ”ข
271
-
272
- # 1. **Current Investment**: Calculate the current investment amount by multiplying the old average price by the old quantity.
273
- # 2. **Additional Investment**: Calculate the additional investment amount by multiplying the new price by the new quantity.
274
- # 3. **Total Investment and Total Quantity**: Add the current investment amount and additional investment amount to get the total investment. Sum the old quantity and new quantity to get the total quantity of stocks.
275
- # 4. **New Average Price**: Calculate the new average price by dividing the total investment by the total quantity of stocks.
276
- # 5. **Return Calculation**: Calculate the old and new returns to analyze the investment results.
277
-
278
- # ### Results ๐ŸŽฏ
279
-
280
- # **1) Old Return**
281
-
282
- # Displays the return based on the old average price.
283
-
284
- # **2) New Return**
285
-
286
- # Displays the return based on the new average price.
287
-
288
- # **3) Additional Investment**
289
-
290
- # Shows the amount of additional investment made.
291
-
292
- # **4) Average Price**
293
-
294
- # Displays the newly calculated average price.
295
-
296
- # **5) Total Quantity**
297
-
298
- # Shows the total quantity of stocks.
299
-
300
- # **6) Total Investment**
301
-
302
- # Displays the total investment amount.
303
-
304
- # ### Example ๐Ÿ“‰
305
-
306
- # - **Old Average Price**: 100
307
- # - **Old Quantity**: 10
308
- # - **New Price**: 120
309
- # - **New Quantity**: 5
310
-
311
- # Results:
312
- # - New Average Price: 105
313
- # - Total Quantity: 15
314
- # - Total Investment: 1,575
315
- # - Old Return: 20.00%
316
- # - New Return: 14.29%
317
- # - Additional Investment: 600
318
-
319
- # Use the Dollar-Cost Averaging Calculator to easily compute the average purchase price of your investments! ๐Ÿ“Š๐Ÿ’ฐ
320
-
321
- # ### Disclaimer
322
- # The information provided by this tool is for general informational purposes only. All information on the site is provided in good faith, but we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information on the site. Your use of the site and reliance on any information on the site is solely at your own risk.
323
- # """
324
- # )
325
-
326
- # # Retirement Planning Tool Section
327
- # create_tool_section(
328
- # "RETIREMENT PLANNING CALCULATOR",
329
- # """
330
- # ## ๐Ÿ–๏ธ ์€ํ‡ด ๊ณ„ํš ๊ณ„์‚ฐ๊ธฐ ์‚ฌ์šฉ๋ฒ•
331
-
332
- # ์•ˆ๋…•ํ•˜์„ธ์š”! ๐Ÿ˜Š ์€ํ‡ด ๊ณ„ํš ๊ณ„์‚ฐ๊ธฐ์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋„๊ตฌ๋Š” ์—ฌ๋Ÿฌ๋ถ„์˜ ์€ํ‡ด ํ›„ ์žฌ์ • ์ƒํ™ฉ์„ ์˜ˆ์ธกํ•˜๊ณ  ์ค€๋น„ํ•˜๋Š” ๋ฐ ๋„์›€์„ ์ค„ ๊ฑฐ์˜ˆ์š”. ์•„๋ž˜๋Š” ์ด ๊ณ„์‚ฐ๊ธฐ์˜ ์ž‘๋™ ๋ฐฉ์‹๊ณผ ํ•„์š”ํ•œ ์ •๋ณด์ž…๋‹ˆ๋‹ค.
333
-
334
- # ### 1. ์ž…๋ ฅ ๊ฐ’ ๐Ÿ“Š
335
-
336
- # ๊ณ„์‚ฐ๊ธฐ์—์„œ ๋‹ค์Œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”:
337
-
338
- # - **ํ˜„์žฌ ๋‚˜์ด (current_age)**: ํ˜„์žฌ ๋‚˜์ด ๐ŸŽ‚
339
- # - **์€ํ‡ด ๋‚˜์ด (retirement_age)**: ์€ํ‡ดํ•˜๊ณ  ์‹ถ์€ ๋‚˜์ด ๐ŸŽ‰
340
- # - **ํ‰์ƒ ๊ธฐ๋Œ€ ์ˆ˜๋ช… (life_expectancy)**: ์˜ˆ์ƒ๋˜๋Š” ํ‰์ƒ ์ˆ˜๋ช… ๐ŸŒŸ
341
- # - **์›”๋ณ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„ (monthly_income_required)**: ๋งค์›” ํ•„์š”ํ•œ ์ƒํ™œ๋น„ ๐Ÿ’ต
342
- # - **์ธํ”Œ๋ ˆ์ด์…˜์œจ (inflation_rate)**: ๋ฌผ๊ฐ€ ์ƒ์Šน๋ฅ  ๐Ÿ“ˆ
343
- # - **ํ˜„์žฌ ํˆฌ์ž์•ก (current_investment)**: ํ˜„์žฌ ๋ณด์œ ํ•œ ํˆฌ์ž์•ก ๐Ÿ’ฐ
344
- # - **์›”๋ณ„ ์ถ”๊ฐ€ ํˆฌ์ž์•ก (monthly_investment)**: ๋งค์›” ์ถ”๊ฐ€๋กœ ํˆฌ์žํ•  ๊ธˆ์•ก ๐Ÿ’ธ
345
- # - **์›” ํˆฌ์ž์•ก์˜ ์—ฐ๊ฐ„ ์ฆ๊ฐ€์•ก (annual_increase_in_monthly_investment)**: ๋งค์›” ์ฆ๊ฐ€ํ•  ํˆฌ์ž์•ก(๋งค๋…„ ์›” ์ ๋ฆฝ์‹ ํˆฌ์ž๊ธˆ์—์„œ ๋Š˜๋ ค๋‚˜๊ฐˆ ๊ธˆ์•ก. (ex: ๋งค๋…„ 10๋งŒ์›์”ฉ ๋Š˜๋ฆด ์˜ˆ์ •์ด๋ผ๋ฉด, 100,000 ์ž…๋ ฅ)) ๐Ÿ“ˆ
346
- # - **๋ฐฐ๋‹น๊ธˆ ์žฌํˆฌ์ž ์—ฌ๋ถ€ (reinvest_dividends)**: ๋ฐฐ๋‹น๊ธˆ์„ ์žฌํˆฌ์žํ• ์ง€ ์—ฌ๋ถ€ ๐Ÿ”„
347
- # - **์€ํ‡ด ์ „ ์ˆ˜์ต๋ฅ  (pre_retirement_roi)**: ์€ํ‡ด ์ „ ์˜ˆ์ƒ ์—ฐ ์ˆ˜์ต๋ฅ  ๐Ÿ“Š
348
- # - **์€ํ‡ด ์ „ ๋ฐฐ๋‹น ์ˆ˜์ต๋ฅ  (pre_retirement_dividend_yield)**: ์€ํ‡ด ์ „ ๋ฐฐ๋‹น๊ธˆ ์ˆ˜์ต๋ฅ  ๐Ÿ“ˆ
349
- # - **์€ํ‡ด ํ›„ ์ˆ˜์ต๋ฅ  (post_retirement_roi)**: ์€ํ‡ด ํ›„ ์˜ˆ์ƒ ์—ฐ ์ˆ˜์ต๋ฅ  ๐ŸŒฟ
350
- # - **์€ํ‡ด ํ›„ ๋ฐฐ๋‹น ์ˆ˜์ต๋ฅ  (post_retirement_dividend_yield)**: ์€ํ‡ด ํ›„ ๋ฐฐ๋‹น๊ธˆ ์ˆ˜์ต๋ฅ  ๐Ÿ’ต
351
-
352
- # ### 2. ๊ณ„์‚ฐ ๊ณผ์ • ๐Ÿ”ข
353
-
354
- # **1) ์€ํ‡ด ์ „ ์ž์‚ฐ ๊ณ„์‚ฐ**
355
-
356
- # ํ˜„์žฌ ์ž์‚ฐ๊ณผ ๋งค์›” ์ถ”๊ฐ€ ํˆฌ์ž์•ก์„ ๊ณ ๋ คํ•ด ์€ํ‡ด ์ „ ์ž์‚ฐ์„ ๊ณ„์‚ฐํ•ด์š”. ์›”๋ณ„ ์ˆ˜์ต๋ฅ ์„ ์ ์šฉํ•˜์—ฌ ์ž์‚ฐ์ด ์–ด๋–ป๊ฒŒ ์„ฑ์žฅํ• ์ง€ ์˜ˆ์ธกํ•ฉ๋‹ˆ๋‹ค.
357
-
358
- # **๊ณต์‹:**
359
- # \[ \text{์›”๊ฐ„ ์ˆ˜์ต๋ฅ } = \left(1 + \frac{\text{์—ฐ ์ˆ˜์ต๋ฅ }}{100}\right)^{\frac{1}{12}} - 1 \]
360
-
361
- # **2) ์€ํ‡ด ํ›„ ์ž์‚ฐ ๋ฐ ๋ฐฐ๋‹น ์ˆ˜์ต ๊ณ„์‚ฐ**
362
-
363
- # ์€ํ‡ด ์‹œ์ ์˜ ์ž์‚ฐ๊ณผ ๋ฐฐ๋‹น ์ˆ˜์ต์„ ๊ธฐ๋กํ•˜๊ณ , ์€ํ‡ด ํ›„ ๋งค๋…„ ์ž์‚ฐ๊ณผ ๋ฐฐ๋‹น ์ˆ˜์ต์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. ๋งค๋…„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„๋„ ๋ฌผ๊ฐ€ ์ƒ์Šน๋ฅ ์— ๋งž์ถฐ ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
364
-
365
- # **3) ์ถ”๊ฐ€ ํ˜„๊ธˆ ํ•„์š”๋Ÿ‰ ๊ณ„์‚ฐ**
366
-
367
- # ๋ฐฐ๋‹น ์ˆ˜์ต๊ณผ ํ•„์š”ํ•œ ์ƒํ™œ๋น„๋ฅผ ๋น„๊ตํ•˜์—ฌ ์ถ”๊ฐ€๋กœ ํ•„์š”ํ•œ ํ˜„๊ธˆ์„ ๊ณ„์‚ฐํ•ด์š”.
368
-
369
- # **๊ณต์‹:**
370
- # \[ \text{์—ฐ๊ฐ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„} = \text{์›”๋ณ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„} \times 12 \]
371
- # \[ \text{์ถ”๊ฐ€ ํ˜„๊ธˆ ํ•„์š”๋Ÿ‰} = \text{์—ฐ๊ฐ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„} - \text{์—ฐ๊ฐ„ ๋ฐฐ๋‹น ์ˆ˜์ต} \]
372
-
373
- # ### 3. ๊ฒฐ๊ณผ ์ถœ๋ ฅ ๐Ÿ“ˆ
374
-
375
- # ๊ณ„์‚ฐ๋œ ๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค:
376
-
377
- # - **์€ํ‡ด ์งํ›„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„**์™€ **๋ฐฐ๋‹น ์ˆ˜์ต**์„ ํ•œ๋ˆˆ์— ๋ณผ ์ˆ˜ ์žˆ์–ด์š”.
378
- # - ์€ํ‡ด ํ›„ ๋งค๋…„ ์ž์‚ฐ, ํ•„์š”ํ•œ ์ƒํ™œ๋น„, ๋ฐฐ๋‹น ์ˆ˜์ต ๋“ฑ์„ ํ‘œ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
379
- # - ์ถ”๊ฐ€๋กœ ํ•„์š”ํ•œ ํ˜„๊ธˆ์„ ๊ณ„์‚ฐํ•˜์—ฌ ์ด ํ•„์š” ํ˜„๊ธˆ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
380
-
381
- # ### ์˜ˆ์ œ ๐ŸŽ
382
-
383
- # **์ž…๋ ฅ ๊ฐ’ ์˜ˆ์‹œ:**
384
-
385
- # - ํ˜„์žฌ ๋‚˜์ด: 40์„ธ
386
- # - ์€ํ‡ด ๋‚˜์ด: 65์„ธ
387
- # - ํ‰์ƒ ๊ธฐ๋Œ€ ์ˆ˜๋ช…: 85์„ธ
388
- # - ์›”๋ณ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„: 2,000,000 ์›
389
- # - ์ธํ”Œ๋ ˆ์ด์…˜์œจ: 2%
390
- # - ํ˜„์žฌ ํˆฌ์ž์•ก: 50,000,000 ์›
391
- # - ์›”๋ณ„ ์ถ”๊ฐ€ ํˆฌ์ž์•ก: 500,000 ์›
392
- # - ์›”๋ณ„ ํˆฌ์ž ์ฆ๊ฐ€์•ก: 50,000 ์›
393
- # - ๋ฐฐ๋‹น๊ธˆ ์žฌํˆฌ์ž ์—ฌ๋ถ€: ์˜ˆ
394
- # - ์€ํ‡ด ์ „ ์ˆ˜์ต๋ฅ : 5%
395
- # - ์€ํ‡ด ์ „ ๋ฐฐ๋‹น ์ˆ˜์ต๋ฅ : 2%
396
- # - ์€ํ‡ด ํ›„ ์ˆ˜์ต๋ฅ : 4%
397
- # - ์€ํ‡ด ํ›„ ๋ฐฐ๋‹น ์ˆ˜์ต๋ฅ : 2%
398
-
399
- # **์ถœ๋ ฅ ๊ฒฐ๊ณผ:**
400
-
401
- # - ์€ํ‡ด ์งํ›„ ์›”๋ณ„ ํ•„์š”ํ•œ ์ƒํ™œ๋น„: 2,000,000 ์›
402
- # - ์€ํ‡ด ์งํ›„ ์›”๋ณ„ ๋ฐฐ๋‹น ์ˆ˜์ต: 500,000 ์›
403
- # - ์ด ์ถ”๊ฐ€ ํ˜„๊ธˆ ํ•„์š”๋Ÿ‰: ๋งค๋…„ ์ถ”๊ฐ€๋กœ ํ•„์š”ํ•œ ๊ธˆ์•ก
404
-
405
- # **๊ทธ๋ž˜ํ”„์™€ CSV ํŒŒ์ผ ๐Ÿ“‰:**
406
-
407
- # - ์€ํ‡ด ๊ณ„ํš์„ ์‹œ๊ฐ์ ์œผ๋กœ ๋ณด์—ฌ์ฃผ๋Š” ๊ทธ๋ž˜ํ”„์™€ ๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ ํฌํ•จํ•œ CSV ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ ๋งํฌ๋„ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.
408
-
409
- # ์€ํ‡ด ๊ณ„ํš ๊ณ„์‚ฐ๊ธฐ๋ฅผ ํ†ตํ•ด ์—ฌ๋Ÿฌ๋ถ„์˜ ์žฌ์ • ๊ณ„ํš์„ ๋ฏธ๋ฆฌ ์ค€๋น„ํ•˜๊ณ , ์•ˆ์ •์ ์ธ ๋ฏธ๋ž˜๋ฅผ ๊ณ„ํšํ•ด๋ณด์„ธ์š”! ๐ŸŒŸ๐Ÿ’ผ
410
-
411
-
412
- # ### ๋ฉด์ฑ… ์กฐํ•ญ
413
- # ์ด ๋„๊ตฌ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ •๋ณด๋Š” ์ผ๋ฐ˜์ ์ธ ์ •๋ณด ์ œ๊ณต ๋ชฉ์ ๋งŒ์„ ์œ„ํ•ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ๋ชจ๋“  ์ •๋ณด๋Š” ์„ ์˜๋กœ ์ œ๊ณต๋˜์ง€๋งŒ, ์‚ฌ์ดํŠธ์˜ ์ •๋ณด์˜ ์ •ํ™•์„ฑ, ์ ์ ˆ์„ฑ, ์œ ํšจ์„ฑ, ์‹ ๋ขฐ์„ฑ, ๊ฐ€์šฉ์„ฑ ๋˜๋Š” ์™„์ „์„ฑ์— ๋Œ€ํ•ด ๋ช…์‹œ์ ์ด๋“  ๋ฌต์‹œ์ ์ด๋“  ์–ด๋– ํ•œ ์ข…๋ฅ˜์˜ ์ง„์ˆ ์ด๋‚˜ ๋ณด์ฆ์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์˜ ์‚ฌ์šฉ๊ณผ ์‚ฌ์ดํŠธ์˜ ์ •๋ณด๋ฅผ ์‹ ๋ขฐํ•˜๋Š” ๊ฒƒ์€ ์ „์ ์œผ๋กœ ์‚ฌ์šฉ์ž์˜ ์ฑ…์ž„์ž…๋‹ˆ๋‹ค.
414
- # """,
415
- # """
416
- # ## ๐Ÿ–๏ธ Retirement Planning Calculator Guide
417
-
418
- # Welcome to the Retirement Planning Calculator! ๐Ÿ˜Š This tool helps you forecast and prepare for your financial situation after retirement. Hereโ€™s how it works and what information you need to provide:
419
-
420
- # ### 1. Input Values ๐Ÿ“Š
421
-
422
- # Please provide the following details:
423
-
424
- # - **Current Age (current_age)**: Your current age ๐ŸŽ‚
425
- # - **Retirement Age (retirement_age)**: Age at which you plan to retire ๐ŸŽ‰
426
- # - **Life Expectancy (life_expectancy)**: Expected lifespan ๐ŸŒŸ
427
- # - **Monthly Income Required (monthly_income_required)**: Monthly expenses needed ๐Ÿ’ต
428
- # - **Inflation Rate (inflation_rate)**: Rate of inflation ๐Ÿ“ˆ
429
- # - **Current Investment (current_investment)**: Amount currently invested ๐Ÿ’ฐ
430
- # - **Monthly Investment (monthly_investment)**: Additional monthly investment ๐Ÿ’ธ
431
- # - **Annual Increase in Monthly Investment (annual_increase_in_monthly_investment)**: Increase in monthly investment (For example, if you plan to increase your monthly investment by $100,000 each year, enter 100,000.) ๐Ÿ“ˆ
432
- # - **Reinvest Dividends (reinvest_dividends)**: Whether to reinvest dividends ๐Ÿ”„
433
- # - **Pre-Retirement ROI (pre_retirement_roi)**: Expected annual return before retirement ๐Ÿ“Š
434
- # - **Pre-Retirement Dividend Yield (pre_retirement_dividend_yield)**: Dividend yield before retirement ๐Ÿ“ˆ
435
- # - **Post-Retirement ROI (post_retirement_roi)**: Expected annual return after retirement ๐ŸŒฟ
436
- # - **Post-Retirement Dividend Yield (post_retirement_dividend_yield)**: Dividend yield after retirement ๐Ÿ’ต
437
-
438
- # ### 2. Calculation Process ๐Ÿ”ข
439
-
440
- # **1) Pre-Retirement Asset Calculation**
441
-
442
- # The calculator uses your current assets and monthly contributions to forecast your asset growth before retirement. Monthly returns are applied to estimate how your assets will grow.
443
-
444
- # **Formula:**
445
- # \[ \text{Monthly Return} = \left(1 + \frac{\text{Annual ROI}}{100}\right)^{\frac{1}{12}} - 1 \]
446
-
447
- # **2) Post-Retirement Asset and Dividend Income Calculation**
448
-
449
- # The calculator tracks your assets and dividend income at retirement, then updates these figures annually. It also adjusts monthly income needs for inflation.
450
-
451
- # **3) Additional Cash Needed Calculation**
452
-
453
- # It compares dividend income with required income to determine if additional cash is needed.
454
-
455
- # **Formula:**
456
- # \[ \text{Annual Income Required} = \text{Monthly Income Required} \times 12 \]
457
- # \[ \text{Additional Cash Required} = \text{Annual Income Required} - \text{Annual Dividend Income} \]
458
-
459
- # ### 3. Results ๐Ÿ“ˆ
460
-
461
- # The results are displayed as follows:
462
-
463
- # - **Immediate Post-Retirement Income Needs** and **Dividend Income** for easy comparison.
464
- # - Annual asset, required income, and dividend income details in a table.
465
- # - Total additional cash required to cover any shortfall.
466
-
467
- # ### Example ๐ŸŽ
468
-
469
- # **Example Input Values:**
470
-
471
- # - Current Age: 40 years
472
- # - Retirement Age: 65 years
473
- # - Life Expectancy: 85 years
474
- # - Monthly Income Required: $2,000
475
- # - Inflation Rate: 2%
476
- # - Current Investment: $50,000
477
- # - Monthly Investment: $500
478
- # - Monthly Increase in Investment: $50
479
- # - Reinvest Dividends: Yes
480
- # - Pre-Retirement ROI: 5%
481
- # - Pre-Retirement Dividend Yield: 2%
482
- # - Post-Retirement ROI: 4%
483
- # - Post-Retirement Dividend Yield: 2%
484
-
485
- # **Output Results:**
486
-
487
- # - Monthly Income Required Immediately After Retirement: $2,000
488
- # - Monthly Dividend Income Immediately After Retirement: $500
489
- # - Total Additional Cash Required: Amount needed annually
490
-
491
- # **Graph and CSV File ๐Ÿ“‰:**
492
-
493
- # - Visual graphs of the retirement plan and a CSV file with detailed calculations are available for download.
494
-
495
- # Use the Retirement Planning Calculator to prepare for your future and ensure a secure retirement! ๐ŸŒŸ๐Ÿ’ผ
496
-
497
- # ### Disclaimer
498
- # The information provided by this tool is for general informational purposes only. All information on the site is provided in good faith, but we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information on the site. Your use of the site and reliance on any information on the site is solely at your own risk.
499
- # """
500
- # )
501
- gr.Markdown("""
502
-
503
- If you find this tool useful and would like to support the development of such projects, please consider making a donation. Your support is greatly appreciated.
504
-
505
- [![Donate with PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M8SBRC396DPBW)
506
-
507
- Or, if you prefer, you can also support us through Toss at:
508
-
509
- <a href="https://toss.me/eichijei" target="_blank">
510
- <img src="https://static.toss.im/logos/png/1x/logo-toss.png" alt="Donate with Toss" style="width: 150px;">
511
- </a>
512
- """)
513
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/compare_stock_prices_interface.py DELETED
@@ -1,27 +0,0 @@
1
- import gradio as gr
2
- from modules.utils import load_css
3
- from modules.compare_stock_prices import compare_stock_prices
4
-
5
- # Define the interface for the Compare tab
6
- def compare_stock_prices_interface_fn(stock_codes, period):
7
- result = compare_stock_prices(stock_codes, period)
8
- css = load_css()
9
- return css + result
10
-
11
- compare_inputs = [
12
- gr.Textbox(label="Stock Codes", info="Enter stock codes separated by comma.", placeholder="e.g., AAPL,GOOGL,MSFT", value="AAPL,GOOGL,MSFT"),
13
- gr.Number(label="Period (days)", value="90")
14
- ]
15
-
16
- output=gr.HTML()
17
-
18
- # Define the update function
19
- def update_output(stock_codes, period):
20
- return compare_stock_prices_interface_fn(stock_codes, period)
21
-
22
- # compare_stock_prices_interface = gr.Interface(
23
- # fn=compare_stock_prices_interface_fn,
24
- # inputs=compare_inputs,
25
- # outputs=gr.HTML(),
26
- # live=False
27
- # )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/cost_averaging_interface.py DELETED
@@ -1,22 +0,0 @@
1
- import gradio as gr
2
- from modules.cost_averaging import gradio_cost_averaging, load_css
3
-
4
- def cost_averaging_interface_fn(old_avg_price, old_quantity, new_price, new_quantity):
5
- result = gradio_cost_averaging(old_avg_price, old_quantity, new_price, new_quantity)
6
- css = load_css()
7
- return css + result
8
-
9
- # Define the inputs
10
- markdown1 = gr.Markdown("### First Purchase")
11
- old_price = gr.Textbox(label="Old Price", value="")
12
- old_quantity = gr.Textbox(label="Quantity", value="")
13
- markdown2 = gr.Markdown("### Second Purchase")
14
- new_price = gr.Textbox(label="New Price", value="")
15
- new_quantity = gr.Textbox(label="Quantity", value="")
16
-
17
- cost_averaging_inputs = [old_price, old_quantity, new_price, new_quantity]
18
- output = gr.HTML()
19
-
20
- # Define the update function
21
- def update_output(old_avg_price, old_quantity, new_price, new_quantity):
22
- return cost_averaging_interface_fn(old_avg_price, old_quantity, new_price, new_quantity)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/dollar_cost_averaging_interface.py DELETED
@@ -1,22 +0,0 @@
1
- import gradio as gr
2
- from modules.dollar_cost_averaging import dollar_cost_averaging
3
-
4
- examples = [
5
- [1000, 9000, 560, 20000]
6
- ]
7
- # Define the inputs
8
- title = gr.Markdown("<h2 style='margin: 5px'>Dollar Cost Averaging Calculator</h2>")
9
- first_purchase = gr.Markdown("<h3 class='h3_title'>FIRST PURCHASE</h3>")
10
- old_price = gr.Textbox(label="Old Price", value=7850)
11
- old_quantity = gr.Textbox(label="Quantity", value=70)
12
- second_purchase = gr.Markdown("<h3 class='h3_title'>SECOND PURCHASE</h3>")
13
- new_price = gr.Textbox(label="New Price", value=6700)
14
- new_quantity = gr.Textbox(label="Quantity", value=70)
15
-
16
- input = [old_price, old_quantity, new_price, new_quantity]
17
- output = gr.HTML()
18
- component_rows= [first_purchase, old_price, old_quantity, second_purchase, new_price, new_quantity]
19
-
20
- # Define the update function
21
- def update_output(*args):
22
- return dollar_cost_averaging(*args)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/portfolio_rebalancing_interface.py DELETED
@@ -1,37 +0,0 @@
1
- import gradio as gr
2
- from modules.portfolio_rebalancing import portfolio_rebalancing_tool, load_css
3
- from modules.utils import get_currency_codes
4
-
5
- def portfolio_rebalancing_interface_fn(main_currency, holdings, cash_amount, cash_ratio):
6
- result = portfolio_rebalancing_tool(main_currency, holdings, cash_amount, cash_ratio)
7
- css = load_css()
8
- return css + result
9
-
10
- currency_codes = get_currency_codes()
11
- examples = [
12
- ["KRW", "458730 KRW 580 8,\n368590 KRW 80 2", 7977, 0],
13
- ["KRW", "SCHD USD 500 8,\nQQQ USD 200 2", 0, 15]
14
- ]
15
-
16
- portfolio_inputs = [
17
- gr.Dropdown(label="Main Currency", choices=currency_codes, value="KRW", info="Assets converted to main currency."),
18
- gr.Textbox(label="Holdings", lines=2, info="Format: [ ticker currency quantity weight, ... ]", placeholder="e.g., SCHD USD 500 8, QQQ USD 200 2"),
19
- gr.Number(label="Cash", value="", info="MAIN CURRENCY CASH"),
20
- gr.Slider(label="Cash Ratio (%)", minimum=0, maximum=100, step=1)
21
- ]
22
-
23
- output = gr.HTML()
24
-
25
- # Define the update function
26
- def update_output(main_currency, holdings, cash_amount, cash_ratio):
27
- return portfolio_rebalancing_interface_fn(main_currency, holdings, cash_amount, cash_ratio)
28
-
29
- # portfolio_rebalancing_interface = gr.Interface(
30
- # fn=portfolio_rebalancing_interface_fn,
31
- # inputs=portfolio_inputs,
32
- # outputs=gr.HTML(),
33
- # examples=examples,
34
- # cache_examples=False,
35
- # live=False
36
- # )
37
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/rebalancing_interface.py DELETED
@@ -1,40 +0,0 @@
1
- import gradio as gr
2
- from modules.rebalancing import rebalancing_tool
3
- from modules.utils import currency_codes, current_time
4
-
5
- examples = [
6
- ["KRW", "458730 KRW 580 [8],\n368590 KRW 80 [2],", 507977],
7
- ]
8
-
9
- # Define Gradio components
10
- main_currency = gr.Dropdown(
11
- label="Main Currency",
12
- choices=currency_codes,
13
- value="KRW",
14
- # info="Assets converted to main currency"
15
- )
16
- title_setup = gr.Markdown(f"""<h3 class='h3_title'>Re-Balancing Calculator</h3>""")
17
- holdings = gr.Textbox(
18
- label="Portfolio [Target]",
19
- lines=2,
20
- # info="Format: Ticker Currency Quantity [Target_Weight], ...",
21
- placeholder="Format: Ticker Currency Quantity [Target_Ratio], ...",
22
- value="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]"
23
- )
24
- title_cash = gr.Markdown("<h3 class='h3_title'>Contribution or withdrawal</h3>")
25
- cash_amount = gr.Number(
26
- label="Contribution or withdrawal amount",
27
- value=6693188
28
- )
29
- allow_sales = gr.Checkbox(
30
- value=True,
31
- label="If checked, the table below will display both buy and sell transactions. If unchecked, only buy transactions will be shown."
32
- )
33
-
34
- input = [main_currency, holdings, cash_amount, allow_sales]
35
- output = gr.HTML()
36
- component_rows = [main_currency, holdings, cash_amount, allow_sales]
37
-
38
- # Define the update function
39
- def update_output(*args):
40
- return rebalancing_tool(*args)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/retirement_planning_interface.py DELETED
@@ -1,39 +0,0 @@
1
- import gradio as gr
2
- from modules.retirement_planning import retirement_planning
3
-
4
- # Define examples for retirement planning
5
- examples = [
6
- [38, 55, 85, 2000000, 3.0, 10000000, 500000, 0, True, 8, 8, 3.3, 3.3]
7
- ]
8
-
9
- # Define the input components
10
- title = gr.Markdown("<h2 style='margin: 5px'>Retirement Planning</h2>")
11
- title_profile = gr.Markdown("<h3 class='h3_title'>PROFILE</h3>")
12
- current_age = gr.Slider(label="Current Age (15-60 Years)", value=28, minimum=15, maximum=60, step=1)
13
- retirement_age = gr.Slider(label="Retirement Age (Upto 70 Years)", value=55, minimum=15, maximum=70, step=1)
14
- life_expectancy = gr.Slider(label="Life Expectancy (Upto 100 Years)", value=80, minimum=30, maximum=100, step=1)
15
- title_savings = gr.Markdown("<h3 class='h3_title'>SAVINGS</h3>")
16
- monthly_income_required = gr.Number(label="Monthly Income Required (CPP)", value=2000000)
17
- inflation_rate = gr.Number(label="Inflation Rate (%)", value=3)
18
- current_investment = gr.Number(label="Current Investment", value=10000000)
19
- monthly_investment = gr.Number(label="Monthly Investment", value=500000)
20
- annual_increase_in_monthly_investment = gr.Number(label="Annual Increase in Monthly Investment", value=0) # ์ถ”๊ฐ€๋œ ์ž…๋ ฅ
21
- reinvest_dividends = gr.Checkbox(label="Reinvest Dividends", value=True)
22
- title_growth = gr.Markdown("<h3 class='h3_title'>GROWTH</h3>")
23
- pre_retirement_roi = gr.Number(label="Return On Investment (Pre-retirement) (%)", value=8)
24
- post_retirement_roi = gr.Number(label="Return On Investment (Post-retirement) (%)", value=8)
25
- pre_retirement_dividend_yield = gr.Number(label="Dividend Yield (Pre-retirement) (%)", value=3.3)
26
- post_retirement_dividend_yield = gr.Number(label="Dividend Yield (Post-retirement) (%)", value=3.3)
27
-
28
- input = [current_age, retirement_age, life_expectancy, monthly_income_required, inflation_rate, current_investment, monthly_investment, annual_increase_in_monthly_investment, reinvest_dividends, pre_retirement_roi, post_retirement_roi, pre_retirement_dividend_yield, post_retirement_dividend_yield]
29
- output = gr.HTML()
30
- component_rows = [
31
- current_age, retirement_age, life_expectancy,[monthly_income_required, inflation_rate],
32
- current_investment, monthly_investment, annual_increase_in_monthly_investment, [reinvest_dividends],
33
- [pre_retirement_roi, post_retirement_roi], [pre_retirement_dividend_yield, post_retirement_dividend_yield]
34
- ]
35
-
36
- # Define the update function
37
- def update_output(*args):
38
- return retirement_planning(*args)
39
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
interface/share_price_trend_interface.py DELETED
@@ -1,30 +0,0 @@
1
- import gradio as gr
2
- from modules.share_price_trend import share_price_trend
3
-
4
- examples = [
5
- ["AAPL,GOOGL,MSFT", 90],
6
- ["SCHD,QQQ", 365]
7
- ]
8
-
9
- # Define Gradio components for inputs
10
- title = gr.Markdown("<h2 style='margin: 5px'>Share Price Trend</h2>")
11
- stock_codes = gr.Textbox(
12
- label="Stock Codes",
13
- # info="Enter stock codes separated by comma.",
14
- placeholder="e.g., AAPL,GOOGL,MSFT",
15
- value="SCHD,QQQ"
16
- )
17
- period = gr.Slider(
18
- label="Number of Days",
19
- value=90,
20
- maximum=3650
21
- )
22
-
23
- # Define output component
24
- input = [stock_codes, period]
25
- output = gr.HTML()
26
- component_rows = [[stock_codes], [period]]
27
-
28
- # Define the update function
29
- def update_output(*args):
30
- return share_price_trend(*args)