mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-10 14:27:00 +08:00
feat(hook): Add hook module to help decouple some specific logic (#784)
This commit is contained in:
42
hook/trader_hook.go
Normal file
42
hook/trader_hook.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/adshao/go-binance/v2/futures"
|
||||
)
|
||||
|
||||
type NewBinanceTraderResult struct {
|
||||
Err error
|
||||
Client *futures.Client
|
||||
}
|
||||
|
||||
func (r *NewBinanceTraderResult) Error() error {
|
||||
if r.Err != nil {
|
||||
log.Printf("⚠️ 执行NewBinanceTraderResult时出错: %v", r.Err)
|
||||
}
|
||||
return r.Err
|
||||
}
|
||||
|
||||
func (r *NewBinanceTraderResult) GetResult() *futures.Client {
|
||||
r.Error()
|
||||
return r.Client
|
||||
}
|
||||
|
||||
type NewAsterTraderResult struct {
|
||||
Err error
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
func (r *NewAsterTraderResult) Error() error {
|
||||
if r.Err != nil {
|
||||
log.Printf("⚠️ 执行NewAsterTraderResult时出错: %v", r.Err)
|
||||
}
|
||||
return r.Err
|
||||
}
|
||||
|
||||
func (r *NewAsterTraderResult) GetResult() *http.Client {
|
||||
r.Error()
|
||||
return r.Client
|
||||
}
|
||||
Reference in New Issue
Block a user