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算法交易
197
第 6 章
构建基于事件回测的类
人生的悲剧和一个人先入为主的观念无关。最终,人们总是被它们的简单性,
设计的宏伟以及它们固有的奇异元素所迷惑。
——Jean Cocteau
一方面,使用
Numpy
和
pandas
进行向量化回测实现通常很方便和有效,因为它们代
码简洁,并且这些包都对这类操作做了优化,因此执行效率也很高。但是,向量回
测不能应对交易策略的所有类型,也不能应对现实交易为算法交易者提供的所有现
象。对于向量化回测,这种方法的潜在缺陷是:
前瞻性偏见
向量化回测是基于现有的完整数据集,没有考虑新增数据。
简单化
例如,固定交易成本不能使用向量建模,它主要基于相对收益。同时,每笔交
易的固定金额和单一金融工具的不可分割性也不能被很好地建模。
非递归性
体现交易策略的算法可能会随着时间递归到状态变量,例如直到某个时间点的
损益或类似的路径相关统计信息。向量化没有这些功能。
但是,基于事件的回测使人们可以通过更现实的方法对现实中的交易进行建模来解
决这些问题。从根本上说,一个事件就是新数据到来的特征化。以根据日末数据回
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