mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-10 04:37:24 -04:00
Compare commits
1 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c1d23a7c8 |
@@ -7,7 +7,6 @@ project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||||||
sys.path.insert(0, project_root)
|
sys.path.insert(0, project_root)
|
||||||
from tools.price_tools import get_open_prices
|
from tools.price_tools import get_open_prices
|
||||||
import json
|
import json
|
||||||
from tools.deployment_config import get_db_path
|
|
||||||
from api.database import get_db_connection
|
from api.database import get_db_connection
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
mcp = FastMCP("TradeTools")
|
mcp = FastMCP("TradeTools")
|
||||||
@@ -30,7 +29,7 @@ def get_current_position_from_db(job_id: str, model: str, date: str) -> Tuple[Di
|
|||||||
Raises:
|
Raises:
|
||||||
Exception: If database query fails
|
Exception: If database query fails
|
||||||
"""
|
"""
|
||||||
db_path = get_db_path()
|
db_path = "data/jobs.db"
|
||||||
conn = get_db_connection(db_path)
|
conn = get_db_connection(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
@@ -110,7 +109,7 @@ def buy(symbol: str, amount: int, signature: str = None, today_date: str = None,
|
|||||||
if not today_date:
|
if not today_date:
|
||||||
return {"error": "Missing required parameter: today_date"}
|
return {"error": "Missing required parameter: today_date"}
|
||||||
|
|
||||||
db_path = get_db_path()
|
db_path = "data/jobs.db"
|
||||||
conn = get_db_connection(db_path)
|
conn = get_db_connection(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
@@ -233,7 +232,7 @@ def sell(symbol: str, amount: int, signature: str = None, today_date: str = None
|
|||||||
if not today_date:
|
if not today_date:
|
||||||
return {"error": "Missing required parameter: today_date"}
|
return {"error": "Missing required parameter: today_date"}
|
||||||
|
|
||||||
db_path = get_db_path()
|
db_path = "data/jobs.db"
|
||||||
conn = get_db_connection(db_path)
|
conn = get_db_connection(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
|||||||
@@ -320,12 +320,11 @@ def get_today_init_position_from_db(
|
|||||||
If no position exists: {"CASH": 10000.0} (initial cash)
|
If no position exists: {"CASH": 10000.0} (initial cash)
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from tools.deployment_config import get_db_path
|
|
||||||
from api.database import get_db_connection
|
from api.database import get_db_connection
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
db_path = get_db_path()
|
db_path = "data/jobs.db"
|
||||||
conn = get_db_connection(db_path)
|
conn = get_db_connection(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
@@ -385,14 +384,13 @@ def add_no_trade_record_to_db(
|
|||||||
session_id: Trading session ID
|
session_id: Trading session ID
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from tools.deployment_config import get_db_path
|
|
||||||
from api.database import get_db_connection
|
from api.database import get_db_connection
|
||||||
from agent_tools.tool_trade import get_current_position_from_db
|
from agent_tools.tool_trade import get_current_position_from_db
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
db_path = get_db_path()
|
db_path = "data/jobs.db"
|
||||||
conn = get_db_connection(db_path)
|
conn = get_db_connection(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user