Skip to content

Releases: kay-ou/SimTradeLab

SimTradeLab v2.12.2

27 May 09:57

Choose a tag to compare

Fixed

  • Cross-frequency data fallbackget_history and get_price no longer return empty results when querying minute/period data during daily backtests. Previously, with current_dt at midnight (00:00:00), searchsorted returned -1 for minute data starting at 09:31, causing stocks to be silently skipped. Now falls back to 15:00 market close on the same day to locate the latest available bar.

SimTradeLab v2.12.1

23 May 09:38

Choose a tag to compare

Fixed

  • get_fundamentals keyword argstrategy_data_analyzer now detects table='valuation' as a keyword argument, not just positional. Previously keyword-passed table names were silently ignored, causing valuation data not to load and get_fundamentals to return empty results.

SimTradeLab v2.12.0

21 May 12:57

Choose a tag to compare

Changed

  • Remove sandbox configsandbox field removed from BacktestConfig; safe builtins always enforced
  • Broker-gated py35 check — Python 3.5 compat check scoped to guosheng/dongguan; auto and shanxi skip f-string validation
  • shanxi multi-stock formatget_history returns MultiIndex(field, code) with datetime index for shanxi profile

SimTradeLab v2.11.0

19 May 19:15

Choose a tag to compare

✨ Added

  • api coverage — Add 40+ PTrade-compatible API stubs with clear NotImplementedError messages, covering:
    • trading: order_market, ipo_stocks_order, after_trading_order, after_trading_cancel_order, order_tick, cancel_order_ex, get_all_orders, get_ipo_stocks, get_deliver, get_fundjour, get_trade_name
    • margin: margincash_open/close/direct_refund, marginsec_open/close/direct_refund, get_margincash_stocks, get_marginsec_stocks, get_margin_contract/contractreal, get_assure_security_list, get_margincash_open_amount etc.
    • ETF: get_etf_info, get_etf_stock_info, get_etf_stock_list, etf_basket_order, etf_purchase_redemption, get_etf_list
    • options: open_prepared, close_prepared, option_exercise, option_covered_lock/unlock, get_covered_lock_amount, get_covered_unlock_amount
    • convertible bonds: get_cb_info, get_cb_list, debt_to_stock_order
    • market data: get_individual_entrust, get_tick_direction, get_sort_msg, get_gear_price, get_snapshot
    • notifications: send_email, send_qywx, permission_test
  • get_fundamentals — Significantly enhanced: fields now optional (auto-selects all table fields), expanded field lists per table (20+ fields for valuation), table aliases (balance_statement, income_statement, cashflow_statement, eps), auto-fill secu_code/secu_abbr/trading_day/end_date, better date resolution for financial reports

🔧 Changed

  • return type alignment — Multiple API return types adjusted to match PTrade platform behavior:
    • get_trade_days / get_all_trades_days return np.ndarray with list-like truthiness
    • get_trading_day / get_trading_day_by_date return datetime.date instead of str
    • get_order returns list[Order] (single-element or empty) instead of Order | None
    • get_trades returns dict[str, list[list]] grouped by order id instead of raw order list
    • get_stock_name returns dict[str, str | None] | None (never bare string)
    • get_stock_status returns dict[str, bool | None] | None
    • get_position always returns Position (never None), empty position when not held
    • cancel_order returns None (not bool)
    • get_stock_blocks returns None when no data (not {})
  • parameter alignment — Multiple API signatures adjusted:
    • set_parameters: removed params dict, only accepts **kwargs
    • get_user_name: removed login_account parameter
    • get_stock_info: default fields changed to ["stock_name"]
    • set_slippage default: 0.00.001; set_fixed_slippage default: 0.0010.0
    • set_position: uses sid key (was security), adds enable_amount support
    • convert_position_from_csv: returns sid-keyed format
    • get_individual_transaction/transcation: removed is_dict parameter
    • run_interval: removed interval_timer_ranges parameter
    • buy_open/sell_open/sell_close/buy_close: renamed security to contract, removed close_today kwargs
    • Kwarg alias map direction reversed and expanded for better broker compatibility
  • order processing — Removed internal check_limit_status from OrderProcessor, limit check now handled externally
  • get_fundamentalsfields moved from required to optional parameter, get_market_list updated exchange list, get_security_type uses actual stock name lookup
  • broker compatibilitycheck_limit returns {} for guosheng; get_trading_day uses next-trading-day lookup for guosheng day=0

🗑️ Removed

  • check_limit_status method from OrderProcessor (limit_status parameter removed from process_order)
  • _submit_derivative_order convenience method
  • _get_price_and_check_limit → renamed to _get_execution_price (no longer checks limit)

🌍 i18n

  • New strings: api.local_backtest_api_unsupported, api.gf_invalid_table, api.gf_fields_omitted_requires_named_date

📦 Upgrade

pip install --upgrade simtradelab==2.11.0

SimTradeLab v2.10.3

09 May 20:25

Choose a tag to compare

🐛 Fixed

  • daily index resolution — Add _resolve_daily_index fallback logic for day-level queries from minute timestamps (exact -> normalize -> previous trading day) to avoid lookup failures in get_price, history, and limit-status related flows.
  • data query robustness — When day index cannot be resolved for a symbol, skip gracefully instead of raising index/location errors in multi-symbol queries.

🔧 Changed

  • api typing — Standardize multiple optional API parameters from x: T = None to x: T | None = None across PTrade-compatible interfaces for clearer signatures and static analysis friendliness.
  • repo hygiene — Ignore local Codex workspace metadata via .codex in .gitignore.

✅ Tests

  • broker profile compatibility — Extend broker-compat test coverage for the updated daily index resolution behavior.

📦 Upgrade

pip install --upgrade simtradelab==2.10.3

SimTradeLab v2.10.2

14 Apr 12:08

Choose a tag to compare

Release v2.10.2

SimTradeLab v2.10.1

26 Mar 22:27

Choose a tag to compare

🐛 Fixed

  • apiget_index_stocks now converts PTrade code format (.XSHG/.XSHE/.XBHS) to data format (.SS/.SZ) automatically
  • apiget_index_stocks raises ValueError with clear i18n message when index data is missing, instead of silently returning []
  • apiset_benchmark supports PTrade code format (e.g. 000300.XSHG000300.SS)
  • apiget_fundamentals returns DataFrame(columns=fields) instead of empty DataFrame() when no data matches, preventing KeyError on sort_values

🔧 Changed

  • project — Add ruff formatter/linter config (pyproject.toml) for code style consistency with SimTradeAPI

📦 Upgrade

pip install --upgrade simtradelab==2.10.1

SimTradeLab v2.10.0

23 Mar 22:35

Choose a tag to compare

✨ Added

  • backtest — Multi-entry file support: BacktestConfig.strategy_file defaults to backtest.py, can be set to live.py for live-simulation mode
  • backtest_file_prefix property for log/chart filenames that adapt to the entry file (e.g. live_*.json)
  • ptradeon_order_response / on_trade_response callback simulation for live-mode strategies

📦 Upgrade

pip install --upgrade simtradelab==2.10.0

SimTradeLab v2.9.0

19 Mar 23:29

Choose a tag to compare

✨ Added

  • i18n — Auto-detect log language: CN market defaults to Chinese, others follow system locale; explicit locale param overrides
  • docs — German README (README.de.md)
  • docs — All BacktestConfig parameters documented in README examples with comments

🐛 Fixed

  • apiget_history multi-stock: left-pad newly-listed stocks with NaN to align to trading calendar (PTrade convention)

📦 Upgrade

pip install --upgrade simtradelab==2.9.0

SimTradeLab v2.8.1

18 Mar 23:18

Choose a tag to compare

🐛 Fixed

  • i18n — Fix Path(__file__) resolution failure after PyInstaller packaging, use sys._MEIPASS for compatibility
  • adj_cache — Fix adjustment factor cache files written to data/ root instead of market subdirectory (data/cn/, data/us/)

📦 Upgrade

pip install --upgrade simtradelab==2.8.1