feat: isolate strategy-owned KIS balances
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user