大概跟很多人一样,我也用了bayunjiang的插件来生成sitemap。但是启用插件后,会发现https://unique-ptr.com/sitemap.xml 会提示404无法跳转。
查证后发现这个跟伪静态是否开启有关,如果后台没有开启伪静态,那么需要跳转到https://unique-ptr.com/index.php/sitemap.xml 才能访问。最终的解决方案当然是开启伪静态,参考这篇文章,在后台设置一下就可以了。
月度归档: 2020 年 2 月
-
Typecho sitemap 插件 无法跳转sitemap.xml的解决办法
-
中国移动 支付宝 移动花卡 取消自动扣款方法
移动花卡自带12个月协议期。以前能够从“移动花卡”的小程序进入,现在入口非常复杂,目测是故意为之。
协议期后取消自动扣款的方法如下:- 进入支付宝的“花呗”页面
- 点击“我的账单”,然后右上角“更多”,选择“历史账单”
- 进入历史账单后,选择已经出账有花卡记录的上个月账单,点进去就能看到“花卡月套餐费”
- 然后在点进去有账单详情,最底下有个“取消自动扣款服务”的按钮,点进去
- 可以看到“移动花卡业务申请”,底下有个“关闭服务”的大按钮,知道怎么做了吧
-
iPhone XR (XS) power/volume button replacement 电源键、音量键拆解教程
首先把音量键的铁环往外侧拉,这个结构非常像PC键盘.
First pull the iron ring of the volume key to the outside, this structure is very similar to a PC keyboard.随后把金属片右侧往上推出。推出后贴片的位置是斜杠/型的,然后左侧直接拉出即可.
Then push up the right side of the iron piece. After pushing out, the position of the patch is like a slash “/”, and then you can directly pull it out on the left side. -
滑点(Slippage)与交易冲击
解释滑点之前,先看限价订单簿(limit orderbook):
图中买一(top bid)和卖一(top ask)的价差成为点差(spread, 也有叫盘口),买卖价的中间点称为中点价格(mid-point price)。简单情况下,我们会用中点价作为交易成本的一个基准因素。
对于每个交易的子订单,最终的成交价与该基准之间的差是衡量交易成本的度量,称为“滑点(slippage)”。关于滑点,打个比方:假设我打算买入500手茅台,此时的买一是999.8, 卖一是1000.2,中间价是1000.0。我可能会挂一个市价买单(bid market order),市价单将会以对手方的最优价(best offer price)成交。单挂出去后,反馈给我2笔成交记录:300@1000.2, 200@1000.4;第一次成交盘口没变,第二次成交的时候,盘口变成了1000.2(bid1), 1000.4(ask1)。这样的话,两次的滑点分别是0.2, 0.4(记住是以挂单时的中间价算)。
我们可以将滑点视为两种价格影响的总和——暂时的价格影响+永久的价格影响。
暂时的价格冲击可以表示为中间价与买/卖一价的价差,上面的例子中是0.2。永久的价格冲击可以表示为成交后到成交前的中间价变化,你(当然还有其它市场参与者)的交易影响了这只股票的盘口————上面的例子里,第二次成交的时候中间价从1000.0变成了1000.3。
换言之,这次成交的滑点如下:
x 暂时影响 永久影响 滑点 第一次 1000.2-1000.0 0 0.2+0 第二次 1000.4-1000.3 1000.3 – 1000.0 0.1+0.3 -
pyprof2calltree — Python 性能分析 可视化
性能分析用cProfile
python -m cProfile -o output.perf your_script.py --your args
然后可以安装pyprof2calltree
pyprof2calltree -i output.perf -k
记得系统里要装qcallgrind(windows)或者kcallgrind,不然会打不开生成好的log
-
Backtest Best Practices 股票回测的最佳实践
Use cross-validation to achieve just the right amount of model complexity.
使用交叉验证来实现适当数量的模型复杂性。Always keep an out-of-sample test dataset. You should only look at the results of a test on this dataset once all model decisions have been made. If you let the results of this test influence decisions made about the model, you no longer have an estimate of generalization error.
始终保持样本外测试数据集。做出所有模型决策后,您只应查看此数据集上的测试结果。如果让此测试的结果影响有关该模型的决策,则您将不再具有泛化误差的估计值。Be wary of creating multiple model configurations. If the Sharpe ratio of a backtest is 2, but there are 10 model configurations, this is a kind of multiple comparison bias. This is different than repeatedly tweaking the parameters to get a sharpe ratio of 2.
小心创建多个模型配置。如果回测的夏普比率为2,但是有10个模型配置,则这是一种多重比较偏差。这与反复调整参数以得到夏普率=2不同。Be careful about your choice of time period for validation and testing. Be sure that the test period is not special in any way.
请谨慎选择验证和测试的时间段。确保测试期不以任何方式特殊。Be careful about how often you touch the data. You should only use the test data once, when your validation process is finished and your model is fully built. Too many tweaks in response to tests on validation data are likely to cause the model to increasingly fit the validation data.
请注意您多久接触一次数据。验证过程完成且模型完全构建后,您仅应使用一次测试数据。对验证数据的测试做出的太多调整很可能导致模型越来越适合验证数据。Keep track of the dates on which modifications to the model were made, so that you know the date on which a provable out-of-sample period commenced. If a model hasn’t changed for 3 years, then the performance on the past 3 years is a measure of out-of-sample performance.
跟踪对模型进行修改的日期,以便您知道可证明的超出样本期限的开始日期。如果模型已经3年没有变化,那么过去3年的性能就是衡量样本外性能的指标。Traditional ML is about fitting a model until it works. Finance is different—you can’t keep adjusting parameters to get a desired result. Maximizing the in-sample sharpe ratio is not good—it would probably make out of sample sharpe ratio worse. It’s very important to follow good research practices.
传统的ML就是在模型起作用之前对其进行拟合。金融数据的ML有所不同-您无法不断调整参数以获得理想的结果。最大化样本内夏普比率不是很好-可能会使样本外夏普比率变得更糟。遵循良好的研究规范非常重要。How does one split data into training, validation, and test sets so as to avoid bias induced by structural changes? It’s not always better to use the most recent time period as the test set, sometimes it’s better to have a random sample of years in the middle of your dataset. You want there to be nothing SPECIAL about the hold-out set. If the test set was the quant meltdown or financial crisis—those would be special validation sets. If you test on those time periods, you would be left with the unanswerable question: was it just bad luck? There is still some value in a strategy that would work every year except during a financial crisis.
如何将数据分为训练,验证和测试集,以避免结构变化引起的偏差?使用最近的时间段作为测试集并不总是更好,有时最好在数据集中使用几年的随机样本。您希望保留集(hold-out set)没有特别之处。如果测试集是量化崩溃或金融危机,那将是特殊的验证集。如果在这些时间段进行测试,那么您将面临一个无法回答的问题:这只是运气不好吗?除了在金融危机期间,每年都可以使用的策略还有一些价值。Alphas tend to decay over time, so one can argue that using the past 3 or 4 years as a hold out set is a tough test set. Lots of things work less and less over time because knowledge spreads and new data are disseminated. Broader dissemination of data causes alpha decay. A strategy that performed well when tested on a hold-out set of the past few years would be slightly more impressive than one tested on a less recent time period.
Alpha会随着时间的流逝而衰减,因此可以说使用过去3或4年作为保留时间集是一个艰难的测试集。随着知识的传播和新数据的传播,随着时间的流逝,许多事情越来越少。数据的广泛传播会导致alpha衰减。在过去几年的保留测试中,一项性能良好的策略比在最近一段时间进行测试的策略更具吸引力。Source/来源: AI for Trading, Udacity