Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fractional part from stock_div must be cash refunds (#273) #288

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

sakkyoi
Copy link
Contributor

@sakkyoi sakkyoi commented Mar 1, 2024

提供個人修正 #273 的做法,

gain_stock_frac = gain_stock_div % 1  # 取 gain_stock_div 小數部分
gain_stock_div = gain_stock_frac - gain_stock_frac  # gain_stock_div 只留整數部分
gain_cash = cash_div * trader.hold_volume + gain_stock_frac * 10  # 將小數部分加進 gain_cash

其中小數部分加進 gain_cash 的部分,大部分公司都是能讓股東選擇與其他股東湊齊整數做合併,或是不合併的話以面值退還現金。由於大部分公司面額是 10 元,因此這邊直接用 10 元做計算。實際上應該要另外處理 (?),或是直接保留小數部分? 將該欄位型態改為 float 避免 pydandic 報錯?

@linsamtw linsamtw merged commit 3ba1e70 into FinMind:master Mar 24, 2024
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants