Documentation
¶
Index ¶
- Variables
- func Binance1(data map[string]interface{}) bool
- func Binance2(data map[string]interface{}) bool
- func Coinbase1(data map[string]interface{}) bool
- func InitBot()
- func SendMergeMessage(message string, mediaFiles []string) error
- func SendMessage(name, url, content string, mediaFies []string)
- func SendSeparatelyMessage(url, message string, mediaFiles []string) error
- func Upbit1(data map[string]interface{}) bool
- type CanOrder
- type Channel
- type Config
- type Depth
- type Dispatcher
- type EndpointCreator
- type Kline
- type KlineMessage
- type OrderInfo
- type Parser
- type RuelEngine
- type RuleEngine
- type Speed
- type StandardStream
- func (s *StandardStream) Close() error
- func (s *StandardStream) Connect(ctx context.Context) error
- func (s *StandardStream) Dial(ctx context.Context, args ...string) (*websocket.Conn, error)
- func (s *StandardStream) DialAndConnect(ctx context.Context) error
- func (s *StandardStream) EmitConnect()
- func (s *StandardStream) EmitDisconnect()
- func (s *StandardStream) EmitStart()
- func (s *StandardStream) GetPublicOnly() bool
- func (s *StandardStream) GetSubscriptions() []Subscription
- func (s *StandardStream) OnConnect(cb func())
- func (s *StandardStream) OnDisconnect(cb func())
- func (s *StandardStream) OnStart(cb func())
- func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel context.CancelFunc)
- func (s *StandardStream) Reconnect()
- func (s *StandardStream) SetConn(ctx context.Context, conn *websocket.Conn) (context.Context, context.CancelFunc)
- func (s *StandardStream) SetDispatcher(dispatcher Dispatcher)
- func (s *StandardStream) SetEndpointCreator(creator EndpointCreator)
- func (s *StandardStream) SetParser(parser Parser)
- func (s *StandardStream) SetPublicOnly()
- func (s *StandardStream) Subscribe(channel Channel, symbol string, options SubscribeOptions)
- type StandardStreamEmitter
- type StandardStreamEventHub
- type Stream
- type SubscribeOptions
- type Subscription
- type Symbol
- type Ticker
- type TickerMessage
- type TradeBot
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TgBotApiToken string ChatId int64 Bot *tgbotapi.BotAPI )
Functions ¶
func SendMergeMessage ¶
func SendMessage ¶
func SendSeparatelyMessage ¶
Types ¶
type Dispatcher ¶
type Dispatcher func(e interface{})
type Kline ¶
type Kline struct {
E string `json:"e"`
E1 int `json:"E"`
Symbol string `json:"s"`
Kline struct {
T int `json:"t"`
T1 int `json:"T"`
S string `json:"s"`
I string `json:"i"`
F int `json:"f"`
L int `json:"L"`
Open string `json:"o"`
Close string `json:"c"`
High string `json:"h"`
Low string `json:"l"`
Volume string `json:"v"`
Number int `json:"n"`
X bool `json:"x"`
Quantity string `json:"q"`
TakeBuyVolume string `json:"V"`
TakeBuyQuantity string `json:"Q"`
B string `json:"B"`
} `json:"k"`
}
type KlineMessage ¶
type KlineMessage struct {
Data Kline `json:"data"`
}
type RuelEngine ¶
type RuelEngine struct {
Keys []string
RuleEngine
CanOrder chan *CanOrder
}
func NewRuelEngine ¶
func NewRuelEngine(co chan *CanOrder) RuelEngine
func (RuelEngine) OrdreNews ¶
func (e RuelEngine) OrdreNews(json []byte)
func (RuelEngine) ParseNews ¶
func (e RuelEngine) ParseNews(json []byte)
func (RuelEngine) TeleNews ¶
func (e RuelEngine) TeleNews(json []byte)
type RuleEngine ¶
type RuleEngine struct {
Rules map[string]func(data map[string]interface{}) bool
Rows [][]interface{}
Data dataframe.DataFrame
Titles []string
Time []string
Source []string
Url []string
}
func NewRule ¶
func NewRule() RuleEngine
func (*RuleEngine) AddRule ¶
func (e *RuleEngine) AddRule(name string, fn func(data map[string]interface{}) bool)
func (*RuleEngine) RunRules ¶
func (e *RuleEngine) RunRules(data map[string]interface{}) (bool, string)
func (*RuleEngine) SaveToCSV ¶
func (e *RuleEngine) SaveToCSV()
type StandardStream ¶
type StandardStream struct {
// Conn is the websocket connection
Conn *websocket.Conn
// ConnCtx is the context of the current websocket connection
ConnCtx context.Context
// ConnCancel is the cancel funcion of the current websocket connection
ConnCancel context.CancelFunc
// ConnLock is used for locking Conn, ConnCtx and ConnCancel fields.
// When changing these field values, be sure to call ConnLock
ConnLock sync.Mutex
PublicOnly bool
// ReconnectC is a signal channel for reconnecting
ReconnectC chan struct{}
// CloseC is a signal channel for closing stream
CloseC chan struct{}
Subscriptions []Subscription
// contains filtered or unexported fields
}
func NewStandardStream ¶
func NewStandardStream() StandardStream
func (*StandardStream) Close ¶
func (s *StandardStream) Close() error
func (*StandardStream) Connect ¶
func (s *StandardStream) Connect(ctx context.Context) error
Connect starts the stream and create the websocket connection
func (*StandardStream) DialAndConnect ¶
func (s *StandardStream) DialAndConnect(ctx context.Context) error
func (*StandardStream) EmitConnect ¶
func (s *StandardStream) EmitConnect()
func (*StandardStream) EmitDisconnect ¶
func (s *StandardStream) EmitDisconnect()
func (*StandardStream) EmitStart ¶
func (s *StandardStream) EmitStart()
func (*StandardStream) GetPublicOnly ¶
func (s *StandardStream) GetPublicOnly() bool
func (*StandardStream) GetSubscriptions ¶
func (s *StandardStream) GetSubscriptions() []Subscription
func (*StandardStream) OnConnect ¶
func (s *StandardStream) OnConnect(cb func())
func (*StandardStream) OnDisconnect ¶
func (s *StandardStream) OnDisconnect(cb func())
func (*StandardStream) OnStart ¶
func (s *StandardStream) OnStart(cb func())
func (*StandardStream) Read ¶
func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel context.CancelFunc)
func (*StandardStream) Reconnect ¶
func (s *StandardStream) Reconnect()
func (*StandardStream) SetConn ¶
func (s *StandardStream) SetConn(ctx context.Context, conn *websocket.Conn) (context.Context, context.CancelFunc)
func (*StandardStream) SetDispatcher ¶
func (s *StandardStream) SetDispatcher(dispatcher Dispatcher)
func (*StandardStream) SetEndpointCreator ¶
func (s *StandardStream) SetEndpointCreator(creator EndpointCreator)
func (*StandardStream) SetParser ¶
func (s *StandardStream) SetParser(parser Parser)
func (*StandardStream) SetPublicOnly ¶
func (s *StandardStream) SetPublicOnly()
func (*StandardStream) Subscribe ¶
func (s *StandardStream) Subscribe(channel Channel, symbol string, options SubscribeOptions)
type StandardStreamEmitter ¶
type StandardStreamEmitter interface {
Stream
EmitStart()
EmitConnect()
EmitDisconnect()
}
type StandardStreamEventHub ¶
type StandardStreamEventHub interface {
OnStart(cb func())
OnConnect(cb func())
OnDisconnect(cb func())
OnTradeUpdate(cb func())
}
type Stream ¶
type Stream interface {
StandardStreamEventHub
Subscribe(channel Channel, symbol string, options SubscribeOptions)
GetSubscriptions() []Subscription
SetPublicOnly()
GetPublicOnly() bool
Connect(ctx context.Context) error
Close() error
}
type SubscribeOptions ¶
type SubscribeOptions struct {
Depth Depth `json:"depth,omitempty"`
Speed Speed `json:"speed,omitempty"`
}
SubscribeOptions provides the standard stream options
func (SubscribeOptions) String ¶
func (o SubscribeOptions) String() string
type Subscription ¶
type Subscription struct {
Symbol string `json:"symbol"`
Channel Channel `json:"channel"`
Options SubscribeOptions `json:"options"`
}
type Ticker ¶
type Ticker struct {
E string `json:"e"`
E1 int `json:"E"`
Symbol string `json:"s"`
P string `json:"p"`
P1 string `json:"P"`
W string `json:"w"`
CurrentPrice string `json:"c"`
Quantity string `json:"Q"`
O string `json:"o"`
H string `json:"h"`
L string `json:"l"`
V string `json:"v"`
Q1 string `json:"q"`
O1 int `json:"O"`
C1 int `json:"C"`
F int `json:"F"`
L1 int `json:"L"`
N int `json:"n"`
}
type TickerMessage ¶
type TickerMessage struct {
Data Ticker `json:"data"`
}
type TradeBot ¶
type TradeBot struct {
NewsStream *news.Stream
RuelEngine *RuelEngine
BinanceFuture *exchange.BinanceFuture
CanOrder chan *CanOrder
}
func NewTradeBot ¶
func NewTradeBot() TradeBot
func (*TradeBot) ListenCreateOrder ¶
func (tb *TradeBot) ListenCreateOrder()
func (*TradeBot) ListenNews ¶
func (tb *TradeBot) ListenNews()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.