Avellaneda Stoikov’s market-making strategy AS模型的通俗理解篇(一)

2023-10-15 12:30

本文主要是介绍Avellaneda Stoikov’s market-making strategy AS模型的通俗理解篇(一),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

AS是经典的做市模型,最主要就是为了控制库存风险。一般来说在震荡行情中,很适合做市,特别是波动率不高情况下,我们通过AS的经典论文得到2个最关键公式,下面来解读一下这个公式的含义,如何在hummingbot 策略中如何设置这些参数。
本文大部分思路来自英文版:
A comprehensive guide to Avellaneda & Stoikov’s market-making strategy
还有AS的技术细节:Avellaneda strategy: A technical deep dive

直接开整:
A brief explanation about the model proposal
In their introduction, Avellaneda & Stoikov talk about a market maker’s two main concerns:
Dealing with inventory risk
Finding the optimal bid and ask spreads.
After going through some mathematical modeling, they arrive at two formulas that help market makers solve these problems.
讲人话就是:AS策略最主要解决2个核心问题,
1、库存风险 (也就是单边的行情,你持有很多仓位,下场比较惨兮兮)
2、找到最优的买入价格、卖出价格。
通过一系列的数学推导和各种骚操作,最终得到如来真经。

Reservation price:(预定价格)
预定价格公式
Where,
s = current market mid price (中间价,也就是【最佳卖价+最佳买价】/2)
q = quantity of assets in inventory of base asset (也就是买入多少价值的股票数量)
σ = market volatility (市场波动率,可以用std标准差来表示)
T = closing time, when the measurement period ends (conveniently normalized to 1)
t = current time (T is normalized = 1, so t is a time fraction)
t是当前时间,T是结束时间,如果是操盘连续合约,那么T可以设置为无穷大。
这个是围绕中间价的spread
δa, δb = bid/ask spread, symmetrical → δa=δb 也就是一段时间内,这个midprice 上蹿下跳的幅度计算,其实做市也就是一种网格,或者说类似布林带,我们经过计算在底部放买单,在高点放一个卖单,如果上下都成交了,那么仓位不变,你把利差赚了。相当于高卖低卖(当然要考虑去掉手续费)。
γ = inventory risk aversion parameter 这个翻译过来就是 规避库存风险的参数,当他取值很大的时候,我们按照公式一计算的预定价格就和中间价差距就远。
κ = order book liquidity parameter 这个是一个评估订单本,订单密度参数。也就是K值越大,参与买卖的人比较多,出价也比较均衡,订单量也比较大。
如果K值很小就是一个 大一点的市价单,直接就可能打穿(吃掉 best ask 或者 best bid)和推动中间价移动。

What is the reservation price?
The basic strategy for market making is to create symmetrical bid and ask orders around the market mid-price. 一般策略就是围绕中间价进行报价,比如卖价 midprice +σ;买入价 midprice -σ

But this kind of approach, depending on the market situation, might lead to the market maker inventory skewing in one direction, putting the trader in a wrong position as the asset value moves against him.
这样的方法弊端就是,发生单边下跌行情,你可能就满仓持有资产,亏大了。如果单边上涨,你就无货可卖,俗称卖飞了。

For example, if the BTC-USDT market price enters a downtrend and the trader uses the symmetrical approach, his buy orders will be filled more often than the sell orders. At the end of the day, the market maker will be loaded with BTC, and his total inventory will have a smaller value.看看下面的btc震荡下跌图,如果你采用类似固定值网格操盘法,你就收到一堆btc存货,而且btc价格不断走低,你也亏了不少。
btc下跌图
AS通过3个fator来规避这种存货风险:

持仓量q,也就是买入股票数量
How distant is the trader’s current inventory position is from the target position? (q)
也就是查询当前持仓和目标仓位的差值。比如你有2万USDT,想来做btc的现货做市,你可以设定你最多持有0.5个比特币和1万usdt(币和现金各半,设定btc 价格2万美金一个)。而你现在只有2万usdt,所以这个差值q = 0-0.5 =-0.5 ,初始化的时候,策略要一直尽力去买入btc了。而当你有0.8个btc,那么AS策略,就要卖出btc,维持0.5btc这个目标;
When q<0, the trader is short on the asset, and the reservation price will be higher than market mid-price, increasing the chance of a buy order is filled; 也就是q小于目标值了,就要提高预定值,这样买单执行概率增大。

When q > 0, the trader is long on the asset, and the reservation price will be lower than market mid-price, increasing the chance of a sell order is filled;也就是q大于目标值了,就要降低预定值,这样卖单执行概率增大。

持仓风险γ
How much inventory risk does the trader wants to take? (γ)这一段比较简单,你设置γ越大,公式一后面部分成绩就大,然后和midprice偏离就大。如果设置很小就很靠近midprice.
This parameter is a value that must be defined by the market maker, considering how γ inventory risk he is willing to be exposed.

If γ value is close to zero, the reservation price will be very close to the market mid-price. Therefore, the trader will have the same risk as if he was using the symmetrical price strategy.设置为0,就是固定网格值的网格策略,虽然盈利概率99.5%,但最后一次就是让你送命。

Time until the trading session ends (T-t),也就是交易持续的时间

The agent’s objective is to maximize the expected exponential utility of his P&L profile at a terminal time T.
如果操盘加密货币,那么就是全年无休,怎么设置这个永续时间呢?下篇分解

You might have noticed that I haven’t added volatility(σ) on the main factor list, even though it is part of the formula. That is because volatility value depends on the market price movement, and it isn’t a factor defined by the market maker. If the market volatility increases, the distance between reservation price and market mid-price will also increase.

您可能已经注意到,我没有在主要因素列表中添加波动率(σ),尽管它是公式的一部分。这是因为波动值取决于市场价格的变动,而不是做市商定义的因素。如果市场波动性增加,则保留价格与市场中间价之间的距离也将增加。

这篇关于Avellaneda Stoikov’s market-making strategy AS模型的通俗理解篇(一)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/217724

相关文章

Spring Security基于数据库的ABAC属性权限模型实战开发教程

《SpringSecurity基于数据库的ABAC属性权限模型实战开发教程》:本文主要介绍SpringSecurity基于数据库的ABAC属性权限模型实战开发教程,本文给大家介绍的非常详细,对大... 目录1. 前言2. 权限决策依据RBACABAC综合对比3. 数据库表结构说明4. 实战开始5. MyBA

Java的IO模型、Netty原理解析

《Java的IO模型、Netty原理解析》Java的I/O是以流的方式进行数据输入输出的,Java的类库涉及很多领域的IO内容:标准的输入输出,文件的操作、网络上的数据传输流、字符串流、对象流等,这篇... 目录1.什么是IO2.同步与异步、阻塞与非阻塞3.三种IO模型BIO(blocking I/O)NI

基于Flask框架添加多个AI模型的API并进行交互

《基于Flask框架添加多个AI模型的API并进行交互》:本文主要介绍如何基于Flask框架开发AI模型API管理系统,允许用户添加、删除不同AI模型的API密钥,感兴趣的可以了解下... 目录1. 概述2. 后端代码说明2.1 依赖库导入2.2 应用初始化2.3 API 存储字典2.4 路由函数2.5 应

C#集成DeepSeek模型实现AI私有化的流程步骤(本地部署与API调用教程)

《C#集成DeepSeek模型实现AI私有化的流程步骤(本地部署与API调用教程)》本文主要介绍了C#集成DeepSeek模型实现AI私有化的方法,包括搭建基础环境,如安装Ollama和下载DeepS... 目录前言搭建基础环境1、安装 Ollama2、下载 DeepSeek R1 模型客户端 ChatBo

SpringBoot快速接入OpenAI大模型的方法(JDK8)

《SpringBoot快速接入OpenAI大模型的方法(JDK8)》本文介绍了如何使用AI4J快速接入OpenAI大模型,并展示了如何实现流式与非流式的输出,以及对函数调用的使用,AI4J支持JDK8... 目录使用AI4J快速接入OpenAI大模型介绍AI4J-github快速使用创建SpringBoot

0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeek R1模型的操作流程

《0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeekR1模型的操作流程》DeepSeekR1模型凭借其强大的自然语言处理能力,在未来具有广阔的应用前景,有望在多个领域发... 目录0基础租个硬件玩deepseek,蓝耘元生代智算云|本地部署DeepSeek R1模型,3步搞定一个应

Deepseek R1模型本地化部署+API接口调用详细教程(释放AI生产力)

《DeepseekR1模型本地化部署+API接口调用详细教程(释放AI生产力)》本文介绍了本地部署DeepSeekR1模型和通过API调用将其集成到VSCode中的过程,作者详细步骤展示了如何下载和... 目录前言一、deepseek R1模型与chatGPT o1系列模型对比二、本地部署步骤1.安装oll

Spring AI Alibaba接入大模型时的依赖问题小结

《SpringAIAlibaba接入大模型时的依赖问题小结》文章介绍了如何在pom.xml文件中配置SpringAIAlibaba依赖,并提供了一个示例pom.xml文件,同时,建议将Maven仓... 目录(一)pom.XML文件:(二)application.yml配置文件(一)pom.xml文件:首

如何在本地部署 DeepSeek Janus Pro 文生图大模型

《如何在本地部署DeepSeekJanusPro文生图大模型》DeepSeekJanusPro模型在本地成功部署,支持图片理解和文生图功能,通过Gradio界面进行交互,展示了其强大的多模态处... 目录什么是 Janus Pro1. 安装 conda2. 创建 python 虚拟环境3. 克隆 janus

本地私有化部署DeepSeek模型的详细教程

《本地私有化部署DeepSeek模型的详细教程》DeepSeek模型是一种强大的语言模型,本地私有化部署可以让用户在自己的环境中安全、高效地使用该模型,避免数据传输到外部带来的安全风险,同时也能根据自... 目录一、引言二、环境准备(一)硬件要求(二)软件要求(三)创建虚拟环境三、安装依赖库四、获取 Dee