config

package
v0.0.0-...-069e140 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 33 Imported by: 0

README

GoCryptoTrader package Config

Build Status Software License GoDoc Coverage Status Go Report Card

This config package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Current Features for config

  • Handling of config encryption and verification of "configuration".json data.

  • Contains configurations for:

    • Exchanges for utilisation of a broad or minimal amount of enabled exchanges Example for enabling an exchange.

    • Bank accounts for withdrawal and depositing FIAT between exchange and your personal accounts Example.

    • Portfolio to monitor online and offline accounts Example.

    • Currency configurations to set your foreign exchange provider accounts, your preferred display currency, suitable FIAT currency and suitable cryptocurrency Example.

    • Communication for utilisation of supported communication mediums e.g. email events direct to your personal account Example.

Config Examples

Basic examples for enabling features on the GoCryptoTrader platform
  • Linux example for quickly creating and testing configuration file
cd ~/go/src/github.com/yurulab/gocryptotrader
cp config_example.json config.json
# Test config
go build
./gocryptotrader
  • or custom config, can also pass in absolute path to "configuration".json file.
cd ~/go/src/github.com/yurulab/gocryptotrader
cp config_example.json custom.json
# Test config
go build
./gocryptotrader -config custom.json

Enable Exchange Via Config Example

  • To enable or disable an exchange via config proceed through the "configuration".json file to exchanges and to the supported exchange e.g see below. "Enabled" set to true or false will enable and disable the exchange, if you set "APIKey" && "APISecret" you must set "AuthenticatedAPISupport" to true or the bot will not be able to send authenticated http requests. If needed you can set the exchanges bank details for depositing FIAT options. Some banks have multiple deposit accounts for different FIAT deposit currencies.
"Exchanges": [
 {
  "Name": "Bitfinex",
  "Enabled": true,
  "Verbose": false,
  "Websocket": false,
  "UseSandbox": false,
  "RESTPollingDelay": 10,
  "websocketResponseCheckTimeout": 30000000,
  "websocketResponseMaxLimit": 7000000000,
  "httpTimeout": 15000000000,
  "APIKey": "Key",
  "APISecret": "Secret",
  "AvailablePairs": "ATENC_GBP,ATENC_NZD,BTC_AUD,BTC_SGD,LTC_BTC,START_GBP,...",
  "EnabledPairs": "BTC_USD,BTC_HKD,BTC_EUR,BTC_CAD,BTC_AUD,BTC_SGD,BTC_JPY,...",
  "BaseCurrencies": "USD,HKD,EUR,CAD,AUD,SGD,JPY,GBP,NZD",
  "AssetTypes": "SPOT",
  "SupportsAutoPairUpdates": true,
  "ConfigCurrencyPairFormat": {
   "Uppercase": true,
   "Delimiter": "_"
  },
  "RequestCurrencyPairFormat": {
   "Uppercase": true
  },
  "BankAccounts": [
   {
    "BankName": "",
    "BankAddress": "",
    "AccountName": "",
    "AccountNumber": "",
    "SWIFTCode": "",
    "IBAN": "",
    "SupportedCurrencies": "AUD,USD,EUR"
   }
  ]
 },

Enable Bank Accounts Via Config Example

  • To enable bank accounts simply proceed through "configuration".json file to "BankAccounts" and input your account information example below.
"BankAccounts": [
 {
  "BankName": "test",
  "BankAddress": "test",
  "AccountName": "TestAccount",
  "AccountNumber": "0234",
  "SWIFTCode": "91272837",
  "IBAN": "98218738671897",
  "SupportedCurrencies": "USD",
  "SupportedExchanges": "Kraken,Bitstamp"
 }
]

Enable Portfolio Via Config Example

  • To enable the GoCryptoTrader platform to monitor your addresses please specify, "configuration".json file example below.
"PortfolioAddresses": {
 "Addresses": [
  {
   "Address": "1JCe8z4jJVNXSjohjM4i9Hh813dLCNx2Sy",
   "CoinType": "BTC",
   "Balance": 53000.01310358,
   "Description": ""
  },
  {
   "Address": "3Nxwenay9Z8Lc9JBiywExpnEFiLp6Afp8v",
   "CoinType": "BTC",
   "Balance": 101848.28376405,
   "Description": ""
  }
 ]

Enable Currency Via Config Example

  • To Enable foreign exchange providers set "Enabled" to true and add in your account API keys example below.
"ForexProviders": [
 {
  "Name": "CurrencyConverter",
  "Enabled": true,
  "Verbose": false,
  "RESTPollingDelay": 600,
  "APIKey": "",
  "APIKeyLvl": -1,
  "PrimaryProvider": true
 },
]
  • To define the cryptocurrency you want the platform to use set them here example below.
"Cryptocurrencies": "BTC,LTC,ETH,XRP,NMC,NVC,PPC,XBT,DOGE,DASH",
  • To define the currency you want to everything to be valued against example below.
"FiatDisplayCurrency": "USD"

Enable Communications Via Config Example

  • To set the desired platform communication medium proceed to "Communications" in the "configuration".json file and set your account details to the preferred comm method and add in your contact list if available.
"SMSGlobal": {
 "Name": "SMSGlobal",
 "Enabled": false,
 "Verbose": false,
 "Username": "Username",
 "Password": "Password",
 "Contacts": [
  {
   "Name": "Bob",
   "Number": "12345",
   "Enabled": false
  }
 ]
},

Configure Network Time Server

  • To configure and enable a NTP server you need to set the "enabled" field to one of 3 values -1 is disabled 0 is enabled and alert at start up 1 is enabled and warn at start up servers are configured by the pool array and attempted first to last allowedDifference and allowedNegativeDifference are how far ahead and behind is acceptable for the time to be out in nanoseconds
 "ntpclient": {
  "enabled": 0,
  "pool": [
   "pool.ntp.org:123"
  ],
  "allowedDifference": 0,
  "allowedNegativeDifference": 0
 },
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

View Source
const (
	// EncryptConfirmString has a the general confirmation string to allow us to
	// see if the file is correctly encrypted
	EncryptConfirmString = "THORS-HAMMER"
	// SaltPrefix string
	SaltPrefix = "~GCT~SO~SALTY~"
	// SaltRandomLength is the number of random bytes to append after the prefix string
	SaltRandomLength = 12
)
View Source
const (
	FXProviderFixer = "fixer"
	EncryptedFile   = "config.dat"
	File            = "config.json"
	TestFile        = "../testdata/configtest.json"

	DefaultAPIKey      = "Key"
	DefaultAPISecret   = "Secret"
	DefaultAPIClientID = "ClientID"
)

Constants declared here are filename strings and test strings

View Source
const (
	ErrExchangeNameEmpty                       = "exchange #%d name is empty"
	ErrExchangeAvailablePairsEmpty             = "exchange %s available pairs is empty"
	ErrExchangeEnabledPairsEmpty               = "exchange %s enabled pairs is empty"
	ErrExchangeBaseCurrenciesEmpty             = "exchange %s base currencies is empty"
	ErrExchangeNotFound                        = "exchange %s not found"
	ErrNoEnabledExchanges                      = "no exchanges enabled"
	ErrCryptocurrenciesEmpty                   = "cryptocurrencies variable is empty"
	ErrFailureOpeningConfig                    = "fatal error opening %s file. Error: %s"
	ErrCheckingConfigValues                    = "fatal error checking config values. Error: %s"
	ErrSavingConfigBytesMismatch               = "config file %q bytes comparison doesn't match, read %s expected %s"
	WarningWebserverCredentialValuesEmpty      = "webserver support disabled due to empty Username/Password values"
	WarningWebserverListenAddressInvalid       = "webserver support disabled due to invalid listen address"
	WarningExchangeAuthAPIDefaultOrEmptyValues = "exchange %s authenticated API support disabled due to default/empty APIKey/Secret/ClientID values"
	WarningPairsLastUpdatedThresholdExceeded   = "exchange %s last manual update of available currency pairs has exceeded %d days. Manual update required!"
)

Constants here hold some messages

View Source
const (
	APIURLNonDefaultMessage              = "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API"
	WebsocketURLNonDefaultMessage        = "NON_DEFAULT_HTTP_LINK_TO_WEBSOCKET_EXCHANGE_API"
	DefaultUnsetAPIKey                   = "Key"
	DefaultUnsetAPISecret                = "Secret"
	DefaultUnsetAccountPlan              = "accountPlan"
	DefaultForexProviderExchangeRatesAPI = "ExchangeRates"
)

Constants here define unset default values displayed in the config.json file

Variables

View Source
var (
	Cfg            Config
	IsInitialSetup bool
)

Variables here are used for configuration

Functions

func ConfirmECS

func ConfirmECS(file []byte) bool

ConfirmECS confirms that the encryption confirmation string is found

func ConfirmSalt

func ConfirmSalt(file []byte) bool

ConfirmSalt checks whether the encrypted data contains a salt

func DecryptConfigFile

func DecryptConfigFile(configData, key []byte) ([]byte, error)

DecryptConfigFile decrypts configuration data with the supplied key and returns the un-encrypted file as a byte array with an error

func DefaultFilePath

func DefaultFilePath() string

DefaultFilePath returns the default config file path MacOS/Linux: $HOME/.gocryptotrader/config.json or config.dat Windows: %APPDATA%\GoCryptoTrader\config.json or config.dat Helpful for printing application usage

func EncryptConfigFile

func EncryptConfigFile(configData, key []byte) ([]byte, error)

EncryptConfigFile encrypts configuration data that is parsed in with a key and returns it as a byte array with an error

func GetFilePath

func GetFilePath(configfile string) (string, error)

GetFilePath returns the desired config file or the default config file name based on if the application is being run under test or normal mode. It will also move/rename the config file under the following conditions:

  1. If a config file is found in the executable path directory and no explicit config path is set, plus no config is found in the GCT data dir, it will move it to the GCT data dir. If a config already exists in the GCT data dir, it will warn the user and load the config found in the GCT data dir
  2. If a config file in the GCT data dir has the file extension .dat but contains json data, it will rename to the file to config.json
  3. If a config file in the GCT data dir has the file extension .json but contains encrypted data, it will rename the file to config.dat

func PromptForConfigKey

func PromptForConfigKey(initialSetup bool) ([]byte, error)

PromptForConfigKey asks for configuration key

func RemoveECS

func RemoveECS(file []byte) []byte

RemoveECS removes encryption confirmation string

Types

type APIConfig

type APIConfig struct {
	AuthenticatedSupport          bool `json:"authenticatedSupport"`
	AuthenticatedWebsocketSupport bool `json:"authenticatedWebsocketApiSupport"`
	PEMKeySupport                 bool `json:"pemKeySupport,omitempty"`

	Endpoints            APIEndpointsConfig             `json:"endpoints"`
	Credentials          APICredentialsConfig           `json:"credentials"`
	CredentialsValidator *APICredentialsValidatorConfig `json:"credentialsValidator,omitempty"`
}

APIConfig stores the exchange API config

type APICredentialsConfig

type APICredentialsConfig struct {
	Key       string `json:"key,omitempty"`
	Secret    string `json:"secret,omitempty"`
	ClientID  string `json:"clientID,omitempty"`
	PEMKey    string `json:"pemKey,omitempty"`
	OTPSecret string `json:"otpSecret,omitempty"`
}

APICredentialsConfig stores the API credentials

type APICredentialsValidatorConfig

type APICredentialsValidatorConfig struct {
	// For Huobi (optional)
	RequiresPEM bool `json:"requiresPEM,omitempty"`

	RequiresKey                bool `json:"requiresKey,omitempty"`
	RequiresSecret             bool `json:"requiresSecret,omitempty"`
	RequiresClientID           bool `json:"requiresClientID,omitempty"`
	RequiresBase64DecodeSecret bool `json:"requiresBase64DecodeSecret,omitempty"`
}

APICredentialsValidatorConfig stores the API credentials validator settings

type APIEndpointsConfig

type APIEndpointsConfig struct {
	URL          string `json:"url"`
	URLSecondary string `json:"urlSecondary"`
	WebsocketURL string `json:"websocketURL"`
}

APIEndpointsConfig stores the API endpoint addresses

type BankTransaction

type BankTransaction struct {
	ReferenceNumber     string `json:"referenceNumber"`
	TransactionNumber   string `json:"transactionNumber"`
	PaymentInstructions string `json:"paymentInstructions"`
}

BankTransaction defines a related banking transaction

type CommunicationsConfig

type CommunicationsConfig struct {
	SlackConfig     SlackConfig     `json:"slack"`
	SMSGlobalConfig SMSGlobalConfig `json:"smsGlobal"`
	SMTPConfig      SMTPConfig      `json:"smtp"`
	TelegramConfig  TelegramConfig  `json:"telegram"`
}

CommunicationsConfig holds all the information needed for each enabled communication package

func (*CommunicationsConfig) IsAnyEnabled

func (c *CommunicationsConfig) IsAnyEnabled() bool

IsAnyEnabled returns whether or any any comms relayers are enabled

type Config

type Config struct {
	Name              string                  `json:"name"`
	EncryptConfig     int                     `json:"encryptConfig"`
	GlobalHTTPTimeout time.Duration           `json:"globalHTTPTimeout"`
	Database          database.Config         `json:"database"`
	Logging           log.Config              `json:"logging"`
	ConnectionMonitor ConnectionMonitorConfig `json:"connectionMonitor"`
	Profiler          Profiler                `json:"profiler"`
	NTPClient         NTPClientConfig         `json:"ntpclient"`
	GCTScript         gctscript.Config        `json:"gctscript"`
	Currency          CurrencyConfig          `json:"currencyConfig"`
	Communications    CommunicationsConfig    `json:"communications"`
	RemoteControl     RemoteControlConfig     `json:"remoteControl"`
	Portfolio         portfolio.Base          `json:"portfolioAddresses"`
	Exchanges         []ExchangeConfig        `json:"exchanges"`
	BankAccounts      []banking.Account       `json:"bankAccounts"`

	// Deprecated config settings, will be removed at a future date
	Webserver           *WebserverConfig          `json:"webserver,omitempty"`
	CurrencyPairFormat  *CurrencyPairFormatConfig `json:"currencyPairFormat,omitempty"`
	FiatDisplayCurrency *currency.Code            `json:"fiatDispayCurrency,omitempty"`
	Cryptocurrencies    *currency.Currencies      `json:"cryptocurrencies,omitempty"`
	SMS                 *SMSGlobalConfig          `json:"smsGlobal,omitempty"`
}

Config is the overarching object that holds all the information for prestart management of Portfolio, Communications, Webserver and Enabled Exchanges

func GetConfig

func GetConfig() *Config

GetConfig returns a pointer to a configuration object

func (*Config) AssetTypeEnabled

func (c *Config) AssetTypeEnabled(a asset.Item, exch string) (bool, error)

AssetTypeEnabled checks to see if the asset type is enabled in configuration

func (*Config) CheckBankAccountConfig

func (c *Config) CheckBankAccountConfig()

CheckBankAccountConfig checks all bank accounts to see if they are valid

func (*Config) CheckClientBankAccounts

func (c *Config) CheckClientBankAccounts()

CheckClientBankAccounts checks client bank details

func (*Config) CheckCommunicationsConfig

func (c *Config) CheckCommunicationsConfig()

CheckCommunicationsConfig checks to see if the variables are set correctly from config.json

func (*Config) CheckConfig

func (c *Config) CheckConfig() error

CheckConfig checks all config settings

func (*Config) CheckConnectionMonitorConfig

func (c *Config) CheckConnectionMonitorConfig()

CheckConnectionMonitorConfig checks and if zero value assigns default values

func (*Config) CheckCurrencyConfigValues

func (c *Config) CheckCurrencyConfigValues() error

CheckCurrencyConfigValues checks to see if the currency config values are correct or not

func (*Config) CheckExchangeConfigValues

func (c *Config) CheckExchangeConfigValues() error

CheckExchangeConfigValues returns configuation values for all enabled exchanges

func (*Config) CheckLoggerConfig

func (c *Config) CheckLoggerConfig() error

CheckLoggerConfig checks to see logger values are present and valid in config if not creates a default instance of the logger

func (*Config) CheckNTPConfig

func (c *Config) CheckNTPConfig()

CheckNTPConfig checks for missing or incorrectly configured NTPClient and recreates with known safe defaults

func (*Config) CheckPairConfigFormats

func (c *Config) CheckPairConfigFormats(exchName string) error

CheckPairConfigFormats checks to see if the pair config format is valid

func (*Config) CheckPairConsistency

func (c *Config) CheckPairConsistency(exchName string) error

CheckPairConsistency checks to see if the enabled pair exists in the available pairs list

func (*Config) CheckRemoteControlConfig

func (c *Config) CheckRemoteControlConfig()

CheckRemoteControlConfig checks to see if the old c.Webserver field is used and migrates the existing settings to the new RemoteControl struct

func (*Config) CountEnabledExchanges

func (c *Config) CountEnabledExchanges() int

CountEnabledExchanges returns the number of exchanges that are enabled.

func (*Config) DisableNTPCheck

func (c *Config) DisableNTPCheck(input io.Reader) (string, error)

DisableNTPCheck allows the user to change how they are prompted for timesync alerts

func (*Config) GetAllExchangeConfigs

func (c *Config) GetAllExchangeConfigs() []ExchangeConfig

GetAllExchangeConfigs returns all exchange configurations

func (*Config) GetAvailablePairs

func (c *Config) GetAvailablePairs(exchName string, assetType asset.Item) (currency.Pairs, error)

GetAvailablePairs returns a list of currency pairs for a specifc exchange

func (*Config) GetClientBankAccounts

func (c *Config) GetClientBankAccounts(exchangeName, targetCurrency string) (*banking.Account, error)

GetClientBankAccounts returns banking details used for a given exchange and currency

func (*Config) GetCommunicationsConfig

func (c *Config) GetCommunicationsConfig() CommunicationsConfig

GetCommunicationsConfig returns the communications configuration

func (*Config) GetCryptocurrencyProviderConfig

func (c *Config) GetCryptocurrencyProviderConfig() CryptocurrencyProvider

GetCryptocurrencyProviderConfig returns the communications configuration

func (*Config) GetCurrencyConfig

func (c *Config) GetCurrencyConfig() CurrencyConfig

GetCurrencyConfig returns currency configurations

func (*Config) GetCurrencyPairConfig

func (c *Config) GetCurrencyPairConfig(exchName string, assetType asset.Item) (*currency.PairStore, error)

GetCurrencyPairConfig returns currency pair config for the desired exchange and asset type

func (*Config) GetCurrencyPairDisplayConfig

func (c *Config) GetCurrencyPairDisplayConfig() *CurrencyPairFormatConfig

GetCurrencyPairDisplayConfig retrieves the currency pair display preference

func (*Config) GetDisabledExchanges

func (c *Config) GetDisabledExchanges() []string

GetDisabledExchanges returns a list of disabled exchanges

func (*Config) GetEnabledExchanges

func (c *Config) GetEnabledExchanges() []string

GetEnabledExchanges returns a list of enabled exchanges

func (*Config) GetEnabledPairs

func (c *Config) GetEnabledPairs(exchName string, assetType asset.Item) (currency.Pairs, error)

GetEnabledPairs returns a list of currency pairs for a specifc exchange

func (*Config) GetExchangeAssetTypes

func (c *Config) GetExchangeAssetTypes(exchName string) (asset.Items, error)

GetExchangeAssetTypes returns the exchanges supported asset types

func (*Config) GetExchangeBankAccounts

func (c *Config) GetExchangeBankAccounts(exchangeName, id, depositingCurrency string) (*banking.Account, error)

GetExchangeBankAccounts returns banking details associated with an exchange for depositing funds

func (*Config) GetExchangeConfig

func (c *Config) GetExchangeConfig(name string) (*ExchangeConfig, error)

GetExchangeConfig returns exchange configurations by its indivdual name

func (*Config) GetForexProvider

func (c *Config) GetForexProvider(name string) (currency.FXSettings, error)

GetForexProvider returns a forex provider configuration by its name

func (*Config) GetForexProviders

func (c *Config) GetForexProviders() []currency.FXSettings

GetForexProviders returns a list of available forex providers

func (*Config) GetPairFormat

func (c *Config) GetPairFormat(exchName string, assetType asset.Item) (currency.PairFormat, error)

GetPairFormat returns the exchanges pair config storage format

func (*Config) GetPrimaryForexProvider

func (c *Config) GetPrimaryForexProvider() string

GetPrimaryForexProvider returns the primary forex provider

func (*Config) LoadConfig

func (c *Config) LoadConfig(configPath string, dryrun bool) error

LoadConfig loads your configuration file into your configuration object

func (*Config) PromptForConfigEncryption

func (c *Config) PromptForConfigEncryption(configPath string, dryrun bool) bool

PromptForConfigEncryption asks for encryption key

func (*Config) PurgeExchangeAPICredentials

func (c *Config) PurgeExchangeAPICredentials()

PurgeExchangeAPICredentials purges the stored API credentials

func (*Config) ReadConfig

func (c *Config) ReadConfig(configPath string, dryrun bool) error

ReadConfig verifies and checks for encryption and verifies the unencrypted file contains JSON.

func (*Config) RemoveExchange

func (c *Config) RemoveExchange(exchName string) bool

RemoveExchange removes an exchange config

func (*Config) RetrieveConfigCurrencyPairs

func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool, assetType asset.Item) error

RetrieveConfigCurrencyPairs splits, assigns and verifies enabled currency pairs either cryptoCurrencies or fiatCurrencies

func (*Config) SaveConfig

func (c *Config) SaveConfig(configPath string, dryrun bool) error

SaveConfig saves your configuration to your desired path

func (*Config) SetPairs

func (c *Config) SetPairs(exchName string, assetType asset.Item, enabled bool, pairs currency.Pairs) error

SetPairs sets the exchanges currency pairs

func (*Config) SupportsExchangeAssetType

func (c *Config) SupportsExchangeAssetType(exchName string, assetType asset.Item) error

SupportsExchangeAssetType returns whether or not the exchange supports the supplied asset type

func (*Config) SupportsPair

func (c *Config) SupportsPair(exchName string, p currency.Pair, assetType asset.Item) bool

SupportsPair returns true or not whether the exchange supports the supplied pair

func (*Config) UpdateClientBankAccounts

func (c *Config) UpdateClientBankAccounts(bankCfg *banking.Account) error

UpdateClientBankAccounts updates the configuration for a bank

func (*Config) UpdateCommunicationsConfig

func (c *Config) UpdateCommunicationsConfig(config *CommunicationsConfig)

UpdateCommunicationsConfig sets a new updated version of a Communications configuration

func (*Config) UpdateConfig

func (c *Config) UpdateConfig(configPath string, newCfg *Config, dryrun bool) error

UpdateConfig updates the config with a supplied config file

func (*Config) UpdateCryptocurrencyProviderConfig

func (c *Config) UpdateCryptocurrencyProviderConfig(config CryptocurrencyProvider)

UpdateCryptocurrencyProviderConfig returns the communications configuration

func (*Config) UpdateExchangeBankAccounts

func (c *Config) UpdateExchangeBankAccounts(exchangeName string, bankCfg []banking.Account) error

UpdateExchangeBankAccounts updates the configuration for the associated exchange bank

func (*Config) UpdateExchangeConfig

func (c *Config) UpdateExchangeConfig(e *ExchangeConfig) error

UpdateExchangeConfig updates exchange configurations

type ConnectionMonitorConfig

type ConnectionMonitorConfig struct {
	DNSList          []string      `json:"preferredDNSList"`
	PublicDomainList []string      `json:"preferredDomainList"`
	CheckInterval    time.Duration `json:"checkInterval"`
}

ConnectionMonitorConfig defines the connection monitor variables to ensure that there is internet connectivity

type CryptocurrencyProvider

type CryptocurrencyProvider struct {
	Name        string `json:"name"`
	Enabled     bool   `json:"enabled"`
	Verbose     bool   `json:"verbose"`
	APIkey      string `json:"apiKey"`
	AccountPlan string `json:"accountPlan"`
}

CryptocurrencyProvider defines coinmarketcap tools

type CurrencyConfig

type CurrencyConfig struct {
	ForexProviders                []currency.FXSettings     `json:"forexProviders"`
	CryptocurrencyProvider        CryptocurrencyProvider    `json:"cryptocurrencyProvider"`
	Cryptocurrencies              currency.Currencies       `json:"cryptocurrencies"`
	CurrencyPairFormat            *CurrencyPairFormatConfig `json:"currencyPairFormat"`
	FiatDisplayCurrency           currency.Code             `json:"fiatDisplayCurrency"`
	CurrencyFileUpdateDuration    time.Duration             `json:"currencyFileUpdateDuration"`
	ForeignExchangeUpdateDuration time.Duration             `json:"foreignExchangeUpdateDuration"`
}

CurrencyConfig holds all the information needed for currency related manipulation

type CurrencyPairFormatConfig

type CurrencyPairFormatConfig struct {
	Uppercase bool   `json:"uppercase"`
	Delimiter string `json:"delimiter,omitempty"`
	Separator string `json:"separator,omitempty"`
	Index     string `json:"index,omitempty"`
}

CurrencyPairFormatConfig stores the users preferred currency pair display

type DepcrecatedRPCConfig

type DepcrecatedRPCConfig struct {
	Enabled       bool   `json:"enabled"`
	ListenAddress string `json:"listenAddress"`
}

DepcrecatedRPCConfig stores the deprecatedRPCConfig settings

type ExchangeConfig

type ExchangeConfig struct {
	Name                          string                 `json:"name"`
	Enabled                       bool                   `json:"enabled"`
	Verbose                       bool                   `json:"verbose"`
	UseSandbox                    bool                   `json:"useSandbox,omitempty"`
	HTTPTimeout                   time.Duration          `json:"httpTimeout"`
	HTTPUserAgent                 string                 `json:"httpUserAgent,omitempty"`
	HTTPDebugging                 bool                   `json:"httpDebugging,omitempty"`
	WebsocketResponseCheckTimeout time.Duration          `json:"websocketResponseCheckTimeout"`
	WebsocketResponseMaxLimit     time.Duration          `json:"websocketResponseMaxLimit"`
	WebsocketTrafficTimeout       time.Duration          `json:"websocketTrafficTimeout"`
	WebsocketOrderbookBufferLimit int                    `json:"websocketOrderbookBufferLimit"`
	ProxyAddress                  string                 `json:"proxyAddress,omitempty"`
	BaseCurrencies                currency.Currencies    `json:"baseCurrencies"`
	CurrencyPairs                 *currency.PairsManager `json:"currencyPairs"`
	API                           APIConfig              `json:"api"`
	Features                      *FeaturesConfig        `json:"features"`
	BankAccounts                  []banking.Account      `json:"bankAccounts,omitempty"`

	// Deprecated settings which will be removed in a future update
	AvailablePairs                   *currency.Pairs      `json:"availablePairs,omitempty"`
	EnabledPairs                     *currency.Pairs      `json:"enabledPairs,omitempty"`
	AssetTypes                       *string              `json:"assetTypes,omitempty"`
	PairsLastUpdated                 *int64               `json:"pairsLastUpdated,omitempty"`
	ConfigCurrencyPairFormat         *currency.PairFormat `json:"configCurrencyPairFormat,omitempty"`
	RequestCurrencyPairFormat        *currency.PairFormat `json:"requestCurrencyPairFormat,omitempty"`
	AuthenticatedAPISupport          *bool                `json:"authenticatedApiSupport,omitempty"`
	AuthenticatedWebsocketAPISupport *bool                `json:"authenticatedWebsocketApiSupport,omitempty"`
	APIKey                           *string              `json:"apiKey,omitempty"`
	APISecret                        *string              `json:"apiSecret,omitempty"`
	APIAuthPEMKeySupport             *bool                `json:"apiAuthPemKeySupport,omitempty"`
	APIAuthPEMKey                    *string              `json:"apiAuthPemKey,omitempty"`
	APIURL                           *string              `json:"apiUrl,omitempty"`
	APIURLSecondary                  *string              `json:"apiUrlSecondary,omitempty"`
	ClientID                         *string              `json:"clientId,omitempty"`
	SupportsAutoPairUpdates          *bool                `json:"supportsAutoPairUpdates,omitempty"`
	Websocket                        *bool                `json:"websocket,omitempty"`
	WebsocketURL                     *string              `json:"websocketUrl,omitempty"`
}

ExchangeConfig holds all the information needed for each enabled Exchange.

type FeaturesConfig

type FeaturesConfig struct {
	Supports FeaturesSupportedConfig `json:"supports"`
	Enabled  FeaturesEnabledConfig   `json:"enabled"`
}

FeaturesConfig stores the exchanges supported and enabled features

type FeaturesEnabledConfig

type FeaturesEnabledConfig struct {
	AutoPairUpdates bool `json:"autoPairUpdates"`
	Websocket       bool `json:"websocketAPI"`
}

FeaturesEnabledConfig stores the exchanges enabled features

type FeaturesSupportedConfig

type FeaturesSupportedConfig struct {
	REST                  bool              `json:"restAPI"`
	RESTCapabilities      protocol.Features `json:"restCapabilities,omitempty"`
	Websocket             bool              `json:"websocketAPI"`
	WebsocketCapabilities protocol.Features `json:"websocketCapabilities,omitempty"`
}

FeaturesSupportedConfig stores the exchanges supported features

type GRPCConfig

type GRPCConfig struct {
	Enabled                bool   `json:"enabled"`
	ListenAddress          string `json:"listenAddress"`
	GRPCProxyEnabled       bool   `json:"grpcProxyEnabled"`
	GRPCProxyListenAddress string `json:"grpcProxyListenAddress"`
}

GRPCConfig stores the gRPC settings

type NTPClientConfig

type NTPClientConfig struct {
	Level                     int            `json:"enabled"`
	Pool                      []string       `json:"pool"`
	AllowedDifference         *time.Duration `json:"allowedDifference"`
	AllowedNegativeDifference *time.Duration `json:"allowedNegativeDifference"`
}

NTPClientConfig defines a network time protocol configuration to allow for positive and negative differences

type Post

type Post struct {
	Data Config `json:"data"`
}

Post holds the bot configuration data

type Profiler

type Profiler struct {
	Enabled              bool `json:"enabled"`
	MutexProfileFraction int  `json:"mutex_profile_fraction"`
}

Profiler defines the profiler configuration to enable pprof

type RemoteControlConfig

type RemoteControlConfig struct {
	Username string `json:"username"`
	Password string `json:"password"`

	GRPC          GRPCConfig           `json:"gRPC"`
	DeprecatedRPC DepcrecatedRPCConfig `json:"deprecatedRPC"`
	WebsocketRPC  WebsocketRPCConfig   `json:"websocketRPC"`
}

RemoteControlConfig stores the RPC services config

type SMSContact

type SMSContact struct {
	Name    string `json:"name"`
	Number  string `json:"number"`
	Enabled bool   `json:"enabled"`
}

SMSContact stores the SMS contact info

type SMSGlobalConfig

type SMSGlobalConfig struct {
	Name     string       `json:"name"`
	From     string       `json:"from"`
	Enabled  bool         `json:"enabled"`
	Verbose  bool         `json:"verbose"`
	Username string       `json:"username"`
	Password string       `json:"password"`
	Contacts []SMSContact `json:"contacts"`
}

SMSGlobalConfig structure holds all the variables you need for instant messaging and broadcast used by SMSGlobal

type SMTPConfig

type SMTPConfig struct {
	Name            string `json:"name"`
	Enabled         bool   `json:"enabled"`
	Verbose         bool   `json:"verbose"`
	Host            string `json:"host"`
	Port            string `json:"port"`
	AccountName     string `json:"accountName"`
	AccountPassword string `json:"accountPassword"`
	From            string `json:"from"`
	RecipientList   string `json:"recipientList"`
}

SMTPConfig holds all variables to start and run the SMTP package

type SlackConfig

type SlackConfig struct {
	Name              string `json:"name"`
	Enabled           bool   `json:"enabled"`
	Verbose           bool   `json:"verbose"`
	TargetChannel     string `json:"targetChannel"`
	VerificationToken string `json:"verificationToken"`
}

SlackConfig holds all variables to start and run the Slack package

type TelegramConfig

type TelegramConfig struct {
	Name              string `json:"name"`
	Enabled           bool   `json:"enabled"`
	Verbose           bool   `json:"verbose"`
	VerificationToken string `json:"verificationToken"`
}

TelegramConfig holds all variables to start and run the Telegram package

type WebserverConfig

type WebserverConfig struct {
	Enabled                      bool   `json:"enabled"`
	AdminUsername                string `json:"adminUsername"`
	AdminPassword                string `json:"adminPassword"`
	ListenAddress                string `json:"listenAddress"`
	WebsocketConnectionLimit     int    `json:"websocketConnectionLimit"`
	WebsocketMaxAuthFailures     int    `json:"websocketMaxAuthFailures"`
	WebsocketAllowInsecureOrigin bool   `json:"websocketAllowInsecureOrigin"`
}

WebserverConfig stores the old webserver config

type WebsocketRPCConfig

type WebsocketRPCConfig struct {
	Enabled             bool   `json:"enabled"`
	ListenAddress       string `json:"listenAddress"`
	ConnectionLimit     int    `json:"connectionLimit"`
	MaxAuthFailures     int    `json:"maxAuthFailures"`
	AllowInsecureOrigin bool   `json:"allowInsecureOrigin"`
}

WebsocketRPCConfig stores the websocket config info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL