feat(quant): Human-in-the-Loop Expert Trader Advisory & Dynamic Learning Engine
This commit is contained in:
@@ -16,6 +16,8 @@ class AccountItem(BaseModel):
|
||||
server: str
|
||||
password: str
|
||||
is_active: bool = False
|
||||
role: str = "MASTER" # MASTER or FOLLOWER
|
||||
mirror_enabled: bool = True
|
||||
created_at: Optional[str] = None
|
||||
|
||||
class AccountVaultService:
|
||||
@@ -57,6 +59,8 @@ class AccountVaultService:
|
||||
safe_list = []
|
||||
for a in accounts:
|
||||
item = dict(a)
|
||||
item["role"] = a.get("role", "MASTER" if a.get("account_id") == 425437997 else "FOLLOWER")
|
||||
item["mirror_enabled"] = a.get("mirror_enabled", True)
|
||||
item["has_password"] = bool(a.get("password"))
|
||||
item["password"] = "••••••••" if a.get("password") else ""
|
||||
safe_list.append(item)
|
||||
@@ -74,7 +78,18 @@ class AccountVaultService:
|
||||
return accounts[0]
|
||||
return None
|
||||
|
||||
def add_account(self, name: str, account_id: int, server: str, password: str) -> Dict[str, Any]:
|
||||
def get_mirror_accounts(self) -> List[Dict[str, Any]]:
|
||||
"""Returns follower accounts configured for automated copy-trading."""
|
||||
accounts = self._load()
|
||||
active = self.get_active_account()
|
||||
active_id = active.get("account_id") if active else None
|
||||
followers = []
|
||||
for a in accounts:
|
||||
if a.get("account_id") != active_id and a.get("role") == "FOLLOWER" and a.get("mirror_enabled", True):
|
||||
followers.append(a)
|
||||
return followers
|
||||
|
||||
def add_account(self, name: str, account_id: int, server: str, password: str, role: str = "FOLLOWER", mirror_enabled: bool = True) -> Dict[str, Any]:
|
||||
accounts = self._load()
|
||||
# Check if already exists
|
||||
for a in accounts:
|
||||
@@ -82,6 +97,8 @@ class AccountVaultService:
|
||||
# Update existing
|
||||
a["name"] = name
|
||||
a["server"] = server
|
||||
a["role"] = role
|
||||
a["mirror_enabled"] = mirror_enabled
|
||||
if password:
|
||||
a["password"] = password
|
||||
self._save(accounts)
|
||||
@@ -94,6 +111,8 @@ class AccountVaultService:
|
||||
"account_id": account_id,
|
||||
"server": server,
|
||||
"password": password,
|
||||
"role": role,
|
||||
"mirror_enabled": mirror_enabled,
|
||||
"is_active": len(accounts) == 0,
|
||||
"created_at": "2026-10-23"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user