@@ -27,6 +27,13 @@ assert.ok(indexHtml.includes('id="reserved-cash-ratio-input"'));
2727assert . ok ( indexHtml . includes ( 'id="reserve-policy-mode-select"' ) ) ;
2828assert . ok ( indexHtml . includes ( 'id="runtime-target-enabled-select"' ) ) ;
2929assert . ok ( indexHtml . includes ( 'id="plugin-mode-select"' ) ) ;
30+ assert . ok ( indexHtml . includes ( 'id="income-layer-start-usd-input"' ) ) ;
31+ assert . ok ( indexHtml . includes ( 'incomeLayerStartUsd: "收入层起始金额"' ) ) ;
32+ assert . ok ( indexHtml . includes ( 'incomeLayerStartUsd: "Income layer start amount"' ) ) ;
33+ assert . ok ( indexHtml . includes ( 'incomeLayerStartUsdVariable = "INCOME_LAYER_START_USD"' ) ) ;
34+ assert . ok ( indexHtml . includes ( 'el("income-layer-mode-select").addEventListener("change"' ) ) ;
35+ assert . ok ( indexHtml . includes ( 'el("income-layer-start-usd-input").addEventListener("input"' ) ) ;
36+ assert . ok ( indexHtml . includes ( 'el("income-layer-max-ratio-input").addEventListener("input"' ) ) ;
3037assert . ok ( indexHtml . includes ( "account-block" ) ) ;
3138assert . ok ( indexHtml . includes ( "strategy-block" ) ) ;
3239assert . ok ( indexHtml . includes ( "grid-template-columns: repeat(4, minmax(0, 1fr));" ) ) ;
@@ -312,9 +319,13 @@ const normalizedReservedCashInputs = __test.normalizeSwitchInputs({
312319 trigger_platform_sync : "true" ,
313320 reserved_cash_ratio : "0.03" ,
314321 min_reserved_cash_usd : "150" ,
322+ income_layer_start_usd : "250000" ,
323+ income_layer_max_ratio : "0.55" ,
315324} ) ;
316325assert . equal ( normalizedReservedCashInputs . reserved_cash_ratio , "0.03" ) ;
317326assert . equal ( normalizedReservedCashInputs . min_reserved_cash_usd , "150" ) ;
327+ assert . equal ( normalizedReservedCashInputs . income_layer_start_usd , "250000" ) ;
328+ assert . equal ( normalizedReservedCashInputs . income_layer_max_ratio , "0.55" ) ;
318329const normalizedPluginInputs = __test . normalizeSwitchInputs ( {
319330 platform : "ibkr" ,
320331 target_name : "ibkr-primary" ,
@@ -426,6 +437,18 @@ globalThis.fetch = async (url) => {
426437 headers : { "Content-Type" : "application/json" } ,
427438 } ) ;
428439 }
440+ if ( requestUrl . endsWith ( "/INCOME_LAYER_START_USD" ) ) {
441+ return new Response ( JSON . stringify ( { value : "150000" } ) , {
442+ status : 200 ,
443+ headers : { "Content-Type" : "application/json" } ,
444+ } ) ;
445+ }
446+ if ( requestUrl . endsWith ( "/INCOME_LAYER_MAX_RATIO" ) ) {
447+ return new Response ( JSON . stringify ( { value : "0.95" } ) , {
448+ status : 200 ,
449+ headers : { "Content-Type" : "application/json" } ,
450+ } ) ;
451+ }
429452 if ( requestUrl . endsWith ( "/RUNTIME_TARGET_ENABLED" ) ) {
430453 return new Response ( JSON . stringify ( { value : "false" } ) , {
431454 status : 200 ,
@@ -455,6 +478,8 @@ try {
455478 assert . equal ( currentStrategies . schwab . default . execution_mode , "live" ) ;
456479 assert . equal ( currentStrategies . schwab . default . min_reserved_cash_usd , "150" ) ;
457480 assert . equal ( currentStrategies . schwab . default . reserved_cash_ratio , "0.03" ) ;
481+ assert . equal ( currentStrategies . schwab . default . income_layer_start_usd , "150000" ) ;
482+ assert . equal ( currentStrategies . schwab . default . income_layer_max_ratio , "0.95" ) ;
458483 assert . equal ( currentStrategies . schwab . default . runtime_target_enabled , false ) ;
459484 assert . equal ( currentStrategies . schwab . default . source , "RUNTIME_TARGET_JSON" ) ;
460485} finally {
@@ -472,6 +497,8 @@ globalThis.fetch = async (url) => {
472497 ACCOUNT_GROUP : "demo-ibkr-tqqq" ,
473498 IBKR_MIN_RESERVED_CASH_USD : "150" ,
474499 IBKR_RESERVED_CASH_RATIO : "0.03" ,
500+ INCOME_LAYER_START_USD : "250000" ,
501+ INCOME_LAYER_MAX_RATIO : "0.55" ,
475502 RUNTIME_TARGET_ENABLED : "false" ,
476503 runtime_target : {
477504 platform_id : "ibkr" ,
@@ -496,6 +523,8 @@ try {
496523 assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . strategy_profile , "tqqq_growth_income" ) ;
497524 assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . min_reserved_cash_usd , "150" ) ;
498525 assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . reserved_cash_ratio , "0.03" ) ;
526+ assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . income_layer_start_usd , "250000" ) ;
527+ assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . income_layer_max_ratio , "0.55" ) ;
499528 assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . runtime_target_enabled , false ) ;
500529 assert . equal ( currentStrategies . ibkr [ "ibkr-primary" ] . source , "CLOUD_RUN_SERVICE_TARGETS_JSON" ) ;
501530} finally {
0 commit comments