c++ 从命令行获取参数_从命令行获取股票行情

c++ 从命令行获取参数

When I conned my way into my first professional programming gig, I didn't really think much about money -- just that I was getting my foot in the door.  But as my career has gone on, I've been more aware of money, investing, and retirement.  I've recently regretfully gotten into stock trading -- you can imagine how many times a day I hit the ole F5 to see updated quotes, praying my investments push higher.

当我进入自己的第一个专业编程专区时,我并没有真正想过钱-只是我正在步入正轨。 但是随着我事业的发展,我对金钱,投资和退休有了更多的了解。 我最近 遗憾地 进入股票交易-您可以想象我一天打几次ole F5来查看更新的报价,祈祷我的投资增加。

I also spend a large part of my day in iTerm, so switching back and forth between the browser and the terminal is time-consuming and annoying.  I looked for a way to get stock quotes from the command line, and thanks to Yahoo, it's a simple process!

我还在iTerm中度过了大部分时间,因此在浏览器和终端之间来回切换既费时又烦人。 我正在寻找一种从命令行获取股票报价的方法,感谢Yahoo,这是一个简单的过程!

获取当前价格 (Get Current Price)

Since cURL is amazing and easy to use, we'll roll with that:

由于cURL非常棒且易于使用,因此我们将介绍以下内容:


#One stock
curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1'

#Multiple stocks, separated by comma
curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl,meip&f=l1'


Yahoo! Finance's information, which is fairly "real time", provides quotes within the s parameter and the f parameter of l1 provides the formatted result.

雅虎! 财务信息相当“实时”,在s参数中提供了引号,而l1f参数提供了格式化的结果。

通过更改获取当前价格 (Get Current Price with Change)

If you'd like to know the amount changed on the day, tag c1 to the f parameter:

如果您想知道当天的金额变化,请将c1标记为f参数:

curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1c1'

Not needing to jump over to the browser to get stock quotes has been nice...especially if the market is having a down day and you don't want to see a screen of red.  Booooo.

无需跳到浏览器即可获得股票报价非常好……尤其是在市场低迷且您不想看到红色屏幕的情况下。 Booooo。

翻译自: https://davidwalsh.name/stock-quotes-command-line

c++ 从命令行获取参数

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值