Mais conteúdo relacionado Semelhante a 2019/10/31 PRIMA2019: Comparison of Behaviors of Actual and Simulated HFT Traders for Agent Design (20) Mais de Masanori HIRANO (9) 2019/10/31 PRIMA2019: Comparison of Behaviors of Actual and Simulated HFT Traders for Agent Design1. Comparison of Behaviors of
Actual and Simulated HFT Traders
for Agent Design
Masanori HIRANO, Kiyoshi IZUMI,
Hiroyasu MATSUSHIMA, Hiroki SAKAJI
Izumi Lab.
School of Engineering, The University of Tokyo
hirano@g.ecc.u-tokyo.ac.jp
https://mhirano.jp/
2. Increasing Uncertainty in Financial Market
• The 2007-2008 financial crisis
• Flash crashes
• happened in stock market, currency, etc.…
• The causes: Auto trading, Auto news analysis…
• DJIA on May 6, 2010 <-- One big sell order
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
2
3. Artificial Financial Market
• Simulations on computer using virtual markets
• We can test hypothetical situations!
• Promising approach for financial market analysis
• But…
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
3
4. Artificial Financial Market
• Simulations on computer using virtual markets
• We can test hypothetical situations!
• Promising approach for financial market analysis
• But…
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
4
Are the simulations trustable?
5. Our work
• Comparing
Real data Outcomes from simulations
• Only focus on HFT-MM Specific trader & strategy
• Target: Tokyo Stock Exchange
• Collaborative Research w/
Japan Exchange Group (JPX)
• We analyzed a special data
provided by JPX
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
5
Tokyo Stock Exchange
6. What’s the HFT-MM?
• High-Frequency-Trader Market-Making strategy
• Market-making strategy:
• (Basically) order near the best price
• Get profit by the spread (1001-999=2)
• Do repeatedly
• Risk-hedge by high-frequency-trade:
• Always have price move risk (Price move >> spread)
• Do action faster & hedge risk by setting off their inventory
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
6
Sell
Buy
9. Simulation outline
• We used “PlhamJ” as a simulation platform.
PlhamJ: Platform for Large-scale and High-frequency Artificial Market (Java version)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
9
Market (Only one)
Continuous Double Auction
HFT-MM Traders
・・・
Stylized Traders
・・・
Order
Information
Order
Information
100 Stpes Delay
Only Every 100 Steps
10. Stylized Trader Agents [Chiarella et al. 02]
• Logarithmic return prediction for bid/ask price
𝑟 =
1
𝑤 𝐹+𝑤 𝐶+𝑤 𝑁
𝑤 𝐹 ⋅ 𝐹 + 𝑤 𝐶 ⋅ 𝐶 + 𝑤 𝑁 ⋅ 𝑁
• Fundamentals
𝐹 =
1
mean reversion time
ln
current market price
current fundamental price
• Chartist (trend)
𝐶 = logarithm averaged return in the past
• Noise 𝑁 ~ 𝑁 0, 𝜎 𝑁
• + margin => decide price
• Every 100 step they make a buy or sell order
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
10
11. HFT-MM Trader Agents [Avellaneda et al. 02]
• Trader’s price interval:
𝛾 𝑖
𝜎 𝑖
2
+
2
𝛾 𝑖
ln 1 +
𝛾 𝑖
𝑘
• Trader’s mid-price
𝑝𝑡
∗
− 𝛾 𝑖
𝜎 𝑖
2
𝑞𝑡
𝑖
• Note:
𝛾 𝑖: risk-hedge level
𝜎 𝑖: SD in price
𝑘: a parameter for order arrival
𝑝𝑡
∗
: fundamental price
𝑞𝑡
𝑖
:inventory
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
11
Price
Sell
Buy
Fundamental Price
Trader’s mid-price
Trader’s price interval
12. Simulation settings
• 1,000 stylized agents vs. 10 HFT-MM trader agents
• 100 steps before market opening
+ 500 dummy steps for stabilization
+ 10,000 steps for test
• Fundamental price:
• Start at 400
• Geometric Brownian motion with SD of 0.0001
• Run 21 times
(The same as the business day in real data in Aug. 2015)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
12
13. Ordering Price Distribution (Simulation)
• HFT-MM ordering price distribution
= How many ticks far from the best price
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
13
− 5 0 5 10 15
0.0e+0
5.0e+3
1.0e+4
1.5e+4
2.0e+4
Order
Executed Order
Ticks
Freq.
15. Data
• “Order-book reproduction data”
provided by Japan Exchange Group (JPX)
• Containing masked trader information
<- Called “Virtual Server (VS)”
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
16
Time Ticker Kind Buy/sell VS Price
11:11:50.702813 A Limit Order sell VS1 2570
11:11:50.703600 B Executed buy VS4 Market Order
11:11:50.704001 A Cancel sell VS1 2570
Sample
Some columns are not shown such as volume
16. Data: VS merging
• Virtual Server: Gateway to the order system
for brokers
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
17
Limit: 60,20,10 orders/s
(depends on contract)
17. Data: VS merging
• Merging VS as many as possible
• Focus on each continuous actions
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
18
Order01 Limit Order
18. Data: VS merging
• Merging VS as many as possible
• Focus on each continuous actions
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
19
Order01 Cancel
19. Data: VS merging
• Merging VS as many as possible
• Focus on each continuous actions
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
20
Used by the
same trader!
20. Indices for clustering (extracting HFT-MM)
• The logarithm of action per ticker
ActionsPerTicker =
newOrders + changeOrders + (cancelOrders)
(numTicker)
ActionsPerTickerLOG = ln ActionsPerTicker
• Inventory Ratio
InventoryRatioABS
= 𝑀𝑒𝑑𝑖𝑎𝑛ticker
soldVolume ticker − boughtVolume ticker
soldVolume ticker + boughtVolume ticker
• Cancel ratio
CanceledVolumeRatio =
(cancelVolume)
(newVolume)
• The logarithm of ticker per VS
TickerPerVSLOG = ln
(numTicker)
(numVS)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
21
Many order
Low inventory
Many VS usage
High cancel ratio
21. Indices for clustering (extracting HFT-MM)
• The logarithm of action per ticker
ActionsPerTicker =
newOrders + changeOrders + (cancelOrders)
(numTicker)
ActionsPerTickerLOG = ln ActionsPerTicker
• Inventory Ratio
InventoryRatioABS
= 𝑀𝑒𝑑𝑖𝑎𝑛ticker
soldVolume ticker − boughtVolume ticker
soldVolume ticker + boughtVolume ticker
• Cancel ratio
CanceledVolumeRatio =
(cancelVolume)
(newVolume)
• The logarithm of ticker per VS
TickerPerVSLOG = ln
(numTicker)
(numVS)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
22
22. Data outline
• Aug. 2015: All 21 business days
• Before VS merging: 4616 VSs
• After VS merging: 2664 VSs
• Only HFT: 253 VSs <= based on ActionsPerTicker ≥ 100
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
23
2455 2455
2161
209
253
23. Hierarchical Clustering [Uno et al. 18]
• Normalizations for each indices & clustering
• Euclidean distance
• Ward’s method
• 10 clusters
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
24
HFT-MM cluster based on indices
24. Ordering Price Distribution
• HFT-MM ordering price distribution
= How many ticks far from the last transaction price
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
25
− 5 0 5 10 15
0.0e+0
5.0e+8
1.0e+9
1.5e+9
2.0e+9
2.5e+9
Order
Executed Order
Ticks
Freq.
26. Ordering Price Distribution
− 5 0 5 10 15
0.00
0.20
0.40
0.60
0.80
1.00 Order (Actual)
Order (Simulation)
Ticks
Relative Freq. (vs tick 0)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
27
27. Statistical test: Entropy
• T-test for
• Entropy for −5~15 tick
• Entropy for −2~5 tick
• This suggests:
• −2~5 tick: simulation & real data has small difference
• −5~2, 5~15 tick: simulation & real data has significant diff.
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
28
𝐸 = −𝑝 𝑥 log2 𝑝 𝑥
28. Ordering Price Distribution
− 5 0 5 10 15
0.00
0.20
0.40
0.60
0.80
1.00 Order (Actual)
Order (Simulation)
Ticks
Relative Freq. (vs tick 0)
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
29
Long tail:
know as “layering”
29. Discussion & Conclusion
• Near the best price, simulation and data are similar
• => our clustering method work
• => our simulation also work
• But, our simulation lost some features in real data
• Ex. Long tail
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
30
Future work
• Build more realistic simulation
• Also use data-driven approach for simulation
• Build simulation (trader) model automatically
• There are limitation for human to build perfect model
• Human-made model can drop some features
30. Thank you for your attention!
• The paper for social track will be published JASSS.
• You can access our preprint on ResearchGate
https://s.mhirano.jp/prima2019-preprint
• Or contact me: hirano@g.ecc.u-tokyo.ac.jp
https://mhirano.jp/
10/31/19
PRIMA 2019
©︎M.HIRANO & Izumi Lab.
31