#477easyMarket Microstructure
VPIN Toxic Flow Detection
Time Limit: 2sMemory: 256MB
Problem
VPIN (Volume-Synchronized Probability of Informed Trading) estimates the probability of toxic (informed) order flow. Given buy and sell volumes across multiple volume buckets, compute:
where and are the total buy and sell volumes across all buckets.
Input Format
A single line: buy_volumes sell_volumes where each is a comma-separated list of floats.
Output Format
A single value: VPIN, to 4 decimal places.
Examples
Example 1
Input
100,150,200,120,130 80,100,180,150,90
Output
0.0769
V_buy=100+150+200+120+130=700. V_sell=80+100+180+150+90=600. VPIN=|700-600|/(700+600)=100/1300=0.0769.
Example 2
Input
500,500,500 500,500,500
Output
0.0000
V_buy=1500, V_sell=1500. VPIN=0/3000=0.0000.
Constraints
- •1 ≤ number of buckets ≤ 1000
- •All volumes ≥ 0
- •V_buy + V_sell > 0
- •Output to 4 decimal places
Loading interactive editor…