YieldRuleset#

API documentation for tradeexecutor.strategy.pandas_trader.yield_manager.YieldRuleset Python class in Trading Strategy framework.

class YieldRuleset[source]#

Bases: object

Define how the strategy can allocate idle cash for the yield management.

  • Risk management, etc.

  • Management of withdrawal delays

Example:

def create_yield_rules(
    parameters: StrategyParameters,
    strategy_universe: TradingStrategyUniverse,
) -> YieldRuleset:
    # Create yield rules for the strategy.

    aave_usdc = strategy_universe.get_credit_supply_pair()
    ipor_usdc = strategy_universe.get_pair_by_smart_contract(VAULTS[0][1])
    maxapy_usdc = strategy_universe.get_pair_by_smart_contract(VAULTS[1][1])

    # Check we have yield vault metadata loaded
    assert aave_usdc
    assert ipor_usdc
    assert maxapy_usdc

    return YieldRuleset(
        position_allocation=parameters.allocation,
        buffer_pct=parameters.directional_trade_yield_buffer_pct,
        cash_change_tolerance_usd=parameters.yield_flow_dust_threshold,
        weights=[
            YieldWeightingRule(pair=maxapy_usdc, max_concentration=0.75),
            YieldWeightingRule(pair=ipor_usdc, max_concentration=0.75),
            YieldWeightingRule(pair=aave_usdc, max_concentration=1.0),
        ]
__init__(position_allocation, buffer_pct, cash_change_tolerance_usd, weights)#
Parameters:
Return type:

None

Methods

__init__(position_allocation, buffer_pct, ...)

validate()

Check all looks good.

Attributes

position_allocation

How much total equity is allowed to directional + yield position.

buffer_pct

cash_change_tolerance_usd

How much yield position allocation must change before we start to generate new trades.

weights

Max weights of each yield position

position_allocation: float#

How much total equity is allowed to directional + yield position.

cash_change_tolerance_usd: float#

How much yield position allocation must change before we start to generate new trades.

weights: list[tradeexecutor.strategy.pandas_trader.yield_manager.YieldWeightingRule]#

Max weights of each yield position

validate()[source]#

Check all looks good.

__init__(position_allocation, buffer_pct, cash_change_tolerance_usd, weights)#
Parameters:
Return type:

None