MarketMakingEnvironment<T>
Models & Types ยท AiDotNet.Finance.Trading.Environments
Market making environment that simulates bid/ask quoting and inventory risk.
Inheritance: TradingEnvironment<T> โ MarketMakingEnvironment<T>
For Beginners
A market maker tries to profit from the bid/ask spread while keeping inventory small. This environment teaches an agent to balance profit and risk.
How It Works
MarketMakingEnvironment models a single asset where the agent sets bid/ask offsets. Orders arrive stochastically based on the spread, and the agent earns the spread but accumulates inventory risk.
Example
var NumOps = MathHelper.GetNumericOperations<double>();
// Create a market making environment for bid/ask spread optimization
var marketData = new Tensor<double>(new[] { 1000, 1 }); // 1000 timesteps, 1 asset
var env = new MarketMakingEnvironment<double>(
marketData, windowSize: 20, initialCapital: NumOps.FromDouble(100000.0),
tradeSize: NumOps.FromDouble(10.0), baseSpread: 0.01, orderArrivalRate: 0.5);
Constructors
| Constructor | Summary |
|---|---|
MarketMakingEnvironment(Tensor<T> marketData, int windowSize, T initialCapital, T tradeSize, double baseSpread, double orderArrivalRate, int maxInventory, double inventoryPenalty, double transactionCost, bool allowShortSelling, bool randomStart, int maxEpisodeLength, int? seed) |
Creates a market making environment for a single asset. |
Properties
| Property | Summary |
|---|---|
bool IsContinuousActionSpace { get; } |
|
int ActionSpaceSize { get; } |