FixedSizeRiskModel#

API documentation for tradeexecutor.strategy.fixed_size_risk.FixedSizeRiskModel Python class in Trading Strategy framework.

class FixedSizeRiskModel[source]#

Bases: SizeRiskModel

A trade sizer that assumes unlimited market depth.

  • Always get the trade you ask for, unless a trade or a position hits the maximum value

__init__(pricing_model, per_trade_cap=9999999, per_position_cap=9999999)[source]#
Parameters:
  • per_trade_cap (float) – Maximum US dollar value of a single trade, or unlimited.

  • pricing_model (PricingModel) –

  • per_position_cap (float) –

Methods

__init__(pricing_model[, per_trade_cap, ...])

param per_trade_cap:

get_acceptable_size_for_buy(timestamp, pair, ...)

get_acceptable_size_for_position(timestamp, ...)

What this the maximum position amount.

get_acceptable_size_for_sell(timestamp, ...)

__init__(pricing_model, per_trade_cap=9999999, per_position_cap=9999999)[source]#
Parameters:
  • per_trade_cap (float) – Maximum US dollar value of a single trade, or unlimited.

  • pricing_model (PricingModel) –

  • per_position_cap (float) –

get_acceptable_size_for_position(timestamp, pair, asked_value)[source]#

What this the maximum position amount.

  • Avoid exceed maximum position size

  • If the position size is exceeded start to reduce the position

Parameters:
  • timestamp (datetime.datetime | None) –

    Historical timestamp.

    Can be set to None for onchain reading backends, and they will use the latest block number.

  • asked_value (float) – How large position we’d like to have in the US Dollar terms.

  • pair (TradingPairIdentifier) –

Returns:

Size-risk adjusted estimation how large the position could be.

Return type:

SizeRisk