Documentation ¶
Index ¶
- Variables
- func CandleFromKline(symbol string, k binance.Kline) model.Candle
- func CandleFromWsKline(symbol string, k binance.WsKline) model.Candle
- func SplitAssetQuote(symbol string) (string, string)
- type AssetInfo
- type AssetQuote
- type Binance
- func (b *Binance) Account() (model.Account, error)
- func (b *Binance) Cancel(order model.Order) error
- func (b *Binance) CandlesByLimit(ctx context.Context, symbol, period string, limit int) ([]model.Candle, error)
- func (b *Binance) CandlesByPeriod(ctx context.Context, symbol, period string, start, end time.Time) ([]model.Candle, error)
- func (b *Binance) CandlesSubscription(symbol, period string) (chan model.Candle, chan error)
- func (b *Binance) Order(symbol string, id int64) (model.Order, error)
- func (b *Binance) OrderLimit(side model.SideType, symbol string, quantity float64, limit float64) (model.Order, error)
- func (b *Binance) OrderMarket(side model.SideType, symbol string, quantity float64) (model.Order, error)
- func (b *Binance) OrderOCO(side model.SideType, symbol string, quantity, price, stop, stopLimit float64) ([]model.Order, error)
- func (b *Binance) OrderStop(symbol string, quantity float64, limit float64) (model.Order, error)
- func (b *Binance) Orders(symbol string, limit int) ([]model.Order, error)
- func (b *Binance) Position(symbol string) (asset, quote float64, err error)
- type BinanceOption
- type Broker
- type CSVFeed
- func (c *CSVFeed) CandlesByLimit(_ context.Context, pair, timeframe string, limit int) ([]model.Candle, error)
- func (c CSVFeed) CandlesByPeriod(_ context.Context, pair, timeframe string, start, end time.Time) ([]model.Candle, error)
- func (c CSVFeed) CandlesSubscription(pair, timeframe string) (chan model.Candle, chan error)
- type DataFeed
- type DataFeedConsumer
- type DataFeedSubscription
- type Exchange
- type Feeder
- type PairFeed
- type PaperWallet
- func (p *PaperWallet) Account() (model.Account, error)
- func (p *PaperWallet) Cancel(order model.Order) error
- func (p *PaperWallet) CandlesByLimit(ctx context.Context, pair, period string, limit int) ([]model.Candle, error)
- func (p *PaperWallet) CandlesByPeriod(ctx context.Context, pair, period string, start, end time.Time) ([]model.Candle, error)
- func (p *PaperWallet) CandlesSubscription(pair, timeframe string) (chan model.Candle, chan error)
- func (p *PaperWallet) ID() int64
- func (p *PaperWallet) OnCandle(candle model.Candle)
- func (p *PaperWallet) Order(symbol string, id int64) (model.Order, error)
- func (p *PaperWallet) OrderLimit(side model.SideType, symbol string, size float64, limit float64) (model.Order, error)
- func (p *PaperWallet) OrderMarket(side model.SideType, symbol string, size float64) (model.Order, error)
- func (p *PaperWallet) OrderOCO(side model.SideType, symbol string, size, price, stop, stopLimit float64) ([]model.Order, error)
- func (p *PaperWallet) Position(symbol string) (asset, quote float64, err error)
- func (p *PaperWallet) Summary()
- type PaperWalletOption
- type Subscription
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidQuantity = errors.New("invalid quantity") ErrInsufficientFunds = errors.New("insufficient funds or locked") ErrInvalidAsset = errors.New("invalid asset") )
View Source
var ErrInsufficientData = errors.New("insufficient data")
Functions ¶
func CandleFromKline ¶
func CandleFromWsKline ¶
func SplitAssetQuote ¶
Types ¶
type AssetQuote ¶
type Binance ¶
func NewBinance ¶
func NewBinance(ctx context.Context, options ...BinanceOption) (*Binance, error)
func (*Binance) CandlesByLimit ¶
func (*Binance) CandlesByPeriod ¶
func (*Binance) CandlesSubscription ¶
func (*Binance) OrderLimit ¶
func (*Binance) OrderMarket ¶
type BinanceOption ¶
type BinanceOption func(*Binance)
func WithBinanceCredentials ¶
func WithBinanceCredentials(key, secret string) BinanceOption
type Broker ¶
type Broker interface { Account() (model.Account, error) Position(symbol string) (asset, quote float64, err error) Order(symbol string, id int64) (model.Order, error) OrderOCO(side model.SideType, symbol string, size, price, stop, stopLimit float64) ([]model.Order, error) OrderLimit(side model.SideType, symbol string, size float64, limit float64) (model.Order, error) OrderMarket(side model.SideType, symbol string, size float64) (model.Order, error) Cancel(model.Order) error }
type DataFeedConsumer ¶
type DataFeedSubscription ¶
type DataFeedSubscription struct { Feeds []string DataFeeds map[string]*DataFeed SubscriptionsByDataFeed map[string][]Subscription // contains filtered or unexported fields }
func NewDataFeed ¶
func NewDataFeed(exchange Exchange) *DataFeedSubscription
func (*DataFeedSubscription) Connect ¶
func (d *DataFeedSubscription) Connect()
func (*DataFeedSubscription) Preload ¶
func (d *DataFeedSubscription) Preload(pair, timeframe string, candles []model.Candle)
func (*DataFeedSubscription) Start ¶
func (d *DataFeedSubscription) Start()
func (*DataFeedSubscription) Subscribe ¶
func (d *DataFeedSubscription) Subscribe(pair, timeframe string, consumer DataFeedConsumer, onCandleClose bool)
type PaperWallet ¶
func NewPaperWallet ¶
func NewPaperWallet(ctx context.Context, baseCoin string, options ...PaperWalletOption) *PaperWallet
func (*PaperWallet) CandlesByLimit ¶
func (*PaperWallet) CandlesByPeriod ¶
func (*PaperWallet) CandlesSubscription ¶
func (p *PaperWallet) CandlesSubscription(pair, timeframe string) (chan model.Candle, chan error)
func (*PaperWallet) ID ¶
func (p *PaperWallet) ID() int64
func (*PaperWallet) OnCandle ¶
func (p *PaperWallet) OnCandle(candle model.Candle)
func (*PaperWallet) OrderLimit ¶
func (*PaperWallet) OrderMarket ¶
func (*PaperWallet) Position ¶
func (p *PaperWallet) Position(symbol string) (asset, quote float64, err error)
func (*PaperWallet) Summary ¶
func (p *PaperWallet) Summary()
type PaperWalletOption ¶
type PaperWalletOption func(*PaperWallet)
func WithDataFeed ¶
func WithDataFeed(feeder Feeder) PaperWalletOption
func WithPaperAsset ¶
func WithPaperAsset(symbol string, amount float64) PaperWalletOption
func WithPaperFee ¶
func WithPaperFee(maker, taker float64) PaperWalletOption
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.