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算法交易
122
|
第
4
章
定义一个列表对象,以选择以后要绘制的列。
根据动量策略参数得出市场头寸。
计算出结果最终策略的对数收益。
将列名称追加到列表对象。
绘制所有相关列,来将策略的绩效与基准工具的绩效进行比较。
图 4-10:苹果股票的盘中总表现和五种动量策略(最后 1,3,5,7 个和 9 个回报)
图
4-11
展示了标准普尔
500
指数相同五种策略的表现。同样,所有五种策略配置均
优于指数,并且都显示出正收益(不包括交易费用)。
4.3.2
方法通用化
“动量回测类”介绍了一个包含
MomVectorBacktester
类的
Python
模块,该模块允
许对基于动量的策略进行一些更标准化的回测。该类具有以下属性:
•
symbol
:要使用的
RIC
(路透金融工具编码)。
•
start
:所选数据的开始日期。
掌握向量化回测
|
123
图 4-11:标普 500 指数的日内总表现和五种动量策略(最后 1,3,5,7 和 9 个回报)
•
end
:所选数据的结束日期。
•
amount
:初始投资的金额。
•
tc
:用于每笔交易的比例交易成本。
与
SMAVectorBacktester
类相比,该类引入了两个重要的概括:在回测阶段开始时
要投资的固定金额和成比例的交易成本,使其在成本上更接近于真实的市场。特别
是在时间序列动量策略的背景下,交易成本的增加非常重要 ...
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