Implement Flow Matching Policy for Market-Making
HardFlow MatchingFlow MatchingMarket-MakingGenerative ModelsPyTorch
Problem Statement
## Problem: Flow Matching Policy for Market-Making
Implement a flow matching policy network for market-making inspired by FlowHFT. Your task is to:
1. **Create a MeanFlow architecture** that models the continuous normalizing flow
2. **Implement the training loop** using flow matching loss
3. **Generate market-making actions** from the learned policy
4. **Handle orderbook state** as input to the model
### Requirements:
- Use PyTorch for implementation
- Implement the flow matching objective function
- Create a simple orderbook state encoder
- Generate action distributions for bid/ask prices and quantities
### Starter Code:
The starter code provides a basic structure. Complete the implementation by filling in the missing parts.
Implement a flow matching policy network for market-making inspired by FlowHFT. Your task is to:
1. **Create a MeanFlow architecture** that models the continuous normalizing flow
2. **Implement the training loop** using flow matching loss
3. **Generate market-making actions** from the learned policy
4. **Handle orderbook state** as input to the model
### Requirements:
- Use PyTorch for implementation
- Implement the flow matching objective function
- Create a simple orderbook state encoder
- Generate action distributions for bid/ask prices and quantities
### Starter Code:
The starter code provides a basic structure. Complete the implementation by filling in the missing parts.
Test Cases
Test Case 1
Test with sample orderbook state
Code Editor
Output
Output will appear here...

