Documentation ¶
Index ¶
- Constants
- Variables
- type APISec
- type Account
- func (acc *Account) AccessExchange(accessID string, clientTp int) error
- func (acc *Account) AddAccessKeys(id, key, secret string)
- func (acc Account) Client(i int) Exchange
- func (acc Account) ClientByID(id string) Exchange
- func (acc Account) ClientOptions() []string
- func (acc Account) Clients() []Exchange
- func (acc *Account) CreateStrategy(threshold, indWeight int, balance float64)
- func (acc Account) Key(key string) string
- func (acc Account) KeyStoreOpts() []string
- func (acc Account) Secret(key string) string
- func (acc *Account) ShowBalances()
- type Asset
- type Balance
- type Binance
- func (b *Binance) Account()
- func (b *Binance) AccountService()
- func (b *Binance) AddAsset(symbol string)
- func (b Binance) Assets() []*Asset
- func (b Binance) AssetsTable()
- func (b Binance) Balances() []Balance
- func (b *Binance) CancelOrder(symbol string, orderID int64)
- func (b *Binance) CreateOrder(symbol, price, qtd string)
- func (b *Binance) Depth(symbol string)
- func (b Binance) GetID() string
- func (b *Binance) GetOrder(symbol string, orderID int64) Order
- func (b *Binance) InfoService()
- func (b *Binance) ListKlines(symbol, time string)
- func (b *Binance) ListOpenOrders(symbol string) []Order
- func (b *Binance) NewHistoryTrades(symbol string)
- func (b *Binance) NewPriceChangeStatsService()
- func (b *Binance) OrdersBySymbol(symbol string)
- func (b *Binance) TimeService()
- func (b *Binance) UpdateTickerPrices()
- type Bitfinex
- func (b *Bitfinex) AccessExchange(account Account)
- func (b *Bitfinex) Account()
- func (b *Bitfinex) AccountName(accName string) string
- func (b *Bitfinex) CancelOrder(symbol string, orderID int64)
- func (b *Bitfinex) Client() *bfnx.Client
- func (b *Bitfinex) CreateOrder(symbol, price, qtd string)
- func (b *Bitfinex) GetOrder(symbol string, orderID int64) Order
- func (b *Bitfinex) GetOrdersBySymbol(symbol string) []Order
- func (b *Bitfinex) InfoService()
- func (b *Bitfinex) ListKlines(symbol, time string)
- func (b *Bitfinex) ListOpenOrders(symbol string) []Order
- func (b *Bitfinex) ListTickerPrices()
- func (b *Bitfinex) Name() string
- func (b *Bitfinex) NewHistoryTrades(symbol string)
- func (b *Bitfinex) ShowDepth(symbol string)
- func (b *Bitfinex) TimeService()
- type Candlestick
- type Description
- type Exchange
- type Indication
- type Indicator
- type Order
- type Strategy
- type Ticker
Constants ¶
const ( // BINANCE type BINANCE = iota // BITFINEX type BITFINEX )
const ( DoNothing = iota Buy Sell )
actions
Variables ¶
var IndicatorsOpts = map[string]func(Ticker) Indication{ "Percent": CalculatePercent, "MACD": MACD, "RSI": RSI, }
IndicatorsOpts full list of indicators
var MACD = func(ticker Ticker) Indication { return Indication{} }
MACD here the indicator calculations
var RSI = func(ticker Ticker) Indication { return Indication{} }
RSI here the indicator calculations
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Name string Strategies []*Strategy KeyStore map[string]*APISec Description Description Timestamp time.Time // contains filtered or unexported fields }
Account struct can have multiples clients of any exchanges accounts have personalized strategies beyond the standards
func (*Account) AccessExchange ¶
AccessExchange create new client connection
func (*Account) AddAccessKeys ¶
AddAccessKeys insert api key in keystore
func (Account) ClientByID ¶
ClientByID returns the client for the given id
func (Account) ClientOptions ¶
ClientOptions returns the id of all clients
func (*Account) CreateStrategy ¶
CreateStrategy adds a new strategy in acc Under tests...
func (Account) KeyStoreOpts ¶
KeyStoreOpts returns the api keys
func (*Account) ShowBalances ¶
func (acc *Account) ShowBalances()
ShowBalances all balances of each client
type Binance ¶
type Binance struct { ID string Client *bi.Client Orders []Order Tp int Active bool // contains filtered or unexported fields }
Binance struct bot
func (*Binance) CancelOrder ¶
CancelOrder cancel the order
func (*Binance) CreateOrder ¶
CreateOrder new order
func (*Binance) ListKlines ¶
ListKlines candlesticks
func (*Binance) ListOpenOrders ¶
ListOpenOrders returns opened orders
func (*Binance) NewHistoryTrades ¶
NewHistoryTrades history of trades
func (*Binance) NewPriceChangeStatsService ¶
func (b *Binance) NewPriceChangeStatsService()
NewPriceChangeStatsService info of ticker 24h
func (*Binance) OrdersBySymbol ¶
OrdersBySymbol order by symbol
func (*Binance) UpdateTickerPrices ¶
func (b *Binance) UpdateTickerPrices()
UpdateTickerPrices show prices
type Bitfinex ¶
type Bitfinex struct {
// contains filtered or unexported fields
}
Bitfinex struct bot
func (*Bitfinex) AccessExchange ¶
AccessExchange create new client connection
func (*Bitfinex) AccountName ¶
func (*Bitfinex) CancelOrder ¶
func (*Bitfinex) CreateOrder ¶
func (*Bitfinex) GetOrdersBySymbol ¶
func (*Bitfinex) InfoService ¶
func (b *Bitfinex) InfoService()
func (*Bitfinex) ListKlines ¶
func (*Bitfinex) ListOpenOrders ¶
func (*Bitfinex) ListTickerPrices ¶
func (b *Bitfinex) ListTickerPrices()
func (*Bitfinex) NewHistoryTrades ¶
func (*Bitfinex) TimeService ¶
func (b *Bitfinex) TimeService()
type Candlestick ¶
type Candlestick struct { OpenTime int64 Open string High string Low string Close string Volume string CloseTime int64 QuoteAssetVolume string TradeNum int64 TakerBuyBaseAssetVolume string TakerBuyQuoteAssetVolume string }
Candlestick informations about events in some time interval
type Description ¶
type Description struct {
// contains filtered or unexported fields
}
Description is the main informations about the acccount
type Exchange ¶
type Exchange interface { Account() Assets() []*Asset AddAsset(string) AssetsTable() Balances() []Balance AccountService() //todo: Account settings CancelOrder(symbol string, orderID int64) CreateOrder(symbol, price, qtd string) GetID() string GetOrder(symbol string, orderID int64) Order OrdersBySymbol(symbol string) InfoService() ListOpenOrders(symbol string) []Order UpdateTickerPrices() ListKlines(symbol, time string) NewHistoryTrades(symbol string) NewPriceChangeStatsService() Depth(symbol string) TimeService() }
Exchange client
type Indication ¶
Indication the result of the analysis TODO: receive the indication and create the order, than send it to the exchange
func CalculatePercent ¶
func CalculatePercent(ticker Ticker) Indication
CalculatePercent indications based in percent of prices
func NewIndication ¶
func NewIndication(action int, atMarket bool, price float64) Indication
NewIndication creates a indication
type Indicator ¶
type Indicator struct { Name string Category string Weight int Enabled bool TickerAnalisys func(Ticker) Indication }
Indicator is the structure that will do the price analisys the weight indicates how much important is the indication to make a decision
func NewIndicator ¶
func NewIndicator(weight int, enable bool, analysis func(Ticker) Indication) *Indicator
NewIndicator creates a new indicator
type Order ¶
type Order struct { Symbol string OrderID int64 ClientOrderID string Price string OrigQuantity string ExecutedQuantity string Status string TimeInForce string Type string Side string StopPrice string IcebergQuantity string Time int64 }
Order info
type Strategy ¶
type Strategy struct { Indicators []*Indicator Threshold int Pairs []string AvailableBalance float64 }
Strategy is the structure to configure the environment of the decisions the threshold is the sum of all indicatorweight to enable an action the field AvailableBalance is the limit which the strategies can get from total balance of an account
func NewStrategy ¶
NewStrategy creates a new strategy
func (*Strategy) AddIndicator ¶
AddIndicator adds an indicator into the strategy
func (*Strategy) ConsultStrategy ¶
ConsultStrategy runs the indicators in parallel the result is if the ticker is inside the strategy or not
func (Strategy) ThresholdReached ¶
ThresholdReached sum all enabled indicators and checks the acceptation