我想用emacs org-mode记录每日股票交易情况。
通常我用低价购入股票,会记录购入时间、价格、股数,然后按照买入价x1.3%形成卖出价,记录在表格里,并且指示该卖出动作还没有完成。
我想用TODO来标记这个卖出动作未成,可是表格没有这个功能。
我想请教您帮我设计我要怎么做才完成我的设想。
| buy price | buy date | buy count | sell price | sell count | sell date | profit | memo |
|-----------+----------+-----------+------------+------------+-----------+--------+------|
| 15.39 | 2021/8/3 | 400 | [ ] 15.53 | 400 | | #ERROR | |
| 15.67 | 2021/8/5 | 1000 | [ ] 15.88 | 1000 | | #ERROR | |
| 15.22 | 2021/8/6 | 700 | [x] 15.43 | 700 | | 147. | |
#+TBLFM: $7=($4-$1)*$5
本来想在国外论坛提问的,没法注册。
先留下这些英语,这是我辛苦用翻译软件翻译出来的内容,丢了可惜。
[org-mode]How to use a table to record daily stock market transactions
I want to use a table to record daily stock market transactions.
I often buy stocks first and record the price, quantity, and time of purchase.
I will sell the purchased stock at a slightly higher price.
I want to use some methods to remind me at what price I should sell.
“TODO” cannot be used in tables and inside.
Can someone help me design how I should deal with it?
其实就是做一个记录而已。
我以前用OneNote来记录的。
用beancount进行记录,fava有个视图可以用来查看。
beancount是用来管理财务的,也可以很方便的记录股票的买入和买出。
1 个赞
onenote好评,我以前是用excel记录的,后来做中长线了,没啥频繁记录的需要了,就买了个笔记本(纸的),然后手机设置好价格提醒,半个月都不一定认真看一次盘面,笔记本到现在都还没用完一页
表格做起来有难度,可以尝试以下 org-columns
。计算公式可以参考下面的两个函数进一步扩展。优势是可以看到 todo
的状态,而且可以在这个表内无限写笔记。
(defun abs-no-name-space/update-money-at-org-drawer ()
"这个函数在标题下使用,来更新赚了多少。"
(interactive)
(when (eq major-mode 'org-mode)
(org-set-property "profit" (abs-no-name-space/awesome))))
(defun abs-no-name-space/awesome ()
(let ((abs-no-name-space/profile
(* (string-to-number (org-entry-get (point) "buy-count"))
(- (string-to-number (org-entry-get (point) "sell-price"))
(string-to-number (org-entry-get (point) "buy-price"))))))
(number-to-string abs-no-name-space/profile)))
下面是一个玩具 org-mode
headline 用来生成上图。
* 2021 battle field
:PROPERTIES:
:LAST_MODIFIED: [2021-08-06 Fri 11:50]
:END:
** DONE Apple
:PROPERTIES:
:buy-price: 6
:buy-count: 66
:sell-price: 77
:LAST_MODIFIED: [2021-08-06 Fri 12:07]
:profit: 4686
:END:
** DONE GitHub
:PROPERTIES:
:buy-price: 666
:buy-count: 77
:sell-price: 222
:profit: -34188
:END:
** TODO Space-X
:PROPERTIES:
:buy-price: 33
:buy-count: 111
:sell-price:
:profit:
:END:
* config
:PROPERTIES:
:LAST_MODIFIED: [2021-08-06 Fri 11:17]
:END:
#+COLUMNS: %35ITEM %TODO %10buy-price %10buy-count %10sell-price %10profit
1 个赞