feat: isolate strategy-owned KIS balances

This commit is contained in:
jordan
2026-07-27 11:39:07 +09:00
parent 646ece93cb
commit b72bf9f394
7 changed files with 345 additions and 2 deletions
+17 -2
View File
@@ -56,8 +56,23 @@ def _make_env_broker(config: DaemonConfig) -> BrokerPort:
if k.redis_url:
from trex_core.adapters.broker.token_cache import RedisTokenCache
token_cache = RedisTokenCache(k.redis_url)
return KISBroker(k.account_ref, app_key=k.app_key, app_secret=k.app_secret, base_url=k.base_url,
timeout=k.timeout, allow_live=k.allow_live, token_cache=token_cache)
broker: BrokerPort = KISBroker(
k.account_ref,
app_key=k.app_key,
app_secret=k.app_secret,
base_url=k.base_url,
timeout=k.timeout,
allow_live=k.allow_live,
token_cache=token_cache,
)
ownership_path = os.environ.get("TREX_KIS_STRATEGY_OWNERSHIP_PATH", "").strip()
if ownership_path:
from trex_core.adapters.broker.ownership import (
OwnershipAwareBroker,
StrategyOwnershipStore,
)
broker = OwnershipAwareBroker(broker, StrategyOwnershipStore(ownership_path))
return broker
class ConfigBrokerProvider: