@@ -1165,6 +1165,43 @@ console.log("\n=== 11. currentEntryForAccount 映射健壮性 ===\n");
11651165 assert ( entry && entry . runtime_target_enabled === true , "11g: separator variants should fallback-match" ) ;
11661166}
11671167
1168+ // 11h: 避免平台前缀歧义导致误匹配(longbridge/ibkr 多账号)
1169+ {
1170+ const state = {
1171+ currentStrategies : {
1172+ longbridge : {
1173+ "longbridge-hk" : { runtime_target_enabled : false , reserved_cash_ratio : "0.11" } ,
1174+ "longbridge-sg" : { runtime_target_enabled : true , reserved_cash_ratio : "0.03" } ,
1175+ } ,
1176+ ibkr : {
1177+ "ibkr-primary" : { runtime_target_enabled : false , reserved_cash_ratio : "0.20" } ,
1178+ "ibkr-soxl" : { runtime_target_enabled : true , reserved_cash_ratio : "0.05" } ,
1179+ } ,
1180+ } ,
1181+ } ;
1182+ const longbridgeSg = { key : "longbridge-sg" , label : "LB|SG" , target_name : "longbridge-sg" } ;
1183+ const longbridgeEntry = currentEntryForAccount ( state , "longbridge" , longbridgeSg ) ;
1184+ assert (
1185+ longbridgeEntry && longbridgeEntry . runtime_target_enabled === true ,
1186+ "11h-a: longbridge-sg should match longbridge-sg entry instead of longbridge-hk" ,
1187+ ) ;
1188+ assert (
1189+ longbridgeEntry && longbridgeEntry . reserved_cash_ratio === "0.03" ,
1190+ "11h-b: longbridge-sg should use its own reserved_cash_ratio" ,
1191+ ) ;
1192+
1193+ const ibkrSoxl = { key : "ibkr-soxl" , label : "IBKR-SOXL" , target_name : "ibkr-soxl" } ;
1194+ const ibkrEntry = currentEntryForAccount ( state , "ibkr" , ibkrSoxl ) ;
1195+ assert (
1196+ ibkrEntry && ibkrEntry . runtime_target_enabled === true ,
1197+ "11h-c: ibkr-soxl should match ibkr-soxl entry instead of ibkr-primary" ,
1198+ ) ;
1199+ assert (
1200+ ibkrEntry && ibkrEntry . reserved_cash_ratio === "0.05" ,
1201+ "11h-d: ibkr-soxl should use its own reserved_cash_ratio" ,
1202+ ) ;
1203+ }
1204+
11681205// ============================================================
11691206// 12. syncOptionOverlayForAccount (解析为具体值)
11701207// ============================================================
0 commit comments