python中的sma
In one of my previous posts, I talked about the SMA strategy and its application to the stock market. I showed the reader how to create the strategy in python, graph the results, as well as see the date of the price of the buy or sell option.
在我以前的一篇文章中,我谈到了SMA策略及其在股市中的应用。 我向读者展示了如何在python中创建策略,绘制结果图形以及查看买入或卖出期权价格的日期。
Today, I’ll show you how I implemented the SMA strategy with web scraping to save new information to our pre-existing file and graph the new data.
今天,我将向您展示如何通过网络抓取实施SMA策略,以将新信息保存到我们现有的文件中并以图形方式绘制新数据。
DISCLAIMER: Stocks can be risky and it is very possible to lose money. I have not used this strategy to make any financial gains, investments, or purchases. I do not recommend you read this article and use the strategy for your own investment purposes and/or financial gain. I am not responsible for your losses if you choose to use this. The strategy below is only an experiment.
免责声明:股票可能具有风险,很可能会亏损。 我没有使用这种策略来获得任何财务收益,投资或购买。 我不建议您阅读本文,并出于自己的投资目的和/或财务收益而使用该策略。 如果您选择使用此方式,我对您的损失不承担任何责任。 以下策略只是一个实验。
I combined the graphing and SMA strategy into one cell that takes in the csv information and creates new SMA30 and SMA100 information. The function works with any stock no matter the price.
我将制图和SMA策略合并到一个单元中,该单元接收csv信息并创建新的SMA30和SMA100信息。 该功能适用于任何库存,无论价格如何。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/0fe27724531bacf8786f2d437d9a0694.png)
The strategy is a nested function inside the graphing function.
该策略是图形函数内部的嵌套函数。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/b653ca1692ae677ded3a4211f974408a.png)
We store all the information into variables just like before.
我们像以前一样将所有信息存储到变量中。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/816f114df2fdba339e41cd59f8faa01a.png)
Now we graph it again. These lines of code