Package exchanges

This commit is contained in:
Adrian Gallagher
2017-03-21 01:50:07 +11:00
parent bbe660b5f4
commit aeb327c80c
68 changed files with 3808 additions and 3621 deletions

View File

@@ -5,12 +5,27 @@ import (
"time"
"github.com/thrasher-/gocryptotrader/common"
"github.com/thrasher-/gocryptotrader/config"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
)
const (
WarningBase64DecryptSecretKeyFailed = "WARNING -- Exchange %s unable to base64 decode secret key.. Disabling Authenticated API support."
)
//ExchangeAccountInfo : Generic type to hold each exchange's holdings in all enabled currencies
type ExchangeAccountInfo struct {
ExchangeName string
Currencies []ExchangeAccountCurrencyInfo
}
//ExchangeAccountCurrencyInfo : Sub type to store currency name and value
type ExchangeAccountCurrencyInfo struct {
CurrencyName string
TotalValue float64
Hold float64
}
type ExchangeBase struct {
Name string
Enabled bool
@@ -27,6 +42,18 @@ type ExchangeBase struct {
APIUrl string
}
//IBotExchange : Enforces standard functions for all exchanges supported in gocryptotrader
type IBotExchange interface {
Setup(exch config.ExchangeConfig)
Start()
SetDefaults()
GetName() string
IsEnabled() bool
GetTickerPrice(currency string) (ticker.TickerPrice, error)
GetEnabledCurrencies() []string
GetExchangeAccountInfo() (ExchangeAccountInfo, error)
}
func (e *ExchangeBase) GetName() string {
return e.Name
}