扮工神器
唔知大家有冇扮工嘅需要,有嘅話希望今次嘅Excel 小工具啱用。
有投資股票或Crypto 嘅朋友,正常都會關心自己嘅資產。要睇睇資產價格,當然可以上web睇apps。專業嘅話,可能有投資經理或課金apps代勞,資金少又老餅嘅如我,最多只係用吓Excel or Google Spreadsheet,manual update吓現價,再乘coin or 股數,最後加埋總數就算。
從web or apps manual update現價絕對係煩,雖然新版Excel or Google Spreadsheet 都叫有工具update 股價,是否合用就交畀大家研究,個人就覺得廢廢哋,所以最後都係自己攪咗呢件扮工神器。
事原其實先要多謝Makzan,係佢inspire咗我整扮工神器。作為新Matters市新移民,今年10月加入,1個字曰… 懶!比樹懶更懶!早前寫咗兩篇matters 文章,Makzan追蹤咗小弟,我亦不客氣反追蹤,見Makzan有一篇文章” Python 與 JSON API 應用入門:使用 Python 取得現時 LikeCoin 幣價” ,教用Python 從CoinGecko 取得coin 價,真心正!
Python 於我新手都不如,但尚可以睇得明,所以我就唔客氣攞個concept ,convert 咗佢做Excel Macro,最後做成扮工神器,送禮自用。
廢話到此為止,先從https://arweave.net/xuSfNEceTfpN7L08tVl3U1E76Q8CDTUehKIyhZ5DDnE download 扮工神器,unzip後打開打開“扮工神器.xlsm”,click Enable Content。
![](https://assets.matters.news/embed/c983d128-2a61-4a38-91a2-a837278761c1.png)
扮工神器內有兩張worksheets, 我哋先用MyPortfolio講解,Coinlist容後再說。
![](https://assets.matters.news/embed/eb15e74d-f6b6-45eb-9911-a8d6bf0090c3.png)
首先,A2到A4輸入幾個關心嘅Crypto ID,如bitcoin, ethereum & likecoin,跟著喺B2輸入formula“=CoinGeckoPrice(A2)”,enter之後等一等就會出現BTC喺CoinGecko 嘅現價。
![](https://assets.matters.news/embed/f84903a3-df19-4e5d-be44-d8187b897e8a.png)
喺 C2輸入手上有嘅BTC數目,再喺D2乘一乘,完成一行。
![](https://assets.matters.news/embed/50926694-aaba-411d-bcc4-8b7aed47d3df.png)
之後如想check BAT嘅價錢,可以去第二張worksheet "CoinList"度,B column 輸入BAT落 filter ,揾到BAT嘅ID喺basic-attention-token,copy 個ID 到MyPortfolio A5。
![](https://assets.matters.news/embed/e1671539-ffce-48de-a62f-3fc5c4bad796.png)
跟著copy B2至D2,paste 到B3至D5,修改一下數量,基本完成。
![](https://assets.matters.news/embed/b2875e04-b8bb-40be-a439-04e3bdbc0c89.png)
扮工神器除咗有formula CoinGeckoPrice() 照顧Crypto 用家,同場加映formula BloombergPrice() ,用法同CoinGeckoPrice() 極相似,只要輸入股或指數嘅ID便可。
![](https://assets.matters.news/embed/cf8a7214-ab56-4be9-8b38-ef3536f9d34d.png)
以下例子有Dow Jones, Tesla, Netflix, 恆指& 港交所,注意388以港紙計算,not USDT。
![](https://assets.matters.news/embed/8172fe3c-79d5-4a3b-977e-1de368271629.png)
Excel 勝在flexible,稍微改改,HKD計價都no problem at all。
![](https://assets.matters.news/embed/14845ef2-f1fe-4f8f-8e88-7ea50b50f549.png)
最後,請注意CoinGeckoPrice 又好,BloombergPrice 又好,背後有fair use policy,扮工神器雖然有Refresh 掣,但唔可以一次過update 太多現價,太多嘅話會出事。希望今次可以幫到大家扮工,覺得正請随便分享!
Reference
Python 與 JSON API 應用入門:使用 Python 取得現時 LikeCoin 幣價
Pulling Stock Prices into Excel by Formula (VBA code provided)
https://www.thoughtignitor.com/finance/stock-prices-in-excel-by-formula/
json parser
https://github.com/VBA-tools/VBA-JSON
VBA-Dictionary
喜欢我的作品吗?别忘了给予支持与赞赏,让我知道在创作的路上有你陪伴,一起延续这份热忱!
![](https://imagedelivery.net/kDRCweMmqLnTPNlbum-pYA/prod/avatar/c41fb101-9883-45d2-8cf5-af0082706537.png/public)
- 来自作者
- 相关推荐