Remove Aevo exchange (retired)
- Delete exchange/aevo.go (AevoWS, aevoTickerMsg, aevoTickerData, etc.) - scanner.go: remove ExAevo constant, fee rates, scan pair entries, shortName mapping - main.go: remove aevoSymbols collection loop and TrackedSymbol usage
This commit is contained in:
@@ -1,129 +0,0 @@
|
|||||||
package exchange
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"log"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AevoWS connects to Aevo WebSocket for ticker data.
|
|
||||||
type AevoWS struct {
|
|
||||||
Conn *PriceConnector
|
|
||||||
Tracked []TrackedSymbol // coin + instrument name pairs
|
|
||||||
}
|
|
||||||
|
|
||||||
type TrackedSymbol struct {
|
|
||||||
Coin string // "BTC"
|
|
||||||
InstrumentID string // "BTC-PERP"
|
|
||||||
}
|
|
||||||
|
|
||||||
type aevoTickerMsg struct {
|
|
||||||
Op string `json:"op"`
|
|
||||||
Data json.RawMessage `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type aevoTickerData struct {
|
|
||||||
Timestamp string `json:"timestamp"`
|
|
||||||
Tickers []aevoInstrument `json:"tickers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type aevoInstrument struct {
|
|
||||||
InstrumentName string `json:"instrument_name"`
|
|
||||||
Mark *aevoPriceObj `json:"mark,omitempty"`
|
|
||||||
LastPrice string `json:"last_price,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type aevoPriceObj struct {
|
|
||||||
Price string `json:"price"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewAevoWS(tracked []TrackedSymbol) *AevoWS {
|
|
||||||
ae := &AevoWS{
|
|
||||||
Tracked: tracked,
|
|
||||||
Conn: NewPriceConnector("wss://ws.aevo.xyz", "Aevo", 120*time.Second, 30*time.Second),
|
|
||||||
}
|
|
||||||
ae.Conn.PingInterval = 45 * time.Second
|
|
||||||
return ae
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run connects to Aevo WS and streams ticker data.
|
|
||||||
func (a *AevoWS) Run(updateFn func(coin string, price, bid, ask float64)) error {
|
|
||||||
a.Conn.OnConnect = func() {
|
|
||||||
log.Printf("[Aevo WS] Connected, subscribing to %d tickers", len(a.Tracked))
|
|
||||||
|
|
||||||
for _, t := range a.Tracked {
|
|
||||||
sub := map[string]interface{}{
|
|
||||||
"op": "subscribe",
|
|
||||||
"data": []string{"ticker:" + t.Coin},
|
|
||||||
}
|
|
||||||
if err := a.Conn.SendJSON(sub); err != nil {
|
|
||||||
log.Printf("[Aevo WS] Subscribe %s error: %v", t.InstrumentID, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a.Conn.OnMessage = func(msg []byte) {
|
|
||||||
var raw map[string]json.RawMessage
|
|
||||||
if err := json.Unmarshal(msg, &raw); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for error
|
|
||||||
if errMsg, hasErr := raw["error"]; hasErr {
|
|
||||||
var errStr string
|
|
||||||
json.Unmarshal(errMsg, &errStr)
|
|
||||||
if errStr != "" {
|
|
||||||
// Log once, skip errors
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse ticker data
|
|
||||||
op, hasOp := raw["op"]
|
|
||||||
if !hasOp {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var opStr string
|
|
||||||
if err := json.Unmarshal(op, &opStr); err != nil || opStr != "ticker" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
dataRaw, hasData := raw["data"]
|
|
||||||
if !hasData {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var data aevoTickerData
|
|
||||||
if err := json.Unmarshal(dataRaw, &data); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, ticker := range data.Tickers {
|
|
||||||
// Find the coin for this instrument
|
|
||||||
coin := ""
|
|
||||||
for _, t := range a.Tracked {
|
|
||||||
if t.InstrumentID == ticker.InstrumentName {
|
|
||||||
coin = t.Coin
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if coin == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try mark price first, then last_price
|
|
||||||
var price float64
|
|
||||||
if ticker.Mark != nil && ticker.Mark.Price != "" {
|
|
||||||
price = parseFloat(ticker.Mark.Price)
|
|
||||||
} else if ticker.LastPrice != "" {
|
|
||||||
price = parseFloat(ticker.LastPrice)
|
|
||||||
}
|
|
||||||
|
|
||||||
if price > 0 {
|
|
||||||
updateFn(coin, price, 0, 0) // B#7: pass bid=ask=0 for 4-arg signature
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.Conn.Run()
|
|
||||||
}
|
|
||||||
@@ -71,16 +71,11 @@ func main() {
|
|||||||
|
|
||||||
// Collect symbols
|
// Collect symbols
|
||||||
var bnSymbols, bgSymbols, hlSymbols, dydxSymbols []string
|
var bnSymbols, bgSymbols, hlSymbols, dydxSymbols []string
|
||||||
var aevoSymbols []exchange.TrackedSymbol
|
|
||||||
for _, c := range TrackedCoins {
|
for _, c := range TrackedCoins {
|
||||||
bnSymbols = append(bnSymbols, c.BN)
|
bnSymbols = append(bnSymbols, c.BN)
|
||||||
bgSymbols = append(bgSymbols, c.BG)
|
bgSymbols = append(bgSymbols, c.BG)
|
||||||
hlSymbols = append(hlSymbols, c.HL)
|
hlSymbols = append(hlSymbols, c.HL)
|
||||||
dydxSymbols = append(dydxSymbols, c.HL)
|
dydxSymbols = append(dydxSymbols, c.HL)
|
||||||
aevoSymbols = append(aevoSymbols, exchange.TrackedSymbol{
|
|
||||||
Coin: c.Name,
|
|
||||||
InstrumentID: c.Name + "-PERP",
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start all exchange WS connections
|
// Start all exchange WS connections
|
||||||
|
|||||||
-10
@@ -14,7 +14,6 @@ const (
|
|||||||
ExHyperLiquid = "HyperLiquid"
|
ExHyperLiquid = "HyperLiquid"
|
||||||
ExBitget = "Bitget"
|
ExBitget = "Bitget"
|
||||||
ExDydx = "dYdX"
|
ExDydx = "dYdX"
|
||||||
ExAevo = "Aevo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Fee rates (%) — taker fees per exchange
|
// Fee rates (%) — taker fees per exchange
|
||||||
@@ -23,7 +22,6 @@ var feeRates = map[string]float64{
|
|||||||
ExHyperLiquid: 0.035,
|
ExHyperLiquid: 0.035,
|
||||||
ExBitget: 0.040, // standard taker
|
ExBitget: 0.040, // standard taker
|
||||||
ExDydx: 0.050, // dYdX v4 standard taker
|
ExDydx: 0.050, // dYdX v4 standard taker
|
||||||
ExAevo: 0.050, // Aevo standard taker
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maker fee rates (%) — for limit orders
|
// Maker fee rates (%) — for limit orders
|
||||||
@@ -32,7 +30,6 @@ var makerFees = map[string]float64{
|
|||||||
ExHyperLiquid: 0.015,
|
ExHyperLiquid: 0.015,
|
||||||
ExBitget: 0.020, // standard maker
|
ExBitget: 0.020, // standard maker
|
||||||
ExDydx: 0.020,
|
ExDydx: 0.020,
|
||||||
ExAevo: 0.020,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TickerCoins defines all coins we monitor.
|
// TickerCoins defines all coins we monitor.
|
||||||
@@ -67,7 +64,6 @@ func ScanArbWithFees(store *PriceStore, fees map[string]float64) []*ArbOpportuni
|
|||||||
hlP := exMap[ExHyperLiquid]
|
hlP := exMap[ExHyperLiquid]
|
||||||
bgP := exMap[ExBitget]
|
bgP := exMap[ExBitget]
|
||||||
dyP := exMap[ExDydx]
|
dyP := exMap[ExDydx]
|
||||||
aeP := exMap[ExAevo]
|
|
||||||
|
|
||||||
var pairs []struct {
|
var pairs []struct {
|
||||||
profit float64
|
profit float64
|
||||||
@@ -102,13 +98,9 @@ func ScanArbWithFees(store *PriceStore, fees map[string]float64) []*ArbOpportuni
|
|||||||
addPair(ExBinance, ExHyperLiquid, bnP, hlP)
|
addPair(ExBinance, ExHyperLiquid, bnP, hlP)
|
||||||
addPair(ExBinance, ExBitget, bnP, bgP)
|
addPair(ExBinance, ExBitget, bnP, bgP)
|
||||||
addPair(ExBinance, ExDydx, bnP, dyP)
|
addPair(ExBinance, ExDydx, bnP, dyP)
|
||||||
addPair(ExBinance, ExAevo, bnP, aeP)
|
|
||||||
addPair(ExHyperLiquid, ExBitget, hlP, bgP)
|
addPair(ExHyperLiquid, ExBitget, hlP, bgP)
|
||||||
addPair(ExHyperLiquid, ExDydx, hlP, dyP)
|
addPair(ExHyperLiquid, ExDydx, hlP, dyP)
|
||||||
addPair(ExHyperLiquid, ExAevo, hlP, aeP)
|
|
||||||
addPair(ExBitget, ExDydx, bgP, dyP)
|
addPair(ExBitget, ExDydx, bgP, dyP)
|
||||||
addPair(ExBitget, ExAevo, bgP, aeP)
|
|
||||||
addPair(ExDydx, ExAevo, dyP, aeP)
|
|
||||||
|
|
||||||
if len(pairs) == 0 {
|
if len(pairs) == 0 {
|
||||||
continue
|
continue
|
||||||
@@ -163,8 +155,6 @@ func shortName(exchange string) string {
|
|||||||
return "BG"
|
return "BG"
|
||||||
case ExDydx:
|
case ExDydx:
|
||||||
return "dYdX"
|
return "dYdX"
|
||||||
case ExAevo:
|
|
||||||
return "Ae"
|
|
||||||
}
|
}
|
||||||
return "??"
|
return "??"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user