Simulation

Check the performance of your Alpha Model

Note: Ensure your simulation dates align with the position data. Future updates will improve this process.

Load or Create Your Position

from finter.data import ModelData

# Load or create your position data
position = ModelData.load('your_model_name')

Setup Simulation

Define your model universe, alpha model, and simulation dates.

from finter.backtest.v0 import Simulator

# Create a simulator instance
simulator = Simulator(market_type="kr_stock")

# Run simulation with a position DataFrame
result = simulator.run(position=position)

# Access results
print(result.summary)

Key Parameters

simulator = Simulator("kr_stock")
result = simulator.run(
    position,
    start=20220101,
    end=20231231,
    buy_fee_tax=10,  # 0.1%
    sell_fee_tax=10,  # 0.1%
    slippage=5,  # 0.05%
    initial_cash=100_000_000,
    drip="reinvest",
    rebalancing_method="M",
    core_type="basic",
    debug=True
)
  1. Date Settings

    • start: Backtest start date (int, YYYYMMDD format)

    • end: Backtest end date (int, YYYYMMDD format)

  2. Cost Settings

    • buy_fee_tax: Buy fee (float, basis point)

    • sell_fee_tax: Sell fee (float, basis point)

    • slippage: Slippage (float, basis point)

    • dividend_tax: Dividend tax (float, basis point)

  3. Capital Settings

    • initial_cash: Initial investment amount (float)

    • volume_capacity_ratio: Trading volume limitation ratio (float)

  4. Execution Settings

    • resample_period: Resampling period (None, "W", "M", "Q")

    • rebalancing_method: Rebalancing method ("auto", "W", "M", "Q", "by_position")

    • core_type: Backtest engine type ("basic", "id_fund", "vn")

  5. Other Settings

    • debug: Activate debug mode (bool)

    • drip: Dividend processing method (None, "cash", "reinvest")

    • currency: Base currency ("KRW", "USD", "IDR", "VND")

Last updated