Each bot inherits from an interface and can be called as such to minimise

duplicate code
This commit is contained in:
Scott
2016-03-14 21:20:32 +11:00
committed by Adrian Gallagher
parent 6e34e42964
commit dc313a24f5
18 changed files with 397 additions and 260 deletions

View File

@@ -70,6 +70,26 @@ func (i *ItBit) IsEnabled() bool {
return i.Enabled
}
func (i *ItBit) Setup(exch Exchanges) {
if !exch.Enabled {
i.SetEnabled(false)
} else {
i.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
i.SetAPIKeys(exch.APIKey, exch.APISecret, exch.ClientID)
i.RESTPollingDelay = exch.RESTPollingDelay
i.Verbose = exch.Verbose
i.Websocket = exch.Websocket
i.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
i.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
i.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}
func (i *ItBit) Start() {
go i.Run()
}
func (i *ItBit) SetAPIKeys(apiKey, apiSecret, userID string) {
i.ClientKey = apiKey
i.APISecret = apiSecret