Releases: kay-ou/SimTradeLab
Releases · kay-ou/SimTradeLab
SimTradeLab v2.12.2
Fixed
- Cross-frequency data fallback —
get_historyandget_priceno longer return empty results when querying minute/period data during daily backtests. Previously, withcurrent_dtat midnight (00:00:00),searchsortedreturned -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
Fixed
- get_fundamentals keyword arg —
strategy_data_analyzernow detectstable='valuation'as a keyword argument, not just positional. Previously keyword-passed table names were silently ignored, causing valuation data not to load andget_fundamentalsto return empty results.
SimTradeLab v2.12.0
Changed
- Remove sandbox config —
sandboxfield removed fromBacktestConfig; safe builtins always enforced - Broker-gated py35 check — Python 3.5 compat check scoped to
guosheng/dongguan;autoandshanxiskip f-string validation - shanxi multi-stock format —
get_historyreturnsMultiIndex(field, code)with datetime index forshanxiprofile
SimTradeLab v2.11.0
✨ Added
- api coverage — Add 40+ PTrade-compatible API stubs with clear
NotImplementedErrormessages, 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_amountetc. - 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
- trading:
- 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-fillsecu_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_daysreturnnp.ndarraywith list-like truthinessget_trading_day/get_trading_day_by_datereturndatetime.dateinstead ofstrget_orderreturnslist[Order](single-element or empty) instead ofOrder | Noneget_tradesreturnsdict[str, list[list]]grouped by order id instead of raw order listget_stock_namereturnsdict[str, str | None] | None(never bare string)get_stock_statusreturnsdict[str, bool | None] | Noneget_positionalways returnsPosition(neverNone), empty position when not heldcancel_orderreturnsNone(notbool)get_stock_blocksreturnsNonewhen no data (not{})
- parameter alignment — Multiple API signatures adjusted:
set_parameters: removedparamsdict, only accepts**kwargsget_user_name: removedlogin_accountparameterget_stock_info: default fields changed to["stock_name"]set_slippagedefault:0.0→0.001;set_fixed_slippagedefault:0.001→0.0set_position: usessidkey (wassecurity), addsenable_amountsupportconvert_position_from_csv: returnssid-keyed formatget_individual_transaction/transcation: removedis_dictparameterrun_interval: removedinterval_timer_rangesparameterbuy_open/sell_open/sell_close/buy_close: renamedsecuritytocontract, removedclose_todaykwargs- Kwarg alias map direction reversed and expanded for better broker compatibility
- order processing — Removed internal
check_limit_statusfromOrderProcessor, limit check now handled externally - get_fundamentals —
fieldsmoved from required to optional parameter,get_market_listupdated exchange list,get_security_typeuses actual stock name lookup - broker compatibility —
check_limitreturns{}for guosheng;get_trading_dayuses next-trading-day lookup for guosheng day=0
🗑️ Removed
check_limit_statusmethod fromOrderProcessor(limit_status parameter removed fromprocess_order)_submit_derivative_orderconvenience 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.0SimTradeLab v2.10.3
🐛 Fixed
- daily index resolution — Add
_resolve_daily_indexfallback logic for day-level queries from minute timestamps (exact -> normalize -> previous trading day) to avoid lookup failures inget_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 = Nonetox: T | None = Noneacross PTrade-compatible interfaces for clearer signatures and static analysis friendliness. - repo hygiene — Ignore local Codex workspace metadata via
.codexin.gitignore.
✅ Tests
- broker profile compatibility — Extend broker-compat test coverage for the updated daily index resolution behavior.
📦 Upgrade
pip install --upgrade simtradelab==2.10.3SimTradeLab v2.10.2
Release v2.10.2
SimTradeLab v2.10.1
🐛 Fixed
- api —
get_index_stocksnow converts PTrade code format (.XSHG/.XSHE/.XBHS) to data format (.SS/.SZ) automatically - api —
get_index_stocksraisesValueErrorwith clear i18n message when index data is missing, instead of silently returning[] - api —
set_benchmarksupports PTrade code format (e.g.000300.XSHG→000300.SS) - api —
get_fundamentalsreturnsDataFrame(columns=fields)instead of emptyDataFrame()when no data matches, preventingKeyErroronsort_values
🔧 Changed
- project — Add ruff formatter/linter config (
pyproject.toml) for code style consistency with SimTradeAPI
📦 Upgrade
pip install --upgrade simtradelab==2.10.1SimTradeLab v2.10.0
✨ Added
- backtest — Multi-entry file support:
BacktestConfig.strategy_filedefaults tobacktest.py, can be set tolive.pyfor live-simulation mode - backtest —
_file_prefixproperty for log/chart filenames that adapt to the entry file (e.g.live_*.json) - ptrade —
on_order_response/on_trade_responsecallback simulation for live-mode strategies
📦 Upgrade
pip install --upgrade simtradelab==2.10.0SimTradeLab v2.9.0
✨ Added
- i18n — Auto-detect log language: CN market defaults to Chinese, others follow system locale; explicit
localeparam overrides - docs — German README (
README.de.md) - docs — All
BacktestConfigparameters documented in README examples with comments
🐛 Fixed
- api —
get_historymulti-stock: left-pad newly-listed stocks with NaN to align to trading calendar (PTrade convention)
📦 Upgrade
pip install --upgrade simtradelab==2.9.0SimTradeLab v2.8.1
🐛 Fixed
- i18n — Fix
Path(__file__)resolution failure after PyInstaller packaging, usesys._MEIPASSfor 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