tensortrade.slippage.random_slippage_model module

class tensortrade.slippage.random_slippage_model.RandomUniformSlippageModel(max_price_slippage_percent=3.0, max_amount_slippage_percent=0.0)[source]

Bases: tensortrade.slippage.slippage_model.SlippageModel

A uniform random slippage model.

__init__(max_price_slippage_percent=3.0, max_amount_slippage_percent=0.0)[source]
Parameters
  • max_price_slippage_percent (float) – The maximum random slippage to be applied to the fill price. Defaults to 3.0 (i.e. 3%).

  • max_amount_slippage_percent (float) – The maximum random slippage to be applied to the fill amount. Defaults to 0.

fill_order(trade, current_price)[source]

Simulate slippage on a trade ordered on a specific exchange.

Parameters
  • trade (Trade) – The trade executed on the exchange.

  • **kwargs – Any other arguments necessary for the model.

Return type

Trade

Returns

A filled Trade with the price and amount adjusted for slippage.