Bot auto-update: src/__pycache__/main_ml.cpython-310.pyc,src/__pycache__/web_dashboard.cpython-310.pyc,src/web_dashboard.py

This commit is contained in:
Marc Blatter 2026-07-04 13:00:33 +02:00
parent eafbb4a25d
commit a3bd191d40
3 changed files with 5 additions and 3 deletions

View File

@ -114,12 +114,14 @@ async def update_state(data: dict):
return {"status": "updated"}
@app.post("/api/trade/buy")
async def record_buy(pair: str, qty: float, price: float):
async def record_buy(pair: str, qty: float, price: float, entry_time: str = None):
"""Record a buy trade"""
if entry_time is None:
entry_time = datetime.now().isoformat()
trading_state['current_trades'][pair] = {
'qty': qty,
'entry_price': price,
'entry_time': datetime.now().isoformat(),
'price': price,
'entry_time': entry_time,
'type': 'BUY'
}
trading_state['trades_today'] += 1