Root cause: HL WS uses allMids (all coins), BG WS subscribes per-coin. Delisted coins had stale HL prices showing huge fake spreads (~200%). Monitor tried entry → BG buy succeeds, HL sell fails (Trading is halted) → orphan position on BG accumulated across restarts. Fix: - Set HL="" for BNT, CATI, CYBER, ILV, LISTA, OGN, STG, PIXEL - Add guard in ScanBGHL to skip coins where BG or HL is empty - Same guard in SpreadWindowTracker.Tick
34 lines
708 B
Go
34 lines
708 B
Go
//go:build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"exchange-monitor/exchange"
|
|
)
|
|
|
|
func main() {
|
|
b, _ := os.ReadFile(".env")
|
|
m := map[string]string{}
|
|
for _, l := range strings.Split(string(b), "\n") {
|
|
l = strings.TrimSpace(l)
|
|
if l == "" || l[0] == '#' { continue }
|
|
if i := strings.Index(l, "="); i > 0 {
|
|
m[strings.TrimSpace(l[:i])] = strings.TrimSpace(l[i+1:])
|
|
}
|
|
}
|
|
|
|
bg := exchange.NewBitgetTrade(m["BITGET_API_KEY"], m["BITGET_API_SECRET"], m["BITGET_PASSPHRASE"])
|
|
bal, err := bg.GetBalance()
|
|
if err != nil {
|
|
fmt.Printf("BG balance error: %v\n", err)
|
|
} else {
|
|
fmt.Printf("BG balance: $%.2f\n", bal)
|
|
}
|
|
|
|
fmt.Println("\nKey prefix:", string(m["BITGET_API_KEY"][:5]))
|
|
}
|