Add: Korean comments to habit_bot.py and stock_tracker.py
- Added bilingual headers with Korean descriptions - Added Korean section comments for all major functions - All documentation now bilingual (EN/KO) Files updated: - habit_bot.py - stock_tracker.py Added comments in Korean for: - Configuration section - Data models - Habit management - Food logging - URL summarization - Command handlers
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Stock #!/usr/bin/env python3 Crypto Portfolio Tracker / 주식 및 암호화폐 포트폴리오 트래커
|
||||
# 기능:
|
||||
# - 주식 및 암호화폐 가격 추적 / Track stocks and crypto prices
|
||||
# - 포트폴리오 P#!/usr/bin/env python3L 계산 / Calculate portfolio P#!/usr/bin/env python3L
|
||||
# - 시장 지수 비교 / Compare against market indices
|
||||
# - 투자 권고사항 생성 / Generate investment recommendations
|
||||
# - 일일/주간 리포트 / Daily/weekly reports
|
||||
"""
|
||||
Stock & Crypto Portfolio Tracker
|
||||
Features:
|
||||
@@ -79,7 +88,7 @@ class StockTracker:
|
||||
self.positions = self._load_positions()
|
||||
self.prices = self._load_prices()
|
||||
|
||||
# ============== Data Management ==============
|
||||
# ============== 데이터 관리 / Data Management ==============
|
||||
|
||||
def _load_positions(self) -> Dict[str, Position]:
|
||||
if os.path.exists(PORTFOLIO_FILE):
|
||||
@@ -102,7 +111,7 @@ class StockTracker:
|
||||
with open(PRICES_FILE, 'w') as f:
|
||||
json.dump({k: asdict(v) for k, v in self.prices.items()}, f, indent=2)
|
||||
|
||||
# ============== Portfolio Management ==============
|
||||
# ============== 포트폴리오 관리 / Portfolio Management ==============
|
||||
|
||||
def add_position(self, symbol: str, asset_type: str, quantity: float,
|
||||
avg_cost: float, entry_date: str = "", notes: str = "") -> bool:
|
||||
@@ -135,7 +144,7 @@ class StockTracker:
|
||||
def get_positions(self) -> List[Position]:
|
||||
return list(self.positions.values())
|
||||
|
||||
# ============== Price Fetching ==============
|
||||
# ============== 가격 가져오기 / Price Fetching ==============
|
||||
|
||||
def fetch_price(self, symbol: str) -> Optional[PriceData]:
|
||||
"""Fetch current price for a symbol using yfinance"""
|
||||
@@ -188,7 +197,7 @@ class StockTracker:
|
||||
self._save_prices()
|
||||
return self.prices
|
||||
|
||||
# ============== Performance Calculation ==============
|
||||
# ============== 성과 계산 / Performance Calculation ==============
|
||||
|
||||
def calculate_portfolio_summary(self) -> PortfolioSummary:
|
||||
"""Calculate portfolio summary with P&L"""
|
||||
@@ -291,7 +300,7 @@ class StockTracker:
|
||||
return ((price.current_price - pos.avg_cost) / pos.avg_cost) * 100
|
||||
return 0
|
||||
|
||||
# ============== Crypto & Market Data ==============
|
||||
# ============== 암호화폐 및 시장 데이터 / Crypto & Market Data ==============
|
||||
|
||||
def get_crypto_price(self, symbol: str = "BTC") -> Optional[PriceData]:
|
||||
"""Fetch cryptocurrency price using yfinance"""
|
||||
@@ -359,7 +368,7 @@ class StockTracker:
|
||||
|
||||
return result
|
||||
|
||||
# ============== Reporting ==============
|
||||
# ============== 리포팅 / Reporting ==============
|
||||
|
||||
def generate_daily_report(self) -> str:
|
||||
"""Generate daily portfolio report"""
|
||||
|
||||
Reference in New Issue
Block a user