Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions trader/aster_trader.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"errors"
"fmt"
"io"
"nofx/logger"
"math"
"math/big"
"net/http"
"net/url"
"nofx/hook"
"nofx/logger"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -1262,14 +1262,14 @@ func (t *AsterTrader) GetOrderStatus(symbol string, orderID string) (map[string]

// Standardize return fields
response := map[string]interface{}{
"orderId": result["orderId"],
"symbol": result["symbol"],
"status": result["status"],
"side": result["side"],
"type": result["type"],
"time": result["time"],
"updateTime": result["updateTime"],
"commission": 0.0, // Aster may require separate query
"orderId": result["orderId"],
"symbol": result["symbol"],
"status": result["status"],
"side": result["side"],
"type": result["type"],
"time": result["time"],
"updateTime": result["updateTime"],
"commission": 0.0, // Aster may require separate query
}

// Parse numeric fields
Expand Down
19 changes: 9 additions & 10 deletions trader/auto_trader.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ type AutoTraderConfig struct {
BybitSecretKey string

// OKX API configuration
OKXAPIKey string
OKXSecretKey string
OKXAPIKey string
OKXSecretKey string
OKXPassphrase string

// Bitget API configuration
BitgetAPIKey string
BitgetSecretKey string
BitgetAPIKey string
BitgetSecretKey string
BitgetPassphrase string

// Hyperliquid configuration
Expand Down Expand Up @@ -1673,8 +1673,8 @@ func (at *AutoTrader) recordAndConfirmOrder(orderResult map[string]interface{},
}

// Poll order status to get actual fill price, quantity and fee
var actualPrice = price // fallback to market price
var actualQty = quantity // fallback to requested quantity
var actualPrice = price // fallback to market price
var actualQty = quantity // fallback to requested quantity
var fee float64

// Wait for order to be filled and get actual fill data
Expand Down Expand Up @@ -1772,10 +1772,10 @@ func (at *AutoTrader) recordPositionChange(orderID, symbol, side, action string,
// Update position record
err = at.store.Position().ClosePosition(
openPos.ID,
price, // exitPrice
orderID, // exitOrderID
price, // exitPrice
orderID, // exitOrderID
realizedPnL,
fee, // fee from exchange API
fee, // fee from exchange API
"ai_decision",
)
if err != nil {
Expand Down Expand Up @@ -1869,4 +1869,3 @@ func (at *AutoTrader) enforceMaxPositions(currentPositionCount int) error {
}
return nil
}

Loading
Loading