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:
parent
eafbb4a25d
commit
a3bd191d40
Binary file not shown.
Binary file not shown.
|
|
@ -114,12 +114,14 @@ async def update_state(data: dict):
|
||||||
return {"status": "updated"}
|
return {"status": "updated"}
|
||||||
|
|
||||||
@app.post("/api/trade/buy")
|
@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"""
|
"""Record a buy trade"""
|
||||||
|
if entry_time is None:
|
||||||
|
entry_time = datetime.now().isoformat()
|
||||||
trading_state['current_trades'][pair] = {
|
trading_state['current_trades'][pair] = {
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'entry_price': price,
|
'price': price,
|
||||||
'entry_time': datetime.now().isoformat(),
|
'entry_time': entry_time,
|
||||||
'type': 'BUY'
|
'type': 'BUY'
|
||||||
}
|
}
|
||||||
trading_state['trades_today'] += 1
|
trading_state['trades_today'] += 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue