Skip to content

Commit

Permalink
Made slight amendments to interface code, ran gofmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Mar 19, 2016
1 parent dc313a2 commit fc68096
Show file tree
Hide file tree
Showing 18 changed files with 297 additions and 316 deletions.
53 changes: 17 additions & 36 deletions anxhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,45 +100,28 @@ func (a *ANX) SetDefaults() {
a.RESTPollingDelay = 10
}



///<Interface code>
func (a *ANX) InterfaceSetDefaults() {
a.Name = "ANX"
a.Enabled = true
a.TakerFee = 0.6
a.MakerFee = 0.3
a.Verbose = false
a.Websocket = false
println("This is working using interfaces")
a.RESTPollingDelay = 10
}
///</Interface code>


//Setup is run on startup to setup exchange with config values
func (a *ANX) Setup(exch Exchanges) {
if !exch.Enabled {
a.SetEnabled(false)
} else {
a.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
a.SetAPIKeys(exch.APIKey, exch.APISecret)
a.RESTPollingDelay = exch.RESTPollingDelay
a.Verbose = exch.Verbose
a.Websocket = exch.Websocket
a.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
a.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
a.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
func (a *ANX) Setup(exch Exchanges) {
if !exch.Enabled {
a.SetEnabled(false)
} else {
a.Enabled = true
a.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
a.SetAPIKeys(exch.APIKey, exch.APISecret)
a.RESTPollingDelay = exch.RESTPollingDelay
a.Verbose = exch.Verbose
a.Websocket = exch.Websocket
a.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
a.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
a.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

//Start is run if exchange is enabled, after Setup
func(a *ANX) Start() {
if(a.Enabled) {
go a.Run()
}
func (a *ANX) Start() {
go a.Run()
}


func (a *ANX) GetName() string {
return a.Name
}
Expand All @@ -151,8 +134,6 @@ func (a *ANX) IsEnabled() bool {
return a.Enabled
}



func (a *ANX) SetAPIKeys(apiKey, apiSecret string) {
if !a.AuthenticatedAPISupport {
return
Expand Down
27 changes: 14 additions & 13 deletions bitfinexhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,23 @@ func (b *Bitfinex) GetName() string {
}

func (b *Bitfinex) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

func (b *Bitfinex) Start() {
go b.Run()
go b.Run()
}

func (b *Bitfinex) SetEnabled(enabled bool) {
Expand Down
27 changes: 14 additions & 13 deletions bitstamphttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,27 @@ func (b *Bitstamp) SetDefaults() {
}

func (b *Bitstamp) Start() {
go b.Run()
go b.Run()
}

func (b *Bitstamp) GetName() string {
return b.Name
}

func (b *Bitstamp) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.ClientID, exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.ClientID, exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

func (b *Bitstamp) SetEnabled(enabled bool) {
Expand Down
28 changes: 14 additions & 14 deletions brightonpeakhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ func (b *BrightonPeak) SetEnabled(enabled bool) {
}

func (b *BrightonPeak) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret, exch.ClientID)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret, exch.ClientID)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

func (b *BrightonPeak) Start() {
go b.Run()
go b.Run()
}


func (b *BrightonPeak) IsEnabled() bool {
return b.Enabled
}
Expand Down
30 changes: 16 additions & 14 deletions btcchttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,24 @@ func (b *BTCC) SetDefaults() {

//Setup is run on startup to setup exchange with config values
func (b *BTCC) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

//Start is run if exchange is enabled, after Setup
func(b *BTCC) Start() {
go b.Run()
func (b *BTCC) Start() {
go b.Run()
}

func (b *BTCC) GetName() string {
Expand Down
37 changes: 19 additions & 18 deletions btcehttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,25 @@ func (b *BTCE) IsEnabled() bool {
return b.Enabled
}

func(b *BTCE) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")

}
}

func(b *BTCE) Start() {
go b.Run()
func (b *BTCE) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")

}
}

func (b *BTCE) Start() {
go b.Run()
}

func (b *BTCE) SetAPIKeys(apiKey, apiSecret string) {
Expand Down
31 changes: 16 additions & 15 deletions btcmarkets.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,24 @@ func (b *BTCMarkets) IsEnabled() bool {
}

func (b *BTCMarkets) Setup(exch Exchanges) {
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")

}
if !exch.Enabled {
b.SetEnabled(false)
} else {
b.Enabled = true
b.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
b.SetAPIKeys(exch.APIKey, exch.APISecret)
b.RESTPollingDelay = exch.RESTPollingDelay
b.Verbose = exch.Verbose
b.Websocket = exch.Websocket
b.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
b.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
b.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")

}
}

func(b *BTCMarkets) Start() {
go b.Run()
func (b *BTCMarkets) Start() {
go b.Run()
}

func (b *BTCMarkets) SetAPIKeys(apiKey, apiSecret string) {
Expand Down
28 changes: 14 additions & 14 deletions coinbasehttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ func (c *Coinbase) IsEnabled() bool {
}

func (c *Coinbase) Setup(exch Exchanges) {
if !exch.Enabled {
c.SetEnabled(false)
} else {
c.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
c.SetAPIKeys(exch.ClientID, exch.APIKey, exch.APISecret)
c.RESTPollingDelay = exch.RESTPollingDelay
c.Verbose = exch.Verbose
c.Websocket = exch.Websocket
c.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
c.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
c.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
if !exch.Enabled {
c.SetEnabled(false)
} else {
c.Enabled = true
c.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
c.SetAPIKeys(exch.ClientID, exch.APIKey, exch.APISecret)
c.RESTPollingDelay = exch.RESTPollingDelay
c.Verbose = exch.Verbose
c.Websocket = exch.Websocket
c.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
c.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
c.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

func (c *Coinbase) Start() {
go c.Run()
go c.Run()
}

func (c *Coinbase) GetFee(maker bool) float64 {
Expand Down
29 changes: 15 additions & 14 deletions geminihttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,23 @@ func (g *Gemini) IsEnabled() bool {
}

func (g *Gemini) Setup(exch Exchanges) {
if !exch.Enabled {
g.SetEnabled(false)
} else {
g.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
g.SetAPIKeys(exch.APIKey, exch.APISecret)
g.RESTPollingDelay = exch.RESTPollingDelay
g.Verbose = exch.Verbose
g.Websocket = exch.Websocket
g.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
g.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
g.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}
if !exch.Enabled {
g.SetEnabled(false)
} else {
g.Enabled = true
g.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
g.SetAPIKeys(exch.APIKey, exch.APISecret)
g.RESTPollingDelay = exch.RESTPollingDelay
g.Verbose = exch.Verbose
g.Websocket = exch.Websocket
g.BaseCurrencies = SplitStrings(exch.BaseCurrencies, ",")
g.AvailablePairs = SplitStrings(exch.AvailablePairs, ",")
g.EnabledPairs = SplitStrings(exch.EnabledPairs, ",")
}
}

func (g *Gemini) Start() {
go g.Run()
go g.Run()
}

func (g *Gemini) SetAPIKeys(apiKey, apiSecret string) {
Expand Down
Loading

0 comments on commit fc68096

Please sign in to comment.