关于「对数市场评分规则:Softmax、KL 散度与补贴上限」,《预测市场的价格与套利》给出的定量结论是什么?
结论:第二章核对 Hanson 对数市场评分规则的凸对偶:价格是 Softmax,交易者的期望收益恰为流动性参数乘以 KL 散度(布雷格曼投影),做市商最坏亏损恰为参数乘以结果数的对数,两个结果时 69.31;补贴与价格冲击之积趋于常数 34.66。
数据口径:本书把这个读法拆成三件事——信念如何聚合成价格、做市机制如何为信息付钱、资本被锁住时价格还能偏离多远——逐一写成可运行的模型,并计算看上去的套利还剩多少能执行。 本书不是投资、交易或博彩建议;全部数据为程序生成的合成数据。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 69.31
b = 100, q = [30.0, -10.0, -50.0] -> prices [0.4718, 0.3162, 0.212] 1. |C(q) - p.q - b H(p)| < 1e-9: True 2. buy [58.63, 11.08, 0.0] shares -> prices [0.6, 0.25, 0.15]; pay 34.587 outcome 0: net +24.042 b ln(p'_i/p_i) +24.042 outcome 1: net -23.504 b ln(p'_i/p_i) -23.504 outcome 2: net -34.587 b ln(p'_i/p_i) -34.587 3. expected profit under p' 3.3614; b KL(p'||p) 3.3614; b Bregman 3.3614 4. worst case: start uniform, outcome 0 wins, price of 0 -> 1 n = 2: loss at q_0 = 3000 is 69.31; b ln n = 69.31 n = 4: loss at q_0 = 3000 is 138.63; b ln n = 138.63 n = 10: loss at q_0 = 3000 is 230.26; b ln n = 230.26 n = 50: loss at q_0 = 3000 is 391.20; b ln n = 391.20 Reading: the LMSR is the entropy-regularised market: its prices are a softmax, a trader's expected gain is a KL (Bregman) divergence, and the subsidy for that information is capped at b ln n, reached only when the market becomes certain.
核心公式
\[C(\mathbf{q}) = b \ln \sum_i e^{q_i/b}, \qquad p_i = \frac{e^{q_i/b}}{\sum_j e^{q_j/b}} .\]
查看完整验算程序
# Chapter 2. p04: Hanson's logarithmic market scoring rule (LMSR) and its
# convex dual. Outstanding shares q (one per outcome) cost
# C(q) = b ln sum_i exp(q_i / b), prices p = softmax(q / b).
# Four facts are checked numerically:
# 1. duality C(q) = p.q + b H(p), H = entropy (so C is the convex
# conjugate of -b H on the simplex)
# 2. payoff moving prices from p to p' and then seeing outcome i
# earns exactly b ln(p'_i / p_i)
# 3. Bregman a trader who believes p' and moves the price to p'
# expects b KL(p' || p); KL is the Bregman divergence of
# negative entropy
# 4. bound the market maker's worst-case loss is b ln n
import math
def cost(q, b):
m = max(q)
return m + b * math.log(math.fsum(math.exp((x - m) / b) for x in q))
def prices(q, b):
m = max(q)
e = [math.exp((x - m) / b) for x in q]
s = math.fsum(e)
return [x / s for x in e]
def entropy(p):
return -math.fsum(x * math.log(x) for x in p if x > 0)
def kl(a, c):
return math.fsum(x * math.log(x / y) for x, y in zip(a, c) if x > 0)
def bregman_negent(a, c):
f = lambda v: math.fsum(x * math.log(x) for x in v if x > 0)
grad = [math.log(y) + 1 for y in c]
return f(a) - f(c) - math.fsum(g * (x - y)
for g, x, y in zip(grad, a, c))
if __name__ == "__main__":
b = 100.0
q = [30.0, -10.0, -50.0]
p = prices(q, b)
print("b = 100, q = {} -> prices {}".format(
q, [round(x, 4) for x in p]))
gap = cost(q, b) - math.fsum(x * y for x, y in zip(p, q)) - b * entropy(p)
print("1. |C(q) - p.q - b H(p)| < 1e-9: {}".format(abs(gap) < 1e-9))
target = [0.60, 0.25, 0.15]
dq = [b * (math.log(t) - math.log(x)) for t, x in zip(target, p)]
dq = [d - min(dq) for d in dq] # buy only; same prices
q2 = [x + d for x, d in zip(q, dq)]
paid = cost(q2, b) - cost(q, b)
print("2. buy {} shares -> prices {}; pay {:.3f}".format(
[round(d, 2) for d in dq], target, paid))
for i in range(3):
print(" outcome {}: net {:+8.3f} b ln(p'_i/p_i) {:+8.3f}".format(
i, dq[i] - paid, b * math.log(target[i] / p[i])))
exp_profit = math.fsum(t * (d - paid) for t, d in zip(target, dq))
print("3. expected profit under p' {:.4f}; b KL(p'||p) {:.4f};"
" b Bregman {:.4f}".format(exp_profit, b * kl(target, p),
b * bregman_negent(target, p)))
print("4. worst case: start uniform, outcome 0 wins, price of 0 -> 1")
for n in (2, 4, 10, 50):
q0 = [0.0] * n
qn = [3000.0] + [0.0] * (n - 1)
loss = 3000.0 - (cost(qn, b) - cost(q0, b))
print(" n = {:2d}: loss at q_0 = 3000 is {:7.2f};"
" b ln n = {:7.2f}".format(n, loss, b * math.log(n)))
print("\nReading: the LMSR is the entropy-regularised market: its prices")
print("are a softmax, a trader's expected gain is a KL (Bregman)")
print("divergence, and the subsidy for that information is capped at")
print("b ln n, reached only when the market becomes certain.")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《预测市场微观结构、布雷格曼信息投影与跨盘口无套利边界》第 2 章「对数市场评分规则:Softmax、KL 散度与补贴上限」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090166
DOI: 10.5281/zenodo.24090166 · 阅读本章所在专著 · 5DL-B-059 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026059,
author = {Fan, Yafu},
title = {Prediction Market Microstructure, Bregman Information Projection and Cross-Book Arbitrage Bounds},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090166},
url = {https://doi.org/10.5281/zenodo.24090166}
}