rpc

package
v0.2.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeStatus    = "status"
	MsgTypeException = "exception"
	MsgTypeStartUp   = "startup"

	MsgTypeEntry  = "entry"
	MsgTypeExit   = "exit"
	MsgTypeMarket = "market"
)

Variables

This section is empty.

Functions

func CleanUp

func CleanUp()

func SendMsg

func SendMsg(msg map[string]interface{})

func SetOrderManager added in v0.2.23

func SetOrderManager(mgr OrderManagerInterface)

SetOrderManager 设置订单管理器(由外部调用)

func SetWalletInfoProvider added in v0.2.23

func SetWalletInfoProvider(p WalletInfoProvider)

SetWalletInfoProvider 设置钱包信息提供者(由外部调用)

func TrySendExc

func TrySendExc(cacheKey string, content string)

Types

type BotSecret added in v0.2.23

type BotSecret struct {
	Secret string `json:"secret"`
	Pid    int    `json:"pid"`
	Port   int    `json:"port"`
}

type Email added in v0.2.18

type Email struct {
	*WebHook
	// contains filtered or unexported fields
}

func NewEmail added in v0.2.18

func NewEmail(name string, item map[string]interface{}) *Email

NewEmail 构造函数,基于通用 WebHook 创建 Email 发送实例

type ExcEncoder

type ExcEncoder struct {
	*log.TextEncoder
}

func (*ExcEncoder) Clone

func (e *ExcEncoder) Clone() *ExcEncoder

func (*ExcEncoder) EncodeEntry

func (e *ExcEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

type ExcNotify

type ExcNotify struct {
	zapcore.LevelEnabler
	// contains filtered or unexported fields
}

func NewExcNotify

func NewExcNotify() *ExcNotify

func (*ExcNotify) Check

func (*ExcNotify) Sync

func (h *ExcNotify) Sync() error

func (*ExcNotify) With

func (h *ExcNotify) With(fields []zapcore.Field) zapcore.Core

func (*ExcNotify) Write

func (h *ExcNotify) Write(ent zapcore.Entry, fields []zapcore.Field) error

type IWebHook

type IWebHook interface {
	GetName() string
	IsDisable() bool
	SetDisable(val bool)
	CleanUp()
	/*
		Send a message, payload is the data to be sent after msg rendering
			发送消息,payload是msg渲染后的待发送数据
	*/
	SendMsg(msgType string, account string, payload map[string]string) bool
	ConsumeForever()
}

type OrderInfo added in v0.2.23

type OrderInfo struct {
	ID       int64   `json:"id"`
	Symbol   string  `json:"symbol"`
	Short    bool    `json:"short"`
	Price    float64 `json:"price"`
	Amount   float64 `json:"amount"`
	EnterTag string  `json:"enter_tag"`
	Account  string  `json:"account"`
}

OrderInfo 订单信息结构

type OrderManagerInterface added in v0.2.23

type OrderManagerInterface interface {
	GetActiveOrders(account string) ([]*OrderInfo, error)
	CloseOrder(account string, orderID int64) error
	CloseAllOrders(account string) (int, int, error) // success count, failed count, error
	GetOrderStats(account string) (longCount, shortCount int, err error)
}

OrderManagerInterface 订单管理接口,避免循环依赖

type Telegram added in v0.2.23

type Telegram struct {
	*WebHook
	// contains filtered or unexported fields
}

func NewTelegram added in v0.2.23

func NewTelegram(name string, item map[string]interface{}) *Telegram

NewTelegram 构造函数,基于通用 WebHook 创建 Telegram 发送实例

func (*Telegram) Close added in v0.2.23

func (t *Telegram) Close()

Close 关闭Telegram客户端

func (*Telegram) IsTradingDisabled added in v0.2.23

func (t *Telegram) IsTradingDisabled(account string) bool

IsTradingDisabled 检查指定账户是否被禁用交易(供外部调用)

type WalletInfoProvider added in v0.2.23

type WalletInfoProvider interface {
	// 返回 单账户: 总额(法币), 可用(法币), 未实现盈亏(法币)
	GetSummary(account string) (totalLegal float64, availableLegal float64, unrealizedPOLLegal float64)
}

WalletInfoProvider 钱包信息提供者接口

type WeCred

type WeCred struct {
	// contains filtered or unexported fields
}

type WeWork

type WeWork struct {
	*WebHook
	// contains filtered or unexported fields
}

func NewWeWork

func NewWeWork(name string, item map[string]interface{}) *WeWork

type WeWorkATRes

type WeWorkATRes struct {
	WeWorkRes
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type WeWorkRes

type WeWorkRes struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

type WeWorkSendRes

type WeWorkSendRes struct {
	WeWorkRes
	InvalidUser    string `json:"invaliduser"`
	InvalidParty   string `json:"invalidparty"`
	InvalidTag     string `json:"invalidtag"`
	UnlicensedUser string `json:"unlicenseduser"`
	Msgid          string `json:"msgid"`
	ResponseCode   string `json:"response_code"`
}

type WebHook

type WebHook struct {
	Config   map[string]interface{}
	MsgTypes map[string]bool
	Accounts map[string]bool
	Queue    chan map[string]string
	// contains filtered or unexported fields
}

func NewWebHook

func NewWebHook(name string, item map[string]interface{}) *WebHook

func (*WebHook) CleanUp

func (h *WebHook) CleanUp()

func (*WebHook) ConsumeForever

func (h *WebHook) ConsumeForever()

func (*WebHook) GetName

func (h *WebHook) GetName() string

func (*WebHook) IsDisable

func (h *WebHook) IsDisable() bool

func (*WebHook) SendMsg

func (h *WebHook) SendMsg(msgType string, account string, payload map[string]string) bool

func (*WebHook) SetDisable

func (h *WebHook) SetDisable(val bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL