邢不行的系列帖子“量化小讲堂”,通过实际案例教初学者使用python进行量化投资,了解行业研究方向,希望能对大家有帮助。? ?
The “Quantified Lectures” series, which teaches beginners to use python to quantify their investments, understand the direction of industry research, in the hope that it will help us all?
? 【历史文章汇总】请点击此处
这是比特币最近一年多的价格走势图,总体是下跌趋势,从最高点的2万美金跌到目前的8000美金。
This is a price map of Bitcoin for more than a year, with an overall downward trend of , falling from the top 20,000 dollars to the current 8,000 dollars.
假设你在牛市最疯狂的2017年底,比特币涨到2万美金时买入了比特币。
Let's say you bought a bitcoin at the end of 2017, the craziest place in the bull, when Bitcoin went up to $20,000.
那你可能会被很多人当做傻子,毕竟套牢在最高点,净亏损60%...
Then you'll be treated like a fool by a lot of people. After all, you're at the top, with a net loss of 60%...
但假设你并没有梭哈式的买入,也就是没有一下子把所有的钱都在那时候买成比特币,而是通过一种叫做定投的方式来进行投资,那么结果可能就不一样。
But if you do not buy without , that is, not all the money was bought in bitcoin at that time, but invested in a way called / strong >, then the result may be different.
什么是定投?定投全称为定期投资。也就是不管价格的变动,总是定期、定量的买入。
what is a scheduled investment? is called a fixed-term investment.
例如不管比特币价格是多少,就是每天花一万元买入比特币,这就是定投。当然你也可以调整投资频率,比如每周投、每月投,投的金额也可以自己把握。
For example, whatever the price of a bitcoin is, it costs $10,000 a day to buy a bitcoin, which is a scheduled investment. Of course, you can adjust the frequency of investment, for example, on a weekly basis, on a monthly basis, and on your own.
关于定投,之前的量化小讲堂系列文章中也有几篇涉及,感兴趣可以参考:
There are also a number of articles in the series of Quantified Lectures on scheduled contributions, which are of interest to refer to:
2019年,每天花1万元定投比特币
In 2019, $10,000 a day for bitcoin.
Python告诉你:股神巴菲特有坑我们吗?
Python told you: "Is there a hole in us in Buffett?"
那如果定投的话,从2万美金开始定投,到现在的8000美金,到底是赚了还是亏了呢?
So if we're going to do it, we're going to start with $20,000, and now we're going to make or lose $8,000?
此时我们可以使用历史数据进行模拟,看看到底是赚还是亏。
At this point, we can use historical data for simulations to see if we're earning or losing.
2017年12月16日比特币达到最高点2万美金,假设我们从此时开始定投,每天投入100美元,最终结果如下图:
On 16 December 2017, Bitcoin reached its highest point of $20,000, assuming that we would start with a pledge of $100 a day, with the following results:
图中的蓝色曲线,代表我们每天买入的钱的累计值。因为每天等额增加100元,所以这是条直线。黄色的曲线是我们买入的币的市值。
The blue curve in the figure represents the cumulative value of the money we buy every day. It's a straight line because it increases the equivalent by $100 a day. The yellow curve is the market value of the money we buy.
从图中我们可以看到,从2017年12月16日到最近的2019年5月19日,每天投入100美金,最终总计投入了5.2万。这些钱大约买入了8.63个比特币。
From 16 December 2017 to 19 May 2019, as we can see, the sum of $100 a day was spent on
而这些比特币目前价值约7万美金!
And these bitcoins are now worth about $70,000!
5.2万变成7万,也就是说居然赚钱了?还赚了大约30%?明明价格下跌了一办还多,但是最终居然还赚钱了?
52,000 went to 70,000, which means you're making money? You're making about 30%. You're making a lot of money.
具体原因我们来看下这张图片,图中蓝线是比特币的价格,黄线是定投时平均买币成本。
For specific reasons, we look at this picture, in which the Blue Line is the price of bitcoin and the Yellow Line is the average cost of buying currency at the scheduled time of delivery.
从图中可以看到,从2万开始买币,虽然价格一直下跌。但是因为持续的买入,平均持币成本也在不断的下降。
As can be seen from the graph, the purchase of the currency began with 20,000, although prices have been falling. But the average cost of holding the currency has also been declining as a result of continued purchases.
下表列出每个月末的定投相关数据:
The following table shows the target data at the end of each month:
从表中可以看到,等到2019年之后,平均持币成本已经降低到了6000左右。随着最近比特币价格一波上涨至8000,自然而然也就开始盈利了。
As can be seen from the table, the average cost of holding a currency has been reduced to about 6,000 by 2019. As the price of bitcoin has recently risen to 8,000, it naturally begins to make a profit.
这就是定投能够赚钱的主要原因:在熊市中,通过不断的持续投资,大量收集低位筹码,显著拉低成本。
That's the main reason why you can make money:
除了比特币之外,我们还可以看一下定投其它主流数字货币的效果,比如EOS。
In addition to Bitcoin, we can look at the effects of other mainstream digital currencies, such as EOS.
下图显示EOS最近一年的行情,从去年4月末的最高点24美金左右,跌到现在的6.5美金左右。
The figure below shows the latest EOS experience in the year, falling from a peak of about $24 at the end of April last year to about $6.5 today.
假设我们就是从2018年4月30日的最高价处开始定投,每天投入100美金买如EOS,一直到最近的2019年5月19日,最终结果如下表:
Assuming that we start with the highest price on 30 April 2018 and invest $100 a day to buy something like EOS, until the most recent date of 19 May 2019, the final results are as follows:
由表中最后一行可见,我们累计投入了38500美金,最终买入币的市值是55022,盈利42.9%,比比特币盈利更多。
As can be seen from the last line of the table, we accumulated $38,500 and eventually bought the currency at a market value of 55022, with a profit of 42.9 per cent and more than bitcoin.
1. 定投随时可以开始
1. The pitch can begin at any time .
很多人最近想开始定投,但觉得最近币价涨了,担心已经错过了定投的最好时机。但根据我们上文的例子,完全要有这样的担心。因为在最高点开始定投都能赚钱,其他时间开始,只会更加赚钱。
Many people have recently tried to start making offers, but they feel that the currency price has recently risen, fearing that they have missed the best time to do so. But, according to our example above, there is a need for such concerns. Because at the highest point, when you start putting, you can make money, and at other times, you can only make more money.
2. 定投倾向于选择波动大的品种
2.
如果能做到长期定投的话,可以选择波动较大的品种。因为较大的波动往往可以让我们更容易以更低的价格买到币。上文中我们的举例中,EOS相比BTC波动更大,最终受益也更高。
If long-term investments can be made, it is possible to choose the species that are more volatile. Because larger fluctuations tend to make it easier for us to buy currency at lower prices. In our example above, the EOS is more volatile and ultimately more beneficial than the BTC.
当然,波动大也代表风险更大。仔细观察上文中的数据你会发现,定投EOS最惨时亏损56%,而比特币是46%。
Of course, high volatility means greater risk. A closer look at the data above shows that 56% of the worst losses are set for EOS, compared to 46% for Bitcoin.
3.?定投的前提是长期看好
3. ?
定投最害怕的是投资了一个长期下跌的品种,一直跌的话你是永远不可能赚钱的。所以在定投开始之前,一定要做足功课,对投资的品种有强烈的信心。
The most scary thing is to invest in a long-term falling variety, and you'll never make money if you keep falling. So, before you start, you have to do your homework and have strong confidence in the type of investment.
定投最好的心态甚至是越跌越开心。比如我现在虽然持币,但还是很希望币价下跌,因为下跌后又可以用更低的价格买入更多的币了。
The best thinking is that . For example, I'm holding a currency, but I'm hoping that it will fall, because it will buy more at lower prices.
了解我的朋友知道,我自己主要是做量化投资的。所谓量化投资,就是所有买卖的决定,都是由客观的交易规则来决定,而不是人脑。
Know that my friends know that I'm mainly making quantitative investments. The decision to quantify investments, that's all `strong' deals, is determined by objective trading rules, not by the brain .
所以无视价格,定期、定量买入的定投,也是一种量化投资。
So paying no attention to prices, regular, quantitatively purchased investment is also a quantitative investment.
视频链接:什么是量化交易?
video link: What are quantitative transactions?
很多人会说定投好,建议大家去定投,可是定投到底好在哪里,到底赚不赚钱,往往不能给出一个明确的答案。而我们上文的案例,就用最真实的数据,明确告诉你定投在历史上可以赚多少钱。
A lot of people say they're going to make a deal, but they're going to make a decision where they're going to be, whether they're making money or not, and they're often not going to be able to give a clear answer. In our case, we use the most realistic data to tell you exactly how much money we're going to make in history.
这就是量化投资另外一个重要的特征:用历史数据去验证我们的交易规则,验证赚钱之后,再投入实战,而不是盲目的尝试。
This is another important feature of quantitative investment: uses historical data to validate our trading rules
而使用历史数据验证交易规则,需要通过编程来处理数据,文末附上使用历史数据计算定投收益的Python程序。
The use of historical data to authenticate transaction rules requires the processing of data through programming, with the Python program that uses historical data to calculate the yield.
可以加我微信,获取代码和历史数据,自己尝试看看如何定投更加赚钱。
You can add my micro-letters, get code and historical data, try to figure out how to put more money into it.
看不懂Python代码,也可以看下方的详细视频讲解,逐行代码讲解,看完之后就知道Python其实并不难。
You don't understand Python's code, you can read the details of the video below, the line by line, and it's easy to know that Python is not.
系列文章推荐阅读:
2018量化炒币7大玩法复盘 | 视频、PPT分享
2018 Quantified 7 Playbacks Video, PPT Sharing
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论