feat: 添加 Lighter 适配器及相关功能,支持 trailing stops 和新的交易逻辑

This commit is contained in:
discountry
2025-09-30 22:08:05 +08:00
parent e83bdfccf9
commit c8b0ab1c8e
101 changed files with 90621 additions and 3 deletions
@@ -0,0 +1,49 @@
package client
import (
"crypto/tls"
"net"
"net/http"
"time"
)
var (
dialer = &net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 60 * time.Second,
}
transport = &http.Transport{
DialContext: dialer.DialContext,
MaxConnsPerHost: 1000,
MaxIdleConnsPerHost: 100,
IdleConnTimeout: 10 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
httpClient = &http.Client{
Timeout: time.Second * 30,
Transport: transport,
}
)
type HTTPClient struct {
endpoint string
channelName string
fatFingerProtection bool
}
func NewHTTPClient(baseUrl string) *HTTPClient {
if baseUrl == "" {
return nil
}
return &HTTPClient{
endpoint: baseUrl,
channelName: "",
fatFingerProtection: true,
}
}
func (c *HTTPClient) SetFatFingerProtection(enabled bool) {
c.fatFingerProtection = enabled
}