Implement config system.

This commit is contained in:
Adrian Gallagher
2015-02-18 19:01:47 +11:00
parent 9b5ced4f34
commit 1e627496a9
13 changed files with 526 additions and 121 deletions

View File

@@ -21,6 +21,8 @@ const (
)
type ItBit struct {
Name string
Enabled bool
ClientKey, APISecret, UserID string
}
@@ -44,6 +46,23 @@ type ItBitTicker struct {
ServertimeUTC string
}
func (i *ItBit) SetDefaults() {
i.Name = "ITBIT"
i.Enabled = true
}
func (i *ItBit) GetName() (string) {
return i.Name
}
func (i *ItBit) SetEnabled(enabled bool) {
i.Enabled = enabled
}
func (i *ItBit) IsEnabled() (bool) {
return i.Enabled
}
func (i *ItBit) GetTicker(currency string) (ItBitTicker) {
path := ITBIT_API_URL + "/markets/" + currency + "/ticker"
var itbitTicker ItBitTicker