• QQ空间
  • 回复
  • 收藏

【宽客学习】打开量化交易的黑盒子-投资步骤的鸟瞰图

郭炫 数据策略 2020-4-22 22:54 577019人围观

概念

交易结构:Alpha+风险+交易成本 -》投资组合-》执行模型。 前三个都只是指导交易,像是你在做交易决定前必须要询问的大师。通过结合这三方意见来得出你现在最佳的投资组合,然后再去市场上用执行模型进行交易最终达到目标组合。

* Alpha: 不属于标准衡量的投资**入,单单属于投资策略创造的**入。一般用Alpha作为一种手段来衡量投资人的区别于市场变化的独立的投资策略好坏。

  • 风险:Alpha的同父异母的兄弟。Alpha看到的是利润,而风险看到的是潜在损失。
  • 交易成本:达到目标组合的交易成本估计值(交易费用,滑点。订单对市场的影响)。滑点(跟价格波动率有关)和订单对市场的影响(流动性有关)你需要建模去估计。你可以对每只股票的滑点和市场影响程度分开建模。
  • 投资组合:
    • 规则类:根据alpha分配,根据alpha+risk+交易成本分配,决策树分配
    • 优化器类(mean variance optimization):输入是expected returns, expected volatility(GARCH), a correlation matrix(这个相关性矩阵如果是关于单个股票的话会非常大非常难算)。为了降维把单个股票变成因子(基于五大策略构造的投资组合的alpha+风险+交易成本)。

  • 执行模型:订单类型,交易基础结构(connectivity -FIX)。

Alpha - 五大策略理论:趋势,反转,价值,增长,质量。其中第一二种用到价格相关数据,其余的用到基本面数据。

  • 趋势:发现一个趋势,顺着趋势交易(过去涨,发现这是个趋势,我买)。趋势产生的原因是信息的传播需要时间,从旧的均衡到新的均衡之间这段较为缓慢的转移就是趋势机会。方法是1.一个大的价格波动会引起趋势 2.移动平均交叉 3.最近医药股好火啊,我要“跟风”来一波 4.昨天美股狂跌,因为时差原因中国还没开盘,这是一个国际趋势,今天A股绝对顺应大趋势跌跌跌。
  • 反转:发现价格偏离均衡太多了,逆着趋势交易(过去涨,发现会有个反转,我**)。反转产生的原因是人们会过度反应,然后随着时间流逝最终发现自己错了回归正常价格水平。一般来说长期趋势,短期反转。某段时间某个国家某个政策下可能反转效果好,另种情况下可能趋势效果好。方法:1.统计套利。
  • 价值:对,就是巴菲特的价值投资,也是可以量化的。大部分用在股票上。简单说就是买便宜货。要点就是找到便宜货,假设是市场定价错误,你有在长期来说更准确的定价方法并且相信市场会回归正确的定价。有点像每天去逛服装店的人发现一件100元的衣服降价到10元由于大酬宾,买了,过了两天后大酬宾结束然后重新去看发现又是100元。方法如PE ratio,EBITDA,EV。外汇市场比较特别的是carry策略:假设美国0利率,中国3%利率,那我买****美元。赚利率(carry)。假设汇率不变的话。同样的放到股票市场可以用quant long/short(QLS):首先给股票按照他们的真实价/市场价格排序。买前面的**后面的。
  • 增长:股票的价格取决于公司的增长速度。比如说之前哪些妖怪股票(只要在风口猪都可以飞起来)-共享单车,没有股息,投资者争得你死我活,他们看到的是未来增长速度(销**额的增长,用户的增长)。当然也不排除是在找“下一个傻逼,我只要不是最后一个傻逼就行了“原理。一般来说大公司看价值,小公司看增长。关于增长一个最近很流行的指标就是社会感受(从微信朋友圈,微博热搜等)。比如说最近的青春有你.选手(小公司)的成功不在于她现在怎么样,而是社会评论火不火,有没有未来增长,可塑性。注意这里的社会评价(sentiment)是相对于基本面的(fundament)。增长型策略里社会评价很重要,价值策略里基本面很重要。比如说比特币,有多少人是因为基本面去买它的呢?宏观(国家层面)增长策略方法:GDP,利率,失业率。微观(公司)增长策略方法:销**额,花钱多少,用户增长。
  • 质量:买质量高的,**质量低的。比如说你现在有两个选择苹果手机和山寨机。不考虑价格,你肯定买苹果咯。为什么,因为质量高。一般来说熊市用质量,牛市用增长,跨越牛熊用价值。方法:debt-to-equity进行QLS。
  • 六大模型注意点: * 预测目标(方向,价格点,置信度,机会停留时间 - 现在是9:55,苹果现价100,在10:00到10:01(置信度65%)这段时间内苹果会达到110(正负5的置信区间))。

  • 预测时间频率(1微秒,一天,一年)。
  • 标的选择(地理,资产,是否衍生物)。
  • 模型参数(对每一个策略的每一个概念进行数学定义-可以计算执行。比如说有很多方法去定义一个趋势,什么叫做趋势?1.20minMA超过了40minMA的那一时刻一个趋势即产生了。但它们下一次相交时趋势结束。这两个点之间的时间定义成趋势时间)
  • 交易频率(一般情况下跟预测时间频率一致)。
  • 策略混合(可以把之前讲的所有策略混合):信奉这些投资理论有时候就像是信仰一样。我见过有些人信仰价值投资(巴菲特)就像是伊斯兰教教徒。只有真主阿拉说的是真理,你们都是错的。身为中国人,我是多信仰或者说无信仰,反正对我有用的我都信,我都学。见人说人话见鬼说鬼话。

风险(factor related):风险就是那些你在设计模型初压根没有想到的因子。假设我们用消费者粘度QLS排名了一系列公司,第一名是苹果,最后一名是南山乳业。所以我们的策略就是买苹果**牛奶。我们的风险是什么?风险是你没考虑的因素。苹果属于高科技产业,而南山属于消费品产业(产业不同)。苹果是美国的,南山是中国的(地理不同)。有可能未来经济危机或者世界大战无人再去投资高科技,未来中国崛起干掉美国。于是你亏了很多。注意每一则统计结论都是开始于这段话:假设其他因子保持不变的情况下。风险就是其他因子变化的情况下。很显然,你的结论就是不可靠的。

那怎么办?如果你够强你可以发现风险因子(产业,地理)并且预测他们未来的走势,你就可以直接把潜在风险变成Alpha了(risk & alpha本来就是一个**的两面)! 但是更多时候你根本不知道为什么你之前一直盈利的策略突然就不赚钱了(不知道风险是什么),并且即使你知道了你也无法准确预测。咋办?

对冲咯(hedge)。ok,我知道苹果属于高科技产业并且是在美国,那我买苹果,我就**华为。**华为这个举动即对冲了你的产业风险,也对冲了你的地理风险。换句话说在消费者粘度,产业,地理这个三维世界里你通过对冲掉产业,地理降维到了只有消费粘度的一维线性世界,只有这时候你才可以安全的进行线性排序(QLS)重新回到你的“every other thing stays equal”假设。

如何去识别风险呢? PCA - 我知道苹果的波动80%来自于美国股市的整体波动。注意风险识别也是一个时间序列-不同时间段里面的风险来自于不同因子。比如说最近石油价格成为了投资者的关注重点。于是苹果的波动在最近可能40%来自于石油波动。 P.s这里说的风险属于因子类型,另外一种风险是价格波动风险(价格标准差,maxDrawDown等)。我会倾向于把前者说成后者的原因。

如何衡量一个策略的好坏 1. 利润:累计利润时间图 2. 稳定程度:MaxDrawDown 3. 预测:R^2 (0.05 就算牛逼了) 4. 时间延迟:如果获得信息输入时间延迟会对结果产生什么影响?

如何做实时监视: 1. 我们赚钱了么? 2. 我们是怎么赚钱的? * 实现了的利润 * 未实现的利润:有些策略会很快的终止损失单,很慢的终止盈利单。如果你看到你又一个损失单持续了5个消失,你要思考为什么。 3. 单子执行了么?

方法

The trading system has three modules—an alpha model, a risk model, and a transaction cost model—which feed into a portfolio construction model, which in turn interacts with the execution model.

Given data, quants can perform research, which usually involves some form of testing or simulation. Through research, the quant can ascertain whether and how a quant strategy works.

They come up with ideas, test strategies, and decide which ones to use, what kinds of instruments to trade, at what speed, and so on. Humans also tend to control a “panic button,” which allows them to reduce risk if they determine that markets are behaving in some way that is outside the scope of their models’ capabilities.

记录

巴菲特在长时间内打败了市场。但是在上世纪九十年代后期的互联网泡沫里他的策略表现的并不好。

Long Term Capital Management(LTCM)在1998年八月到十月期间损失了所有资本(在这之前的四年前期间平均**益30%)。

The TABB Group, a research and advisory firm focused exclusively on the capital markets, estimates that, in 2008, approximately 58 percent of all buy-side orders were algorithmically traded. TABB also estimates that this figure has grown some 37 percent per year, compounded, since 2005.

The Barclay Group, proprietor of the most comprehensive commercially available database of CTAs and CTA performance, estimates that well over 85 percent of the assets under manage- ment among all CTAs are managed by quantitative trading firms.

鸡血

why being a quant The first reason it is useful to study quants is that they are forced to think deeply about many aspects of their strategy that are taken for granted by nonquant investors.You have to specify what find means, what cheap means, and what stocks are. For example, finding might involve searching a database with information about stocks and then ranking the stocks within a market sector (based on some classification of stocks into sectors). Cheap might mean P/E ratios, though one must specify both the metric of cheapness and what level will be considered cheap. As such, the quant can build his system so that cheapness is indicated by a 10 P/E or by those P/Es that rank in the bottom decile of those in their sector. And stocks, the universe of the model, might be all U.S. stocks, all global stocks, all large cap stocks in Europe, or whatever other group the quant wants to trade.All this defining leads to a lot of deep thought about exactly what one’s strategy is, how to implement it, and so on.

I have been in countless meetings with discretionary traders who, when I asked them how they decided on the sizes of their positions, responded with variations on the theme of, “Whatever seemed reasonable.” This is by no means a damnation of discretionary investment styles. I merely point out that precision and deep thought about many details, in addition to the bigger-picture aspects of a strategy, can be a good thing, and this lesson can be learned from quants.

Perhaps the most obvious lesson we can learn from quants comes from the discipline inherent to their approach. Upon designing and rigorously testing a strategy that makes economic sense and seems to “work,” a properly run quant shop simply tends to let the models run without unnecessary, arbitrary interference. In many areas of life, from sports to science, the human ability to extrapolate, infer, assume, create, and learn from the past is beneficial in the planning stages of an activity. But execution of the resulting plan is also critical, and it is here that humans frequently are found to be lacking. A significant driver of failure is a lack of discipline.Many successful traders subscribe to the old trading adage, “Cut losers and ride winners.” However, discretionary investors often find it very dif- ficult to realize losses, whereas they are quick to realize gains.


免责申明:本文内容(包括但不限于文字,图片等内容)来自网络或者宽客之家社区用户发布,仅代表作者本人观点,与本网站无关。本网站不对所包含内容的准确性、可靠性或完整性**任何明示或暗示的保证,并读者理性阅读,并自行承担全部责任!如内容不慎侵犯了您的权益,请联系告知,核实情况后我们将尽快更正或删除处理!

路过

雷人

握手

鲜花

鸡蛋
原作者: Zigge 银子 来自: 知乎
关注微信