Skip to Content
Python算法交易
book

Python算法交易

by Yves Hilpisch
November 2022
Intermediate to advanced
392 pages
10h 8m
Chinese
China Electric Power Press Ltd.
Content preview from Python算法交易
通过机器学习预测市场动向
|
157
当涉及整体策略性能时,基于预测的策略的命中率只是问题的一方面。
另一方面是该策略如何正确地把握市场时机。即使命中率低于
50%
,正
确预测某个时间段内最佳和最差日子的策略也可能跑赢市场。另一方面,
如果命中率远高于
50%
的策略对于罕见的大幅波动把握出错,那它的表
现可能仍然不如基本工具。
5.1.7
概括方法
“线性回归回测类”展示了一个
Python
模块,其中包含一个类,该类按照第
4
章的
精神对基于回归的交易策略进行向量化回测。
它允许线性回归模型的样本内拟合和
样本外评估。这意味着回归模型是根据数据集的一部分(例如
2010
年至
2015
年)
进行拟合的,而基于数据集的另一部分(例如
2016
年和
2019
年)进行评估的。
由于涉及优化或拟合步骤,因此可以从实践中更真实地了解市场表现,因为它有助
于避免由于数据窥探和模型过度拟合而引起的问题(另请参见“数据窥探和过度拟
合”)。
图
5-7
展示了对于特定的配置并且在样本外和考虑交易成本之前,基于五次滞后的
回归策略的性能确实优于的
EUR/USD
基础工具,:
In [52]: import LRVectorBacktester as LR
In [53]: lrbt = LR.LRVectorBacktester('EUR=', '2010-1-1', '2019-12-31',
10000, 0.0)
In [54]: lrbt.run_strategy('2010-1-1', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
图解大模型 : 生成式AI 原理与实战

图解大模型 : 生成式AI 原理与实战

Jay Alammar, Maarten Grootendorst

Publisher Resources

ISBN: 9787519869694