fixed TZ
This commit is contained in:
@ -1452,8 +1452,8 @@ class TradingExecutor:
|
|||||||
# Calculate position size in USD
|
# Calculate position size in USD
|
||||||
position_size_usd = position.quantity * position.entry_price
|
position_size_usd = position.quantity * position.entry_price
|
||||||
|
|
||||||
# Calculate gross PnL (before fees) with leverage
|
# Calculate gross PnL (before fees) with leverage - SHORT profits when price falls
|
||||||
gross_pnl = (current_price - position.entry_price) * position.quantity * leverage
|
gross_pnl = (position.entry_price - current_price) * position.quantity * leverage
|
||||||
|
|
||||||
# Calculate net PnL (after fees)
|
# Calculate net PnL (after fees)
|
||||||
net_pnl = gross_pnl - simulated_fees
|
net_pnl = gross_pnl - simulated_fees
|
||||||
@ -1543,8 +1543,8 @@ class TradingExecutor:
|
|||||||
# Calculate position size in USD
|
# Calculate position size in USD
|
||||||
position_size_usd = position.quantity * position.entry_price
|
position_size_usd = position.quantity * position.entry_price
|
||||||
|
|
||||||
# Calculate gross PnL (before fees) with leverage
|
# Calculate gross PnL (before fees) with leverage - SHORT profits when price falls
|
||||||
gross_pnl = (current_price - position.entry_price) * position.quantity * leverage
|
gross_pnl = (position.entry_price - current_price) * position.quantity * leverage
|
||||||
|
|
||||||
# Calculate net PnL (after fees)
|
# Calculate net PnL (after fees)
|
||||||
net_pnl = gross_pnl - fees
|
net_pnl = gross_pnl - fees
|
||||||
@ -1630,7 +1630,7 @@ class TradingExecutor:
|
|||||||
# Calculate position size in USD
|
# Calculate position size in USD
|
||||||
position_size_usd = position.quantity * position.entry_price
|
position_size_usd = position.quantity * position.entry_price
|
||||||
|
|
||||||
# Calculate gross PnL (before fees) with leverage
|
# Calculate gross PnL (before fees) with leverage - LONG profits when price rises
|
||||||
gross_pnl = (current_price - position.entry_price) * position.quantity * leverage
|
gross_pnl = (current_price - position.entry_price) * position.quantity * leverage
|
||||||
|
|
||||||
# Calculate net PnL (after fees)
|
# Calculate net PnL (after fees)
|
||||||
|
@ -9059,7 +9059,8 @@ class CleanTradingDashboard:
|
|||||||
kline = data['k']
|
kline = data['k']
|
||||||
tick_record = {
|
tick_record = {
|
||||||
'symbol': 'ETHUSDT',
|
'symbol': 'ETHUSDT',
|
||||||
'datetime': datetime.fromtimestamp(int(kline['t']) / 1000),
|
# Store as UTC-aware to avoid local/UTC mixing
|
||||||
|
'datetime': datetime.fromtimestamp(int(kline['t']) / 1000, tz=timezone.utc),
|
||||||
'open': float(kline['o']),
|
'open': float(kline['o']),
|
||||||
'high': float(kline['h']),
|
'high': float(kline['h']),
|
||||||
'low': float(kline['l']),
|
'low': float(kline['l']),
|
||||||
|
Reference in New Issue
Block a user