diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 23e3adad968..77f266332d9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -5,6 +5,7 @@ shazbert | https://github.com/shazbert gloriousCode | https://github.com/gloriousCode xtda | https://github.com/xtda ermalguni | https://github.com/ermalguni +dependabot-preview[bot] | https://github.com/apps/dependabot-preview vadimzhukck | https://github.com/vadimzhukck 140am | https://github.com/140am marcofranssen | https://github.com/marcofranssen @@ -14,6 +15,7 @@ crackcomm | https://github.com/crackcomm andreygrehov | https://github.com/andreygrehov bretep | https://github.com/bretep woshidama323 | https://github.com/woshidama323 +vazha | https://github.com/vazha gam-phon | https://github.com/gam-phon cornelk | https://github.com/cornelk if1live | https://github.com/if1live @@ -21,18 +23,19 @@ lozdog245 | https://github.com/lozdog245 soxipy | https://github.com/soxipy herenow | https://github.com/herenow blombard | https://github.com/blombard +Christian-Achilli | https://github.com/Christian-Achilli CodeLingoBot | https://github.com/CodeLingoBot CodeLingoTeam | https://github.com/CodeLingoTeam Daanikus | https://github.com/Daanikus daniel-cohen | https://github.com/daniel-cohen DirectX | https://github.com/DirectX frankzougc | https://github.com/frankzougc -starit | https://github.com/starit -Jimexist | https://github.com/Jimexist -lookfirst | https://github.com/lookfirst idoall | https://github.com/idoall mattkanwisher | https://github.com/mattkanwisher mKurrels | https://github.com/mKurrels m1kola | https://github.com/m1kola cavapoo2 | https://github.com/cavapoo2 zeldrinn | https://github.com/zeldrinn +starit | https://github.com/starit +Jimexist | https://github.com/Jimexist +lookfirst | https://github.com/lookfirst diff --git a/README.md b/README.md index 6852c71ff7a..76807263809 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ We are aiming to support the top 20 highest volume exchanges based off the [Coin + REST API support for all exchanges. + Websocket support for applicable exchanges. + Ability to turn off/on certain exchanges. -+ Communication packages (Slack, SMS via SMSGlobal, Telegram and SMTP) ++ Communication packages (Slack, SMS via SMSGlobal, Telegram and SMTP). + HTTP rate limiter package. + Unified API for exchange usage. + Customisation of HTTP client features including setting a proxy, user agent and adjusting transport settings. @@ -68,11 +68,11 @@ We are aiming to support the top 20 highest volume exchanges based off the [Coin + Connection monitor package. + gRPC service and JSON RPC proxy. See [gRPC service](/gctrpc/README.md). + gRPC client. See [gctcli](/cmd/gctcli/README.md). -+ Forex currency converter packages (CurrencyConverterAPI, CurrencyLayer, Fixer.io, OpenExchangeRates) ++ Forex currency converter packages (CurrencyConverterAPI, CurrencyLayer, Fixer.io, OpenExchangeRates). + Packages for handling currency pairs, tickers and orderbooks. + Portfolio management tool; fetches balances from supported exchanges and allows for custom address tracking. + Basic event trigger system. -+ Scripting support. See [gctscript](/gctscript/README.md) ++ Scripting support. See [gctscript](/gctscript/README.md). + WebGUI (discontinued). ## Planned Features @@ -126,7 +126,7 @@ copy config_example.json %APPDATA%\GoCryptoTrader\config.json If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** ## Binaries @@ -138,11 +138,12 @@ Binaries will be published once the codebase reaches a stable condition. |User|Contribution Amount| |--|--| -| [thrasher-](https://github.com/thrasher-) | 625 | -| [shazbert](https://github.com/shazbert) | 185 | -| [gloriousCode](https://github.com/gloriousCode) | 163 | -| [xtda](https://github.com/xtda) | 34 | +| [thrasher-](https://github.com/thrasher-) | 630 | +| [shazbert](https://github.com/shazbert) | 186 | +| [gloriousCode](https://github.com/gloriousCode) | 166 | +| [xtda](https://github.com/xtda) | 38 | | [ermalguni](https://github.com/ermalguni) | 14 | +| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 12 | | [vadimzhukck](https://github.com/vadimzhukck) | 10 | | [140am](https://github.com/140am) | 8 | | [marcofranssen](https://github.com/marcofranssen) | 8 | @@ -152,6 +153,7 @@ Binaries will be published once the codebase reaches a stable condition. | [andreygrehov](https://github.com/andreygrehov) | 2 | | [bretep](https://github.com/bretep) | 2 | | [woshidama323](https://github.com/woshidama323) | 2 | +| [vazha](https://github.com/vazha) | 2 | | [gam-phon](https://github.com/gam-phon) | 2 | | [cornelk](https://github.com/cornelk) | 2 | | [if1live](https://github.com/if1live) | 2 | @@ -159,18 +161,19 @@ Binaries will be published once the codebase reaches a stable condition. | [soxipy](https://github.com/soxipy) | 2 | | [herenow](https://github.com/herenow) | 2 | | [blombard](https://github.com/blombard) | 1 | +| [Christian-Achilli](https://github.com/Christian-Achilli) | 1 | | [CodeLingoBot](https://github.com/CodeLingoBot) | 1 | | [CodeLingoTeam](https://github.com/CodeLingoTeam) | 1 | | [Daanikus](https://github.com/Daanikus) | 1 | | [daniel-cohen](https://github.com/daniel-cohen) | 1 | | [DirectX](https://github.com/DirectX) | 1 | | [frankzougc](https://github.com/frankzougc) | 1 | -| [starit](https://github.com/starit) | 1 | -| [Jimexist](https://github.com/Jimexist) | 1 | -| [lookfirst](https://github.com/lookfirst) | 1 | | [idoall](https://github.com/idoall) | 1 | | [mattkanwisher](https://github.com/mattkanwisher) | 1 | | [mKurrels](https://github.com/mKurrels) | 1 | | [m1kola](https://github.com/m1kola) | 1 | | [cavapoo2](https://github.com/cavapoo2) | 1 | | [zeldrinn](https://github.com/zeldrinn) | 1 | +| [starit](https://github.com/starit) | 1 | +| [Jimexist](https://github.com/Jimexist) | 1 | +| [lookfirst](https://github.com/lookfirst) | 1 | diff --git a/cmd/config_builder/builder.go b/cmd/config_builder/builder.go index 8c15b5ba064..7f37453a483 100644 --- a/cmd/config_builder/builder.go +++ b/cmd/config_builder/builder.go @@ -31,14 +31,15 @@ func main() { log.Println("Done.") var cfgs []config.ExchangeConfig - for x := range engine.Bot.Exchanges { + exchanges := engine.GetExchanges() + for x := range exchanges { var cfg *config.ExchangeConfig - cfg, err = engine.Bot.Exchanges[x].GetDefaultConfig() + cfg, err = exchanges[x].GetDefaultConfig() if err != nil { log.Printf("Failed to get exchanges default config. Err: %s", err) continue } - log.Printf("Adding %s", engine.Bot.Exchanges[x].GetName()) + log.Printf("Adding %s", exchanges[x].GetName()) cfgs = append(cfgs, *cfg) } diff --git a/cmd/documentation/README.md b/cmd/documentation/README.md index e6fb031fa12..38cce5cb47a 100644 --- a/cmd/documentation/README.md +++ b/cmd/documentation/README.md @@ -94,4 +94,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/cmd/documentation/cmd_templates/documentation.tmpl b/cmd/documentation/cmd_templates/documentation.tmpl index 1f6d4956200..d0ce9a5afa0 100644 --- a/cmd/documentation/cmd_templates/documentation.tmpl +++ b/cmd/documentation/cmd_templates/documentation.tmpl @@ -59,5 +59,5 @@ upper := strings.ToUpper(testString) ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/common_templates/common_readme.tmpl b/cmd/documentation/common_templates/common_readme.tmpl index 64200f7c8b4..ad8e05e2b36 100644 --- a/cmd/documentation/common_templates/common_readme.tmpl +++ b/cmd/documentation/common_templates/common_readme.tmpl @@ -19,5 +19,5 @@ upper := strings.ToUpper(testString) ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/base.tmpl b/cmd/documentation/communications_templates/base.tmpl index 70dad8e3fb4..83234f20c98 100644 --- a/cmd/documentation/communications_templates/base.tmpl +++ b/cmd/documentation/communications_templates/base.tmpl @@ -8,5 +8,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/comms.tmpl b/cmd/documentation/communications_templates/comms.tmpl index be209ecbd7b..2ebf1c0461a 100644 --- a/cmd/documentation/communications_templates/comms.tmpl +++ b/cmd/documentation/communications_templates/comms.tmpl @@ -22,5 +22,5 @@ for more details ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/slack.tmpl b/cmd/documentation/communications_templates/slack.tmpl index 0ffefe3a0ee..beb2f571342 100644 --- a/cmd/documentation/communications_templates/slack.tmpl +++ b/cmd/documentation/communications_templates/slack.tmpl @@ -51,5 +51,5 @@ via Slack: ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/smsglobal.tmpl b/cmd/documentation/communications_templates/smsglobal.tmpl index 1f8201aa728..ef61349b180 100644 --- a/cmd/documentation/communications_templates/smsglobal.tmpl +++ b/cmd/documentation/communications_templates/smsglobal.tmpl @@ -41,5 +41,5 @@ err := s.Connect ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/smtp.tmpl b/cmd/documentation/communications_templates/smtp.tmpl index b02f5b57b18..71bad8789a0 100644 --- a/cmd/documentation/communications_templates/smtp.tmpl +++ b/cmd/documentation/communications_templates/smtp.tmpl @@ -43,5 +43,5 @@ err := s.Connect ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/communications_templates/telegram.tmpl b/cmd/documentation/communications_templates/telegram.tmpl index 95803b34d07..f240b405199 100644 --- a/cmd/documentation/communications_templates/telegram.tmpl +++ b/cmd/documentation/communications_templates/telegram.tmpl @@ -51,5 +51,5 @@ via Telegram: ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/config_templates/config_readme.tmpl b/cmd/documentation/config_templates/config_readme.tmpl index 0c50f36c24c..3f94dd2ade3 100644 --- a/cmd/documentation/config_templates/config_readme.tmpl +++ b/cmd/documentation/config_templates/config_readme.tmpl @@ -213,5 +213,5 @@ servers are configured by the pool array and attempted first to last allowedDiff ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/currency_pair_readme.tmpl b/cmd/documentation/currency_templates/currency_pair_readme.tmpl index 65377d8ba60..cf3e36000d4 100644 --- a/cmd/documentation/currency_templates/currency_pair_readme.tmpl +++ b/cmd/documentation/currency_templates/currency_pair_readme.tmpl @@ -18,5 +18,5 @@ bitcoinString := newPair.GetFirstCurrency ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/currency_readme.tmpl b/cmd/documentation/currency_templates/currency_readme.tmpl index f43191629c5..197badfa9cd 100644 --- a/cmd/documentation/currency_templates/currency_readme.tmpl +++ b/cmd/documentation/currency_templates/currency_readme.tmpl @@ -10,5 +10,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/currency_symbol_readme.tmpl b/cmd/documentation/currency_templates/currency_symbol_readme.tmpl index 571996efcaa..b5bbd35859d 100644 --- a/cmd/documentation/currency_templates/currency_symbol_readme.tmpl +++ b/cmd/documentation/currency_templates/currency_symbol_readme.tmpl @@ -17,5 +17,5 @@ symbol := symbol.GetSymbolByCurrencyName(chineseYen) ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/currency_translation_readme.tmpl b/cmd/documentation/currency_templates/currency_translation_readme.tmpl index 2cd4f6605df..30344bdb9de 100644 --- a/cmd/documentation/currency_templates/currency_translation_readme.tmpl +++ b/cmd/documentation/currency_templates/currency_translation_readme.tmpl @@ -16,5 +16,5 @@ b := translation.HasTranslation("BTC") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx.tmpl b/cmd/documentation/currency_templates/fx.tmpl index bbdea857c6c..36b4df964dd 100644 --- a/cmd/documentation/currency_templates/fx.tmpl +++ b/cmd/documentation/currency_templates/fx.tmpl @@ -9,5 +9,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx_base.tmpl b/cmd/documentation/currency_templates/fx_base.tmpl index f0fdcf19d46..577a6895e54 100644 --- a/cmd/documentation/currency_templates/fx_base.tmpl +++ b/cmd/documentation/currency_templates/fx_base.tmpl @@ -7,5 +7,5 @@ providers. ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx_currencyconverterapi.tmpl b/cmd/documentation/currency_templates/fx_currencyconverterapi.tmpl index d6da5a203c6..ba85b06c88b 100644 --- a/cmd/documentation/currency_templates/fx_currencyconverterapi.tmpl +++ b/cmd/documentation/currency_templates/fx_currencyconverterapi.tmpl @@ -36,5 +36,5 @@ mapstringfloat, err := c.GetRates("USD", "EUR,CHY") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx_currencylayer.tmpl b/cmd/documentation/currency_templates/fx_currencylayer.tmpl index b2654fd91a1..ce302b4915b 100644 --- a/cmd/documentation/currency_templates/fx_currencylayer.tmpl +++ b/cmd/documentation/currency_templates/fx_currencylayer.tmpl @@ -36,5 +36,5 @@ mapstringfloat, err := c.GetRates("USD", "EUR,CHY") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx_exchangeratesapi.tmpl b/cmd/documentation/currency_templates/fx_exchangeratesapi.tmpl index 4983030565e..2bb9b4109d4 100644 --- a/cmd/documentation/currency_templates/fx_exchangeratesapi.tmpl +++ b/cmd/documentation/currency_templates/fx_exchangeratesapi.tmpl @@ -36,5 +36,5 @@ mapstringfloat, err := c.GetRates("USD", "EUR,CHY") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{- end}} \ No newline at end of file diff --git a/cmd/documentation/currency_templates/fx_fixer.tmpl b/cmd/documentation/currency_templates/fx_fixer.tmpl index 60a1e4dd561..bec87721ee4 100644 --- a/cmd/documentation/currency_templates/fx_fixer.tmpl +++ b/cmd/documentation/currency_templates/fx_fixer.tmpl @@ -36,5 +36,5 @@ mapstringfloat, err := c.GetRates("USD", "EUR,CHY") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/currency_templates/fx_openexchangerates.tmpl b/cmd/documentation/currency_templates/fx_openexchangerates.tmpl index 372e19364f0..084841a78bb 100644 --- a/cmd/documentation/currency_templates/fx_openexchangerates.tmpl +++ b/cmd/documentation/currency_templates/fx_openexchangerates.tmpl @@ -36,5 +36,5 @@ mapstringfloat, err := c.GetRates("USD", "EUR,CHY") ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/documentation.go b/cmd/documentation/documentation.go index 1b7fe352a7d..343408c3f81 100644 --- a/cmd/documentation/documentation.go +++ b/cmd/documentation/documentation.go @@ -100,11 +100,12 @@ type DocumentationDetails struct { // Attributes defines specific documentation attributes when a template is // executed type Attributes struct { - Name string - Contributors []Contributor - NameURL string - Year int - CapitalName string + Name string + Contributors []Contributor + NameURL string + Year int + CapitalName string + DonationAddress string } func main() { @@ -199,6 +200,21 @@ func main() { URL: "https://github.com/zeldrinn", Contributions: 1, }, + { + Login: "starit", + URL: "https://github.com/starit", + Contributions: 1, + }, + { + Login: "Jimexist", + URL: "https://github.com/Jimexist", + Contributions: 1, + }, + { + Login: "lookfirst", + URL: "https://github.com/lookfirst", + Contributions: 1, + }, }...) if verbose { @@ -378,11 +394,12 @@ func GetContributorList(repo string) ([]Contributor, error) { // GetDocumentationAttributes returns specific attributes for a file template func GetDocumentationAttributes(packageName string, contributors []Contributor) Attributes { return Attributes{ - Name: GetPackageName(packageName, false), - Contributors: contributors, - NameURL: GetGoDocURL(packageName), - Year: time.Now().Year(), - CapitalName: GetPackageName(packageName, true), + Name: GetPackageName(packageName, false), + Contributors: contributors, + NameURL: GetGoDocURL(packageName), + Year: time.Now().Year(), + CapitalName: GetPackageName(packageName, true), + DonationAddress: core.BitcoinDonationAddress, } } diff --git a/cmd/documentation/events_templates/events_readme.tmpl b/cmd/documentation/events_templates/events_readme.tmpl index b9a9367cb7c..8df6c89caa3 100644 --- a/cmd/documentation/events_templates/events_readme.tmpl +++ b/cmd/documentation/events_templates/events_readme.tmpl @@ -6,5 +6,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/alphapoint.tmpl b/cmd/documentation/exchanges_templates/alphapoint.tmpl index a6129338425..9a1af70ff94 100644 --- a/cmd/documentation/exchanges_templates/alphapoint.tmpl +++ b/cmd/documentation/exchanges_templates/alphapoint.tmpl @@ -10,5 +10,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/binance.tmpl b/cmd/documentation/exchanges_templates/binance.tmpl index aadea33f3a0..61fab3417c8 100644 --- a/cmd/documentation/exchanges_templates/binance.tmpl +++ b/cmd/documentation/exchanges_templates/binance.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bitfinex.tmpl b/cmd/documentation/exchanges_templates/bitfinex.tmpl index 57a2c9f582c..17a576be156 100644 --- a/cmd/documentation/exchanges_templates/bitfinex.tmpl +++ b/cmd/documentation/exchanges_templates/bitfinex.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bitflyer.tmpl b/cmd/documentation/exchanges_templates/bitflyer.tmpl index 1e6259c837d..397a901c445 100644 --- a/cmd/documentation/exchanges_templates/bitflyer.tmpl +++ b/cmd/documentation/exchanges_templates/bitflyer.tmpl @@ -101,5 +101,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bithumb.tmpl b/cmd/documentation/exchanges_templates/bithumb.tmpl index 849398ccc6b..e855031f71b 100644 --- a/cmd/documentation/exchanges_templates/bithumb.tmpl +++ b/cmd/documentation/exchanges_templates/bithumb.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bitmex.tmpl b/cmd/documentation/exchanges_templates/bitmex.tmpl index 69668b4c10f..1577378be9c 100644 --- a/cmd/documentation/exchanges_templates/bitmex.tmpl +++ b/cmd/documentation/exchanges_templates/bitmex.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bitstamp.tmpl b/cmd/documentation/exchanges_templates/bitstamp.tmpl index ee1cadd0bed..96ff356a6dc 100644 --- a/cmd/documentation/exchanges_templates/bitstamp.tmpl +++ b/cmd/documentation/exchanges_templates/bitstamp.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/bittrex.tmpl b/cmd/documentation/exchanges_templates/bittrex.tmpl index 154094645fe..5a750fb2366 100644 --- a/cmd/documentation/exchanges_templates/bittrex.tmpl +++ b/cmd/documentation/exchanges_templates/bittrex.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/btcmarkets.tmpl b/cmd/documentation/exchanges_templates/btcmarkets.tmpl index 4d81557e88e..e86213399ab 100644 --- a/cmd/documentation/exchanges_templates/btcmarkets.tmpl +++ b/cmd/documentation/exchanges_templates/btcmarkets.tmpl @@ -95,5 +95,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/btse.tmpl b/cmd/documentation/exchanges_templates/btse.tmpl index 9df4638f57f..566922dc93e 100644 --- a/cmd/documentation/exchanges_templates/btse.tmpl +++ b/cmd/documentation/exchanges_templates/btse.tmpl @@ -95,5 +95,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/coinbasepro.tmpl b/cmd/documentation/exchanges_templates/coinbasepro.tmpl index 05f0b049930..679d7ec3195 100644 --- a/cmd/documentation/exchanges_templates/coinbasepro.tmpl +++ b/cmd/documentation/exchanges_templates/coinbasepro.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/coinbene.tmpl b/cmd/documentation/exchanges_templates/coinbene.tmpl index 7dc3b4d43e8..658803a96df 100644 --- a/cmd/documentation/exchanges_templates/coinbene.tmpl +++ b/cmd/documentation/exchanges_templates/coinbene.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/coinut.tmpl b/cmd/documentation/exchanges_templates/coinut.tmpl index 8b6f644ccdd..0f66b921c15 100644 --- a/cmd/documentation/exchanges_templates/coinut.tmpl +++ b/cmd/documentation/exchanges_templates/coinut.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/exchanges_orderbook_readme.tmpl b/cmd/documentation/exchanges_templates/exchanges_orderbook_readme.tmpl index 047d7c92cda..de3bf54444c 100644 --- a/cmd/documentation/exchanges_templates/exchanges_orderbook_readme.tmpl +++ b/cmd/documentation/exchanges_templates/exchanges_orderbook_readme.tmpl @@ -37,5 +37,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/exchanges_readme.tmpl b/cmd/documentation/exchanges_templates/exchanges_readme.tmpl index 5de950708b5..9a65a979793 100644 --- a/cmd/documentation/exchanges_templates/exchanges_readme.tmpl +++ b/cmd/documentation/exchanges_templates/exchanges_readme.tmpl @@ -9,5 +9,5 @@ implementation ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/exchanges_stats_readme.tmpl b/cmd/documentation/exchanges_templates/exchanges_stats_readme.tmpl index 16dfdc12af6..d8d1542b8c3 100644 --- a/cmd/documentation/exchanges_templates/exchanges_stats_readme.tmpl +++ b/cmd/documentation/exchanges_templates/exchanges_stats_readme.tmpl @@ -10,5 +10,5 @@ enabled exchanges i.e. ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/exchanges_ticker_readme.tmpl b/cmd/documentation/exchanges_templates/exchanges_ticker_readme.tmpl index afd210aa055..1133028be04 100644 --- a/cmd/documentation/exchanges_templates/exchanges_ticker_readme.tmpl +++ b/cmd/documentation/exchanges_templates/exchanges_ticker_readme.tmpl @@ -38,5 +38,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/exmo.tmpl b/cmd/documentation/exchanges_templates/exmo.tmpl index 4378a6dc9b6..e9407e408bd 100644 --- a/cmd/documentation/exchanges_templates/exmo.tmpl +++ b/cmd/documentation/exchanges_templates/exmo.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/gateio.tmpl b/cmd/documentation/exchanges_templates/gateio.tmpl index 2f311ac18f9..b698606fa8d 100644 --- a/cmd/documentation/exchanges_templates/gateio.tmpl +++ b/cmd/documentation/exchanges_templates/gateio.tmpl @@ -101,5 +101,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/gemini.tmpl b/cmd/documentation/exchanges_templates/gemini.tmpl index 9810785b2a8..c5065f8d352 100644 --- a/cmd/documentation/exchanges_templates/gemini.tmpl +++ b/cmd/documentation/exchanges_templates/gemini.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/hitbtc.tmpl b/cmd/documentation/exchanges_templates/hitbtc.tmpl index 624be46d9b8..10e50d3588d 100644 --- a/cmd/documentation/exchanges_templates/hitbtc.tmpl +++ b/cmd/documentation/exchanges_templates/hitbtc.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/huobi.tmpl b/cmd/documentation/exchanges_templates/huobi.tmpl index f85ccd95000..fde4149f3a7 100644 --- a/cmd/documentation/exchanges_templates/huobi.tmpl +++ b/cmd/documentation/exchanges_templates/huobi.tmpl @@ -101,5 +101,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/itbit.tmpl b/cmd/documentation/exchanges_templates/itbit.tmpl index 908c0e6df26..8ca31f0f018 100644 --- a/cmd/documentation/exchanges_templates/itbit.tmpl +++ b/cmd/documentation/exchanges_templates/itbit.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/kraken.tmpl b/cmd/documentation/exchanges_templates/kraken.tmpl index 3a6ec6a3e10..f8a307b9d54 100644 --- a/cmd/documentation/exchanges_templates/kraken.tmpl +++ b/cmd/documentation/exchanges_templates/kraken.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/lakebtc.tmpl b/cmd/documentation/exchanges_templates/lakebtc.tmpl index 28a0e9c3361..110c18908fd 100644 --- a/cmd/documentation/exchanges_templates/lakebtc.tmpl +++ b/cmd/documentation/exchanges_templates/lakebtc.tmpl @@ -95,5 +95,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/lbank.tmpl b/cmd/documentation/exchanges_templates/lbank.tmpl index 890fb91f74a..58c3d21a15a 100644 --- a/cmd/documentation/exchanges_templates/lbank.tmpl +++ b/cmd/documentation/exchanges_templates/lbank.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/localbitcoins.tmpl b/cmd/documentation/exchanges_templates/localbitcoins.tmpl index 8526c267b2b..81944cf6efc 100644 --- a/cmd/documentation/exchanges_templates/localbitcoins.tmpl +++ b/cmd/documentation/exchanges_templates/localbitcoins.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/nonce.tmpl b/cmd/documentation/exchanges_templates/nonce.tmpl index b969c4abc32..55bcb005234 100644 --- a/cmd/documentation/exchanges_templates/nonce.tmpl +++ b/cmd/documentation/exchanges_templates/nonce.tmpl @@ -6,5 +6,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/okcoin.tmpl b/cmd/documentation/exchanges_templates/okcoin.tmpl index ec16b998891..2f483f6e95a 100644 --- a/cmd/documentation/exchanges_templates/okcoin.tmpl +++ b/cmd/documentation/exchanges_templates/okcoin.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/okex.tmpl b/cmd/documentation/exchanges_templates/okex.tmpl index 9117ce49203..188524deff4 100644 --- a/cmd/documentation/exchanges_templates/okex.tmpl +++ b/cmd/documentation/exchanges_templates/okex.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/orders.tmpl b/cmd/documentation/exchanges_templates/orders.tmpl index e593a6b3196..1a77b1b6b69 100644 --- a/cmd/documentation/exchanges_templates/orders.tmpl +++ b/cmd/documentation/exchanges_templates/orders.tmpl @@ -9,5 +9,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/poloniex.tmpl b/cmd/documentation/exchanges_templates/poloniex.tmpl index eae1386c239..c10399fa9fb 100644 --- a/cmd/documentation/exchanges_templates/poloniex.tmpl +++ b/cmd/documentation/exchanges_templates/poloniex.tmpl @@ -102,5 +102,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/request.tmpl b/cmd/documentation/exchanges_templates/request.tmpl index c1523dbf105..ff76abdefa1 100644 --- a/cmd/documentation/exchanges_templates/request.tmpl +++ b/cmd/documentation/exchanges_templates/request.tmpl @@ -7,5 +7,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/yobit.tmpl b/cmd/documentation/exchanges_templates/yobit.tmpl index 5b9acc9ed94..193ac27c989 100644 --- a/cmd/documentation/exchanges_templates/yobit.tmpl +++ b/cmd/documentation/exchanges_templates/yobit.tmpl @@ -94,5 +94,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/exchanges_templates/zb.tmpl b/cmd/documentation/exchanges_templates/zb.tmpl index 9dd6bb0e22d..39f1862fa1e 100644 --- a/cmd/documentation/exchanges_templates/zb.tmpl +++ b/cmd/documentation/exchanges_templates/zb.tmpl @@ -101,5 +101,5 @@ if err != nil { ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/portfolio_templates/portfolio_readme.tmpl b/cmd/documentation/portfolio_templates/portfolio_readme.tmpl index 03dec8c0c7d..c21eb2914bc 100644 --- a/cmd/documentation/portfolio_templates/portfolio_readme.tmpl +++ b/cmd/documentation/portfolio_templates/portfolio_readme.tmpl @@ -6,5 +6,5 @@ ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/root_templates/root_readme.tmpl b/cmd/documentation/root_templates/root_readme.tmpl index ce68ab2b9a3..a6be5e00a18 100644 --- a/cmd/documentation/root_templates/root_readme.tmpl +++ b/cmd/documentation/root_templates/root_readme.tmpl @@ -59,7 +59,7 @@ We are aiming to support the top 20 highest volume exchanges based off the [Coin + REST API support for all exchanges. + Websocket support for applicable exchanges. + Ability to turn off/on certain exchanges. -+ Communication packages (Slack, SMS via SMSGlobal, Telegram and SMTP) ++ Communication packages (Slack, SMS via SMSGlobal, Telegram and SMTP). + HTTP rate limiter package. + Unified API for exchange usage. + Customisation of HTTP client features including setting a proxy, user agent and adjusting transport settings. @@ -69,10 +69,11 @@ We are aiming to support the top 20 highest volume exchanges based off the [Coin + Connection monitor package. + gRPC service and JSON RPC proxy. See [gRPC service](/gctrpc/README.md). + gRPC client. See [gctcli](/cmd/gctcli/README.md). -+ Forex currency converter packages (CurrencyConverterAPI, CurrencyLayer, Fixer.io, OpenExchangeRates) ++ Forex currency converter packages (CurrencyConverterAPI, CurrencyLayer, Fixer.io, OpenExchangeRates). + Packages for handling currency pairs, tickers and orderbooks. + Portfolio management tool; fetches balances from supported exchanges and allows for custom address tracking. + Basic event trigger system. ++ Scripting support. See [gctscript](/gctscript/README.md). + WebGUI (discontinued). ## Planned Features @@ -120,13 +121,7 @@ copy config_example.json %APPDATA%\GoCryptoTrader\config.json + Make any neccessary changes to the `config.json` file. + Run the `gocryptotrader` binary file inside your GOPATH bin folder. -## Donations - - - -If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: - -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +{{template "donations" .}} ## Binaries diff --git a/cmd/documentation/sub_templates/donations.tmpl b/cmd/documentation/sub_templates/donations.tmpl index 3fd5682fc35..ae3dfb1b62c 100644 --- a/cmd/documentation/sub_templates/donations.tmpl +++ b/cmd/documentation/sub_templates/donations.tmpl @@ -5,5 +5,5 @@ If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***{{.DonationAddress}}*** {{- end}} diff --git a/cmd/documentation/testdata_templates/testdata_readme.tmpl b/cmd/documentation/testdata_templates/testdata_readme.tmpl index 68a08abf586..b8f6c36d97a 100644 --- a/cmd/documentation/testdata_templates/testdata_readme.tmpl +++ b/cmd/documentation/testdata_templates/testdata_readme.tmpl @@ -6,5 +6,5 @@ This folder contains a configuration test file for non-deployement test params. It also has the code coverage test files that allow us to monitor our entire codebase, click this link for more information [https://codecov.io/](https://codecov.io/). {{template "contributions"}} -{{template "donations" -}} -{{end}} +{{template "donations" .}} +{{- end}} diff --git a/cmd/documentation/tools_templates/config_tool.tmpl b/cmd/documentation/tools_templates/config_tool.tmpl index 6721b0685b2..1d83e58a0a7 100644 --- a/cmd/documentation/tools_templates/config_tool.tmpl +++ b/cmd/documentation/tools_templates/config_tool.tmpl @@ -16,5 +16,5 @@ go run ./config.go -infile path/of/config.json -outfile path/of/new/config.json ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/documentation_tool.tmpl b/cmd/documentation/tools_templates/documentation_tool.tmpl index c9bae26d7fe..6d189a8b45a 100644 --- a/cmd/documentation/tools_templates/documentation_tool.tmpl +++ b/cmd/documentation/tools_templates/documentation_tool.tmpl @@ -19,5 +19,5 @@ go run gocryptotrader.go -r ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/exchange_tool.tmpl b/cmd/documentation/tools_templates/exchange_tool.tmpl index fcc918cf96c..b58e1df93b6 100644 --- a/cmd/documentation/tools_templates/exchange_tool.tmpl +++ b/cmd/documentation/tools_templates/exchange_tool.tmpl @@ -19,5 +19,5 @@ go run exchange_template.go -name Bitmex -ws -rest ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/huobi_auth_tool.tmpl b/cmd/documentation/tools_templates/huobi_auth_tool.tmpl index d19a959cac3..ed60a3e2b94 100644 --- a/cmd/documentation/tools_templates/huobi_auth_tool.tmpl +++ b/cmd/documentation/tools_templates/huobi_auth_tool.tmpl @@ -16,5 +16,5 @@ go run main.go ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/portfolio_tool.tmpl b/cmd/documentation/tools_templates/portfolio_tool.tmpl index 3b3372feebf..a8b6410a206 100644 --- a/cmd/documentation/tools_templates/portfolio_tool.tmpl +++ b/cmd/documentation/tools_templates/portfolio_tool.tmpl @@ -14,5 +14,5 @@ go run portfolio.go -infile path/to/config.json -key AESDecryptionKey ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/tools.tmpl b/cmd/documentation/tools_templates/tools.tmpl index 69463c6ce92..b19a167ae5f 100644 --- a/cmd/documentation/tools_templates/tools.tmpl +++ b/cmd/documentation/tools_templates/tools.tmpl @@ -12,5 +12,5 @@ This folder contains an assortment of tools. Please see individual tool's README file {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/tools_templates/websocket_client_tool.tmpl b/cmd/documentation/tools_templates/websocket_client_tool.tmpl index 534b6693f2b..2f2f69c8c5a 100644 --- a/cmd/documentation/tools_templates/websocket_client_tool.tmpl +++ b/cmd/documentation/tools_templates/websocket_client_tool.tmpl @@ -14,5 +14,5 @@ go run main.go ### Please click GoDocs chevron above to view current GoDoc information for this package {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/documentation/web_templates/web_readme.tmpl b/cmd/documentation/web_templates/web_readme.tmpl index e686189c6c5..fc0dd223c2d 100644 --- a/cmd/documentation/web_templates/web_readme.tmpl +++ b/cmd/documentation/web_templates/web_readme.tmpl @@ -62,5 +62,5 @@ Voila! You can use your Angular + Electron app in a local development environmen |Maxime GRIS|https://github.com/maximegris |Angular4 + Electron Base| |Shazbert|https://github.com/shazbert |Initial designs| {{template "contributions"}} -{{template "donations"}} +{{template "donations" .}} {{end}} diff --git a/cmd/exchange_wrapper_coverage/main.go b/cmd/exchange_wrapper_coverage/main.go index 36f41b55e0d..897a4b96698 100644 --- a/cmd/exchange_wrapper_coverage/main.go +++ b/cmd/exchange_wrapper_coverage/main.go @@ -46,11 +46,12 @@ func main() { log.Printf("Testing exchange wrappers..") results := make(map[string][]string) wg = sync.WaitGroup{} - for x := range engine.Bot.Exchanges { + exchanges := engine.GetExchanges() + for x := range exchanges { wg.Add(1) go func(num int) { - name := engine.Bot.Exchanges[num].GetName() - results[name] = testWrappers(engine.Bot.Exchanges[num]) + name := exchanges[num].GetName() + results[name] = testWrappers(exchanges[num]) wg.Done() }(x) } diff --git a/cmd/exchange_wrapper_issues/main.go b/cmd/exchange_wrapper_issues/main.go index 52a1b99a0d7..86a3031722e 100644 --- a/cmd/exchange_wrapper_issues/main.go +++ b/cmd/exchange_wrapper_issues/main.go @@ -88,8 +88,9 @@ func main() { log.Println("Testing exchange wrappers..") var exchangeResponses []ExchangeResponses - for x := range engine.Bot.Exchanges { - base := engine.Bot.Exchanges[x].GetBase() + exchs := engine.GetExchanges() + for x := range exchs { + base := exchs[x].GetBase() if !base.Config.Enabled { log.Printf("Exchange %v not enabled, skipping", base.GetName()) continue @@ -101,13 +102,13 @@ func main() { wg.Add(1) go func(num int) { - name := engine.Bot.Exchanges[num].GetName() + name := exchs[num].GetName() authenticated := setExchangeAPIKeys(name, wrapperConfig.Exchanges, base) wrapperResult := ExchangeResponses{ ID: fmt.Sprintf("Exchange%v", num), ExchangeName: name, APIKeysSet: authenticated, - AssetPairResponses: testWrappers(engine.Bot.Exchanges[num], base, &wrapperConfig), + AssetPairResponses: testWrappers(exchs[num], base, &wrapperConfig), } for i := range wrapperResult.AssetPairResponses { wrapperResult.ErrorCount += wrapperResult.AssetPairResponses[i].ErrorCount diff --git a/common/README.md b/common/README.md index d7c634d0b80..c711ff07720 100644 --- a/common/README.md +++ b/common/README.md @@ -54,4 +54,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/common/cache/README.md b/common/cache/README.md index 8703f2f9805..12552a88f77 100644 --- a/common/cache/README.md +++ b/common/cache/README.md @@ -63,5 +63,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/common/file/file.go b/common/file/file.go index ec3ed6447bc..8d550062d87 100644 --- a/common/file/file.go +++ b/common/file/file.go @@ -5,12 +5,19 @@ import ( "io" "io/ioutil" "os" + "path/filepath" ) // Write writes selected data to a file or returns an error if it fails. This // func also ensures that all files are set to this permission (only rw access // for the running user and the group the user is a member of) func Write(file string, data []byte) error { + basePath := filepath.Dir(file) + if !Exists(basePath) { + if err := os.MkdirAll(basePath, 0770); err != nil { + return err + } + } return ioutil.WriteFile(file, data, 0770) } @@ -45,3 +52,9 @@ func Move(sourcePath, destPath string) error { return os.Remove(sourcePath) } + +// Exists returns whether or not a file or path exists +func Exists(name string) bool { + _, err := os.Stat(name) + return !os.IsNotExist(err) +} diff --git a/common/file/file_test.go b/common/file/file_test.go index f0db7d1f298..cb969ab0783 100644 --- a/common/file/file_test.go +++ b/common/file/file_test.go @@ -26,7 +26,8 @@ func TestWrite(t *testing.T) { } var tests []testTable - testFile := filepath.Join(os.TempDir(), "gcttest.txt") + tempDir := filepath.Join(os.TempDir(), "gct-temp") + testFile := filepath.Join(tempDir, "gcttest.txt") switch runtime.GOOS { case "windows": tests = []testTable{ @@ -46,6 +47,10 @@ func TestWrite(t *testing.T) { t.Errorf("Test %d failed, unexpected err %s\n", x, err) } } + + if err := os.RemoveAll(tempDir); err != nil { + t.Errorf("unable to remove temp test dir %s, manual deletion required", tempDir) + } } func TestMove(t *testing.T) { @@ -104,3 +109,19 @@ func TestMove(t *testing.T) { } } } + +func TestExists(t *testing.T) { + if e := Exists("non-existent"); e { + t.Error("non-existent file should not exist") + } + tmpFile := filepath.Join(os.TempDir(), "gct-test.txt") + if err := ioutil.WriteFile(tmpFile, []byte("hello world"), os.ModeAppend); err != nil { + t.Fatal(err) + } + if e := Exists(tmpFile); !e { + t.Error("file should exist") + } + if err := os.Remove(tmpFile); err != nil { + t.Errorf("unable to remove %s, manual deletion is required", tmpFile) + } +} diff --git a/communications/README.md b/communications/README.md index f67815b389f..0a01dc30ad9 100644 --- a/communications/README.md +++ b/communications/README.md @@ -57,5 +57,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/communications/base/README.md b/communications/base/README.md index dd3655be97f..932fe20c87e 100644 --- a/communications/base/README.md +++ b/communications/base/README.md @@ -43,4 +43,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/communications/slack/README.md b/communications/slack/README.md index ad448029c6a..8c9954cbd37 100644 --- a/communications/slack/README.md +++ b/communications/slack/README.md @@ -86,4 +86,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/communications/smsglobal/README.md b/communications/smsglobal/README.md index 938ef324fb2..7ad8f6b1d73 100644 --- a/communications/smsglobal/README.md +++ b/communications/smsglobal/README.md @@ -76,4 +76,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/communications/smtpservice/README.md b/communications/smtpservice/README.md index ea2256c6c7a..4553a65601b 100644 --- a/communications/smtpservice/README.md +++ b/communications/smtpservice/README.md @@ -78,5 +78,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/communications/telegram/README.md b/communications/telegram/README.md index 097085396cf..970530674e7 100644 --- a/communications/telegram/README.md +++ b/communications/telegram/README.md @@ -86,4 +86,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/config/README.md b/config/README.md index e3026299ba6..80212cc6dfb 100644 --- a/config/README.md +++ b/config/README.md @@ -248,4 +248,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/config/config.go b/config/config.go index 848bdd0de91..c6bda2a8c36 100644 --- a/config/config.go +++ b/config/config.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "io/ioutil" - "os" "path/filepath" "runtime" "strconv" @@ -1336,11 +1335,9 @@ func (c *Config) CheckConnectionMonitorConfig() { // Helpful for printing application usage func DefaultFilePath() string { f := filepath.Join(common.GetDefaultDataDir(runtime.GOOS), File) - _, err := os.Stat(f) - if os.IsNotExist(err) { + if !file.Exists(f) { encFile := filepath.Join(common.GetDefaultDataDir(runtime.GOOS), EncryptedFile) - _, err = os.Stat(encFile) - if !os.IsNotExist(err) { + if file.Exists(encFile) { return encFile } } @@ -1390,12 +1387,10 @@ func GetFilePath(configfile string) (string, error) { // First upgrade the old dir config file if it exists to the corresponding // new one for x := range oldDirs { - _, err := os.Stat(oldDirs[x]) - if os.IsNotExist(err) { + if !file.Exists(oldDirs[x]) { continue } - _, err = os.Stat(newDirs[x]) - if !os.IsNotExist(err) { + if file.Exists(newDirs[x]) { log.Warnf(log.ConfigMgr, "config.json file found in root dir and gct dir; cannot overwrite, defaulting to gct dir config.json at %s", newDirs[x]) @@ -1424,8 +1419,7 @@ func GetFilePath(configfile string) (string, error) { // Secondly check to see if the new config file extension is correct or not for x := range newDirs { - _, err := os.Stat(newDirs[x]) - if os.IsNotExist(err) { + if !file.Exists(newDirs[x]) { continue } diff --git a/config/config_encryption.go b/config/config_encryption.go index 51f9464da39..bf32e0e1457 100644 --- a/config/config_encryption.go +++ b/config/config_encryption.go @@ -9,10 +9,10 @@ import ( "errors" "fmt" "io" + "log" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/common/crypto" - log "github.com/thrasher-corp/gocryptotrader/logger" "golang.org/x/crypto/scrypt" ) @@ -35,7 +35,7 @@ var ( // PromptForConfigEncryption asks for encryption key func (c *Config) PromptForConfigEncryption(configPath string, dryrun bool) bool { - fmt.Println("Would you like to encrypt your config file (y/n)?") + log.Println("Would you like to encrypt your config file (y/n)?") input := "" _, err := fmt.Scanln(&input) @@ -47,7 +47,7 @@ func (c *Config) PromptForConfigEncryption(configPath string, dryrun bool) bool c.EncryptConfig = fileEncryptionDisabled err := c.SaveConfig(configPath, dryrun) if err != nil { - log.Errorf(log.ConfigMgr, "cannot save config %s", err) + log.Printf("Cannot save config. Error: %s\n", err) } return false } @@ -59,7 +59,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) { var cryptoKey []byte for { - fmt.Println("Please enter in your password: ") + log.Println("Please enter in your password: ") pwPrompt := func(i *[]byte) error { _, err := fmt.Scanln(i) return err @@ -77,7 +77,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) { } var p2 []byte - fmt.Println("Please re-enter your password: ") + log.Println("Please re-enter your password: ") err = pwPrompt(&p2) if err != nil { return nil, err @@ -87,7 +87,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) { cryptoKey = p1 break } - fmt.Printf("Passwords did not match, please try again.") + log.Println("Passwords did not match, please try again.") } return cryptoKey, nil } diff --git a/core/donation.go b/core/donation.go new file mode 100644 index 00000000000..9c4c189e886 --- /dev/null +++ b/core/donation.go @@ -0,0 +1,4 @@ +package core + +// BitcoinDonationAddress is the GoCryptoTrader BTC donation address +const BitcoinDonationAddress = "bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc" diff --git a/currency/README.md b/currency/README.md index a7a75f08569..dbc6c98510d 100644 --- a/currency/README.md +++ b/currency/README.md @@ -45,4 +45,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/README.md b/currency/forexprovider/README.md index aaad1106284..bf8aef4410d 100644 --- a/currency/forexprovider/README.md +++ b/currency/forexprovider/README.md @@ -44,4 +44,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/base/README.md b/currency/forexprovider/base/README.md index 30b5e70787e..7e8f859f6e4 100644 --- a/currency/forexprovider/base/README.md +++ b/currency/forexprovider/base/README.md @@ -42,4 +42,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/currencyconverterapi/README.md b/currency/forexprovider/currencyconverterapi/README.md index cca5b1d3cd7..fcd1c89876b 100644 --- a/currency/forexprovider/currencyconverterapi/README.md +++ b/currency/forexprovider/currencyconverterapi/README.md @@ -71,4 +71,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/currencylayer/README.md b/currency/forexprovider/currencylayer/README.md index 37d76211d18..1970d0c399e 100644 --- a/currency/forexprovider/currencylayer/README.md +++ b/currency/forexprovider/currencylayer/README.md @@ -71,4 +71,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/exchangeratesapi.io/README.md b/currency/forexprovider/exchangeratesapi.io/README.md index 793f546639b..111f66d2ab2 100644 --- a/currency/forexprovider/exchangeratesapi.io/README.md +++ b/currency/forexprovider/exchangeratesapi.io/README.md @@ -71,4 +71,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** \ No newline at end of file +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** \ No newline at end of file diff --git a/currency/forexprovider/fixer.io/README.md b/currency/forexprovider/fixer.io/README.md index 135caff4c6d..ce39cd3720a 100644 --- a/currency/forexprovider/fixer.io/README.md +++ b/currency/forexprovider/fixer.io/README.md @@ -71,4 +71,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/currency/forexprovider/openexchangerates/README.md b/currency/forexprovider/openexchangerates/README.md index 83f7fac324b..dc785126085 100644 --- a/currency/forexprovider/openexchangerates/README.md +++ b/currency/forexprovider/openexchangerates/README.md @@ -71,4 +71,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/database/README.md b/database/README.md index 89b35f48c6b..d5f04ac17ae 100644 --- a/database/README.md +++ b/database/README.md @@ -161,5 +161,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/engine/engine.go b/engine/engine.go index 8067b5618d6..5aa2a4ab5cc 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -4,6 +4,7 @@ import ( "errors" "flag" "fmt" + "log" "path/filepath" "runtime" "strings" @@ -15,10 +16,9 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/currency/coinmarketcap" "github.com/thrasher-corp/gocryptotrader/dispatch" - exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/request" gctscript "github.com/thrasher-corp/gocryptotrader/gctscript/vm" - log "github.com/thrasher-corp/gocryptotrader/logger" + gctlog "github.com/thrasher-corp/gocryptotrader/logger" "github.com/thrasher-corp/gocryptotrader/portfolio" "github.com/thrasher-corp/gocryptotrader/utils" ) @@ -28,7 +28,6 @@ import ( type Engine struct { Config *config.Config Portfolio *portfolio.Base - Exchanges []exchange.IBotExchange ExchangeCurrencyPairManager *ExchangeCurrencyPairSyncer NTPManager ntpManager ConnectionManager connectionManager @@ -37,6 +36,7 @@ type Engine struct { OrderManager orderManager PortfolioManager portfolioManager CommsManager commsManager + exchangeManager exchangeManager DepositAddressManager *DepositAddressManager Settings Settings Uptime time.Time @@ -77,7 +77,7 @@ func NewFromSettings(settings *Settings) (*Engine, error) { return nil, err } - log.Debugf(log.Global, "Loading config file %s..\n", filePath) + log.Printf("Loading config file %s..\n", filePath) err = b.Config.LoadConfig(filePath, settings.EnableDryRun) if err != nil { return nil, fmt.Errorf("failed to load config. Err: %s", err) @@ -89,8 +89,9 @@ func NewFromSettings(settings *Settings) (*Engine, error) { } if *b.Config.Logging.Enabled { - log.SetupGlobalLogger() - log.SetupSubLoggers(b.Config.Logging.SubLoggers) + gctlog.SetupGlobalLogger() + gctlog.SetupSubLoggers(b.Config.Logging.SubLoggers) + gctlog.Infoln(gctlog.Global, "Logger initialised.") } b.Settings.ConfigFile = filePath @@ -114,12 +115,19 @@ func ValidateSettings(b *Engine, s *Settings) { b.Settings.EnableDryRun = s.EnableDryRun b.Settings.EnableAllExchanges = s.EnableAllExchanges b.Settings.EnableAllPairs = s.EnableAllPairs - b.Settings.EnablePortfolioManager = s.EnablePortfolioManager b.Settings.EnableCoinmarketcapAnalysis = s.EnableCoinmarketcapAnalysis b.Settings.EnableDatabaseManager = s.EnableDatabaseManager b.Settings.EnableGCTScriptManager = s.EnableGCTScriptManager b.Settings.MaxVirtualMachines = s.MaxVirtualMachines b.Settings.EnableDispatcher = s.EnableDispatcher + b.Settings.EnablePortfolioManager = s.EnablePortfolioManager + if b.Settings.EnablePortfolioManager { + if b.Settings.PortfolioManagerDelay != time.Duration(0) && s.PortfolioManagerDelay > 0 { + b.Settings.PortfolioManagerDelay = s.PortfolioManagerDelay + } else { + b.Settings.PortfolioManagerDelay = PortfolioSleepDelay + } + } if flagSet["grpc"] { b.Settings.EnableGRPC = s.EnableGRPC @@ -226,64 +234,65 @@ func ValidateSettings(b *Engine, s *Settings) { // PrintSettings returns the engine settings func PrintSettings(s *Settings) { - log.Debugln(log.Global) - log.Debugf(log.Global, "ENGINE SETTINGS") - log.Debugf(log.Global, "- CORE SETTINGS:") - log.Debugf(log.Global, "\t Verbose mode: %v", s.Verbose) - log.Debugf(log.Global, "\t Enable dry run mode: %v", s.EnableDryRun) - log.Debugf(log.Global, "\t Enable all exchanges: %v", s.EnableAllExchanges) - log.Debugf(log.Global, "\t Enable all pairs: %v", s.EnableAllPairs) - log.Debugf(log.Global, "\t Enable coinmarketcap analaysis: %v", s.EnableCoinmarketcapAnalysis) - log.Debugf(log.Global, "\t Enable portfolio manager: %v", s.EnablePortfolioManager) - log.Debugf(log.Global, "\t Enable gPRC: %v", s.EnableGRPC) - log.Debugf(log.Global, "\t Enable gRPC Proxy: %v", s.EnableGRPCProxy) - log.Debugf(log.Global, "\t Enable websocket RPC: %v", s.EnableWebsocketRPC) - log.Debugf(log.Global, "\t Enable deprecated RPC: %v", s.EnableDeprecatedRPC) - log.Debugf(log.Global, "\t Enable comms relayer: %v", s.EnableCommsRelayer) - log.Debugf(log.Global, "\t Enable event manager: %v", s.EnableEventManager) - log.Debugf(log.Global, "\t Event manager sleep delay: %v", s.EventManagerDelay) - log.Debugf(log.Global, "\t Enable order manager: %v", s.EnableOrderManager) - log.Debugf(log.Global, "\t Enable exchange sync manager: %v", s.EnableExchangeSyncManager) - log.Debugf(log.Global, "\t Enable deposit address manager: %v\n", s.EnableDepositAddressManager) - log.Debugf(log.Global, "\t Enable websocket routine: %v\n", s.EnableWebsocketRoutine) - log.Debugf(log.Global, "\t Enable NTP client: %v", s.EnableNTPClient) - log.Debugf(log.Global, "\t Enable Database manager: %v", s.EnableDatabaseManager) - log.Debugf(log.Global, "\t Enable dispatcher: %v", s.EnableDispatcher) - log.Debugf(log.Global, "\t Dispatch package max worker amount: %d", s.DispatchMaxWorkerAmount) - log.Debugf(log.Global, "\t Dispatch package jobs limit: %d", s.DispatchJobsLimit) - log.Debugf(log.Global, "- EXCHANGE SYNCER SETTINGS:\n") - log.Debugf(log.Global, "\t Exchange sync continuously: %v\n", s.SyncContinuously) - log.Debugf(log.Global, "\t Exchange sync workers: %v\n", s.SyncWorkers) - log.Debugf(log.Global, "\t Enable ticker syncing: %v\n", s.EnableTickerSyncing) - log.Debugf(log.Global, "\t Enable orderbook syncing: %v\n", s.EnableOrderbookSyncing) - log.Debugf(log.Global, "\t Enable trade syncing: %v\n", s.EnableTradeSyncing) - log.Debugf(log.Global, "\t Exchange sync timeout: %v\n", s.SyncTimeout) - log.Debugf(log.Global, "- FOREX SETTINGS:") - log.Debugf(log.Global, "\t Enable currency conveter: %v", s.EnableCurrencyConverter) - log.Debugf(log.Global, "\t Enable currency layer: %v", s.EnableCurrencyLayer) - log.Debugf(log.Global, "\t Enable fixer: %v", s.EnableFixer) - log.Debugf(log.Global, "\t Enable OpenExchangeRates: %v", s.EnableOpenExchangeRates) - log.Debugf(log.Global, "- EXCHANGE SETTINGS:") - log.Debugf(log.Global, "\t Enable exchange auto pair updates: %v", s.EnableExchangeAutoPairUpdates) - log.Debugf(log.Global, "\t Disable all exchange auto pair updates: %v", s.DisableExchangeAutoPairUpdates) - log.Debugf(log.Global, "\t Enable exchange websocket support: %v", s.EnableExchangeWebsocketSupport) - log.Debugf(log.Global, "\t Enable exchange verbose mode: %v", s.EnableExchangeVerbose) - log.Debugf(log.Global, "\t Enable exchange HTTP rate limiter: %v", s.EnableExchangeHTTPRateLimiter) - log.Debugf(log.Global, "\t Enable exchange HTTP debugging: %v", s.EnableExchangeHTTPDebugging) - log.Debugf(log.Global, "\t Exchange max HTTP request jobs: %v", s.MaxHTTPRequestJobsLimit) - log.Debugf(log.Global, "\t Exchange HTTP request timeout retry amount: %v", s.RequestTimeoutRetryAttempts) - log.Debugf(log.Global, "\t Exchange HTTP timeout: %v", s.ExchangeHTTPTimeout) - log.Debugf(log.Global, "\t Exchange HTTP user agent: %v", s.ExchangeHTTPUserAgent) - log.Debugf(log.Global, "\t Exchange HTTP proxy: %v\n", s.ExchangeHTTPProxy) - log.Debugf(log.Global, "- GCTSCRIPT SETTINGS: ") - log.Debugf(log.Global, "\t Enable GCTScript manager: %v", s.EnableGCTScriptManager) - log.Debugf(log.Global, "\t GCTScript max virtual machines: %v", s.MaxVirtualMachines) - log.Debugf(log.Global, "- COMMON SETTINGS:") - log.Debugf(log.Global, "\t Global HTTP timeout: %v", s.GlobalHTTPTimeout) - log.Debugf(log.Global, "\t Global HTTP user agent: %v", s.GlobalHTTPUserAgent) - log.Debugf(log.Global, "\t Global HTTP proxy: %v", s.ExchangeHTTPProxy) - - log.Debugln(log.Global) + gctlog.Debugln(gctlog.Global) + gctlog.Debugf(gctlog.Global, "ENGINE SETTINGS") + gctlog.Debugf(gctlog.Global, "- CORE SETTINGS:") + gctlog.Debugf(gctlog.Global, "\t Verbose mode: %v", s.Verbose) + gctlog.Debugf(gctlog.Global, "\t Enable dry run mode: %v", s.EnableDryRun) + gctlog.Debugf(gctlog.Global, "\t Enable all exchanges: %v", s.EnableAllExchanges) + gctlog.Debugf(gctlog.Global, "\t Enable all pairs: %v", s.EnableAllPairs) + gctlog.Debugf(gctlog.Global, "\t Enable coinmarketcap analaysis: %v", s.EnableCoinmarketcapAnalysis) + gctlog.Debugf(gctlog.Global, "\t Enable portfolio manager: %v", s.EnablePortfolioManager) + gctlog.Debugf(gctlog.Global, "\t Portfolio manager sleep delay: %v\n", s.PortfolioManagerDelay) + gctlog.Debugf(gctlog.Global, "\t Enable gPRC: %v", s.EnableGRPC) + gctlog.Debugf(gctlog.Global, "\t Enable gRPC Proxy: %v", s.EnableGRPCProxy) + gctlog.Debugf(gctlog.Global, "\t Enable websocket RPC: %v", s.EnableWebsocketRPC) + gctlog.Debugf(gctlog.Global, "\t Enable deprecated RPC: %v", s.EnableDeprecatedRPC) + gctlog.Debugf(gctlog.Global, "\t Enable comms relayer: %v", s.EnableCommsRelayer) + gctlog.Debugf(gctlog.Global, "\t Enable event manager: %v", s.EnableEventManager) + gctlog.Debugf(gctlog.Global, "\t Event manager sleep delay: %v", s.EventManagerDelay) + gctlog.Debugf(gctlog.Global, "\t Enable order manager: %v", s.EnableOrderManager) + gctlog.Debugf(gctlog.Global, "\t Enable exchange sync manager: %v", s.EnableExchangeSyncManager) + gctlog.Debugf(gctlog.Global, "\t Enable deposit address manager: %v\n", s.EnableDepositAddressManager) + gctlog.Debugf(gctlog.Global, "\t Enable websocket routine: %v\n", s.EnableWebsocketRoutine) + gctlog.Debugf(gctlog.Global, "\t Enable NTP client: %v", s.EnableNTPClient) + gctlog.Debugf(gctlog.Global, "\t Enable Database manager: %v", s.EnableDatabaseManager) + gctlog.Debugf(gctlog.Global, "\t Enable dispatcher: %v", s.EnableDispatcher) + gctlog.Debugf(gctlog.Global, "\t Dispatch package max worker amount: %d", s.DispatchMaxWorkerAmount) + gctlog.Debugf(gctlog.Global, "\t Dispatch package jobs limit: %d", s.DispatchJobsLimit) + gctlog.Debugf(gctlog.Global, "- EXCHANGE SYNCER SETTINGS:\n") + gctlog.Debugf(gctlog.Global, "\t Exchange sync continuously: %v\n", s.SyncContinuously) + gctlog.Debugf(gctlog.Global, "\t Exchange sync workers: %v\n", s.SyncWorkers) + gctlog.Debugf(gctlog.Global, "\t Enable ticker syncing: %v\n", s.EnableTickerSyncing) + gctlog.Debugf(gctlog.Global, "\t Enable orderbook syncing: %v\n", s.EnableOrderbookSyncing) + gctlog.Debugf(gctlog.Global, "\t Enable trade syncing: %v\n", s.EnableTradeSyncing) + gctlog.Debugf(gctlog.Global, "\t Exchange sync timeout: %v\n", s.SyncTimeout) + gctlog.Debugf(gctlog.Global, "- FOREX SETTINGS:") + gctlog.Debugf(gctlog.Global, "\t Enable currency conveter: %v", s.EnableCurrencyConverter) + gctlog.Debugf(gctlog.Global, "\t Enable currency layer: %v", s.EnableCurrencyLayer) + gctlog.Debugf(gctlog.Global, "\t Enable fixer: %v", s.EnableFixer) + gctlog.Debugf(gctlog.Global, "\t Enable OpenExchangeRates: %v", s.EnableOpenExchangeRates) + gctlog.Debugf(gctlog.Global, "- EXCHANGE SETTINGS:") + gctlog.Debugf(gctlog.Global, "\t Enable exchange auto pair updates: %v", s.EnableExchangeAutoPairUpdates) + gctlog.Debugf(gctlog.Global, "\t Disable all exchange auto pair updates: %v", s.DisableExchangeAutoPairUpdates) + gctlog.Debugf(gctlog.Global, "\t Enable exchange websocket support: %v", s.EnableExchangeWebsocketSupport) + gctlog.Debugf(gctlog.Global, "\t Enable exchange verbose mode: %v", s.EnableExchangeVerbose) + gctlog.Debugf(gctlog.Global, "\t Enable exchange HTTP rate limiter: %v", s.EnableExchangeHTTPRateLimiter) + gctlog.Debugf(gctlog.Global, "\t Enable exchange HTTP debugging: %v", s.EnableExchangeHTTPDebugging) + gctlog.Debugf(gctlog.Global, "\t Exchange max HTTP request jobs: %v", s.MaxHTTPRequestJobsLimit) + gctlog.Debugf(gctlog.Global, "\t Exchange HTTP request timeout retry amount: %v", s.RequestTimeoutRetryAttempts) + gctlog.Debugf(gctlog.Global, "\t Exchange HTTP timeout: %v", s.ExchangeHTTPTimeout) + gctlog.Debugf(gctlog.Global, "\t Exchange HTTP user agent: %v", s.ExchangeHTTPUserAgent) + gctlog.Debugf(gctlog.Global, "\t Exchange HTTP proxy: %v\n", s.ExchangeHTTPProxy) + gctlog.Debugf(gctlog.Global, "- GCTSCRIPT SETTINGS: ") + gctlog.Debugf(gctlog.Global, "\t Enable GCTScript manager: %v", s.EnableGCTScriptManager) + gctlog.Debugf(gctlog.Global, "\t GCTScript max virtual machines: %v", s.MaxVirtualMachines) + gctlog.Debugf(gctlog.Global, "- COMMON SETTINGS:") + gctlog.Debugf(gctlog.Global, "\t Global HTTP timeout: %v", s.GlobalHTTPTimeout) + gctlog.Debugf(gctlog.Global, "\t Global HTTP user agent: %v", s.GlobalHTTPUserAgent) + gctlog.Debugf(gctlog.Global, "\t Global HTTP proxy: %v", s.ExchangeHTTPProxy) + + gctlog.Debugln(gctlog.Global) } // Start starts the engine @@ -294,37 +303,37 @@ func (e *Engine) Start() error { if e.Settings.EnableDatabaseManager { if err := e.DatabaseManager.Start(); err != nil { - log.Errorf(log.Global, "Database manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "Database manager unable to start: %v", err) } } if e.Settings.EnableDispatcher { if err := dispatch.Start(e.Settings.DispatchMaxWorkerAmount, e.Settings.DispatchJobsLimit); err != nil { - log.Errorf(log.DispatchMgr, "Dispatcher unable to start: %v", err) + gctlog.Errorf(gctlog.DispatchMgr, "Dispatcher unable to start: %v", err) } } // Sets up internet connectivity monitor if e.Settings.EnableConnectivityMonitor { if err := e.ConnectionManager.Start(); err != nil { - log.Errorf(log.Global, "Connection manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "Connection manager unable to start: %v", err) } } if e.Settings.EnableNTPClient { if err := e.NTPManager.Start(); err != nil { - log.Errorf(log.Global, "NTP manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "NTP manager unable to start: %v", err) } } e.Uptime = time.Now() - log.Debugf(log.Global, "Bot '%s' started.\n", e.Config.Name) - log.Debugf(log.Global, "Using data dir: %s\n", e.Settings.DataDir) + gctlog.Debugf(gctlog.Global, "Bot '%s' started.\n", e.Config.Name) + gctlog.Debugf(gctlog.Global, "Using data dir: %s\n", e.Settings.DataDir) if *e.Config.Logging.Enabled && strings.Contains(e.Config.Logging.Output, "file") { - log.Debugf(log.Global, "Using log file: %s\n", - filepath.Join(log.LogPath, e.Config.Logging.LoggerFileConfig.FileName)) + gctlog.Debugf(gctlog.Global, "Using log file: %s\n", + filepath.Join(gctlog.LogPath, e.Config.Logging.LoggerFileConfig.FileName)) } - log.Debugf(log.Global, + gctlog.Debugf(gctlog.Global, "Using %d out of %d logical processors for runtime performance\n", runtime.GOMAXPROCS(-1), runtime.NumCPU()) @@ -333,24 +342,24 @@ func (e *Engine) Start() error { enabledExchanges = len(e.Config.Exchanges) } - log.Debugln(log.Global, "EXCHANGE COVERAGE") - log.Debugf(log.Global, "\t Available Exchanges: %d. Enabled Exchanges: %d.\n", + gctlog.Debugln(gctlog.Global, "EXCHANGE COVERAGE") + gctlog.Debugf(gctlog.Global, "\t Available Exchanges: %d. Enabled Exchanges: %d.\n", len(e.Config.Exchanges), enabledExchanges) if e.Settings.ExchangePurgeCredentials { - log.Debugln(log.Global, "Purging exchange API credentials.") + gctlog.Debugln(gctlog.Global, "Purging exchange API credentials.") e.Config.PurgeExchangeAPICredentials() } - log.Debugln(log.Global, "Setting up exchanges..") + gctlog.Debugln(gctlog.Global, "Setting up exchanges..") SetupExchanges() - if len(Bot.Exchanges) == 0 { + if Bot.exchangeManager.Len() == 0 { return errors.New("no exchanges are loaded") } if e.Settings.EnableCommsRelayer { if err := e.CommsManager.Start(); err != nil { - log.Errorf(log.Global, "Communications manager unable to start: %v\n", err) + gctlog.Errorf(gctlog.Global, "Communications manager unable to start: %v\n", err) } } @@ -377,7 +386,7 @@ func (e *Engine) Start() error { e.Settings.DataDir, e.Settings.Verbose) if err != nil { - log.Errorf(log.Global, "currency updater system failed to start %v", err) + gctlog.Errorf(gctlog.Global, "Currency updater system failed to start %v", err) } if e.Settings.EnableGRPC { @@ -395,7 +404,7 @@ func (e *Engine) Start() error { if e.Settings.EnablePortfolioManager { if err = e.PortfolioManager.Start(); err != nil { - log.Errorf(log.Global, "Fund manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "Fund manager unable to start: %v", err) } } @@ -406,7 +415,7 @@ func (e *Engine) Start() error { if e.Settings.EnableOrderManager { if err = e.OrderManager.Start(); err != nil { - log.Errorf(log.Global, "Order manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "Order manager unable to start: %v", err) } } @@ -423,7 +432,7 @@ func (e *Engine) Start() error { e.ExchangeCurrencyPairManager, err = NewCurrencyPairSyncer(exchangeSyncCfg) if err != nil { - log.Warnf(log.Global, "Unable to initialise exchange currency pair syncer. Err: %s", err) + gctlog.Warnf(gctlog.Global, "Unable to initialise exchange currency pair syncer. Err: %s", err) } else { go e.ExchangeCurrencyPairManager.Start() } @@ -440,7 +449,7 @@ func (e *Engine) Start() error { if e.Settings.EnableGCTScriptManager { if e.Config.GCTScript.Enabled { if err := e.GctScriptManager.Start(); err != nil { - log.Errorf(log.Global, "GCTScript manager unable to start: %v", err) + gctlog.Errorf(gctlog.Global, "GCTScript manager unable to start: %v", err) } } } @@ -450,7 +459,7 @@ func (e *Engine) Start() error { // Stop correctly shuts down engine saving configuration files func (e *Engine) Stop() { - log.Debugln(log.Global, "Engine shutting down..") + gctlog.Debugln(gctlog.Global, "Engine shutting down..") if len(portfolio.Portfolio.Addresses) != 0 { e.Config.Portfolio = portfolio.Portfolio @@ -458,64 +467,64 @@ func (e *Engine) Stop() { if e.GctScriptManager.Started() { if err := e.GctScriptManager.Stop(); err != nil { - log.Errorf(log.Global, "GCTScript manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "GCTScript manager unable to stop. Error: %v", err) } } if e.OrderManager.Started() { if err := e.OrderManager.Stop(); err != nil { - log.Errorf(log.Global, "Order manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "Order manager unable to stop. Error: %v", err) } } if e.NTPManager.Started() { if err := e.NTPManager.Stop(); err != nil { - log.Errorf(log.Global, "NTP manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "NTP manager unable to stop. Error: %v", err) } } if e.CommsManager.Started() { if err := e.CommsManager.Stop(); err != nil { - log.Errorf(log.Global, "Communication manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "Communication manager unable to stop. Error: %v", err) } } if e.PortfolioManager.Started() { if err := e.PortfolioManager.Stop(); err != nil { - log.Errorf(log.Global, "Fund manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "Fund manager unable to stop. Error: %v", err) } } if e.ConnectionManager.Started() { if err := e.ConnectionManager.Stop(); err != nil { - log.Errorf(log.Global, "Connection manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "Connection manager unable to stop. Error: %v", err) } } if e.DatabaseManager.Started() { if err := e.DatabaseManager.Stop(); err != nil { - log.Errorf(log.Global, "Database manager unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.Global, "Database manager unable to stop. Error: %v", err) } } if dispatch.IsRunning() { if err := dispatch.Stop(); err != nil { - log.Errorf(log.DispatchMgr, "Dispatch system unable to stop. Error: %v", err) + gctlog.Errorf(gctlog.DispatchMgr, "Dispatch system unable to stop. Error: %v", err) } } if !e.Settings.EnableDryRun { err := e.Config.SaveConfig(e.Settings.ConfigFile, false) if err != nil { - log.Errorln(log.Global, "Unable to save config.") + gctlog.Errorln(gctlog.Global, "Unable to save config.") } else { - log.Debugln(log.Global, "Config file saved successfully.") + gctlog.Debugln(gctlog.Global, "Config file saved successfully.") } } // Wait for services to gracefully shutdown e.ServicesWG.Wait() - err := log.CloseLogger() + err := gctlog.CloseLogger() if err != nil { - fmt.Printf("Failed to close logger %v", err) + log.Printf("Failed to close logger. Error: %v\n", err) } } diff --git a/engine/engine_types.go b/engine/engine_types.go index ac32fcdf82e..d2995b0faa3 100644 --- a/engine/engine_types.go +++ b/engine/engine_types.go @@ -17,6 +17,7 @@ type Settings struct { EnableAllPairs bool EnableCoinmarketcapAnalysis bool EnablePortfolioManager bool + PortfolioManagerDelay time.Duration EnableGRPC bool EnableGRPCProxy bool EnableWebsocketRPC bool diff --git a/engine/exchange.go b/engine/exchange.go index 1bea531988e..35f1f766643 100644 --- a/engine/exchange.go +++ b/engine/exchange.go @@ -45,6 +45,11 @@ var ( ErrExchangeFailedToLoad = errors.New("exchange failed to load") ) +type exchangeManager struct { + m sync.Mutex + exchanges map[string]exchange.IBotExchange +} + func dryrunParamInteraction(param string) { if !Bot.Settings.CheckParamInteraction { return @@ -59,67 +64,91 @@ func dryrunParamInteraction(param string) { } } -// GetExchangeByName returns an exchange given an exchange name -func GetExchangeByName(exchName string) exchange.IBotExchange { - for x := range Bot.Exchanges { - if strings.EqualFold(Bot.Exchanges[x].GetName(), exchName) { - return Bot.Exchanges[x] - } +func (e *exchangeManager) add(exch exchange.IBotExchange) { + e.m.Lock() + if e.exchanges == nil { + e.exchanges = make(map[string]exchange.IBotExchange) } - return nil + e.exchanges[strings.ToLower(exch.GetName())] = exch + e.m.Unlock() } -// ReloadExchange loads an exchange config by name -func ReloadExchange(name string) error { - if len(Bot.Exchanges) == 0 { - return ErrNoExchangesLoaded +func (e *exchangeManager) getExchanges() []exchange.IBotExchange { + if e.Len() == 0 { + return nil } - e := GetExchangeByName(name) - if e == nil { - return ErrExchangeNotFound + e.m.Lock() + defer e.m.Unlock() + var exchs []exchange.IBotExchange + for x := range e.exchanges { + exchs = append(exchs, e.exchanges[x]) } + return exchs +} - exchCfg, err := Bot.Config.GetExchangeConfig(name) - if err != nil { - return err +func (e *exchangeManager) removeExchange(exchName string) error { + if e.Len() == 0 { + return ErrNoExchangesLoaded } - - e.Setup(exchCfg) - log.Debugf(log.ExchangeSys, "%s exchange reloaded successfully.\n", name) + exch := e.getExchangeByName(exchName) + if exch == nil { + return ErrExchangeNotFound + } + e.m.Lock() + defer e.m.Unlock() + delete(e.exchanges, strings.ToLower(exchName)) + log.Infof(log.ExchangeSys, "%s exchange unloaded successfully.\n", exchName) return nil } -// UnloadExchange unloads an exchange by name -func UnloadExchange(name string) error { - if len(Bot.Exchanges) == 0 { - return ErrNoExchangesLoaded +func (e *exchangeManager) getExchangeByName(exchangeName string) exchange.IBotExchange { + if e.Len() == 0 { + return nil } - - if GetExchangeByName(name) == nil { - return ErrExchangeNotFound + e.m.Lock() + defer e.m.Unlock() + exch, ok := e.exchanges[strings.ToLower(exchangeName)] + if !ok { + return nil } + return exch +} - exchCfg, err := Bot.Config.GetExchangeConfig(name) +func (e *exchangeManager) Len() int { + e.m.Lock() + defer e.m.Unlock() + return len(e.exchanges) +} + +func (e *exchangeManager) unloadExchange(exchangeName string) error { + exchCfg, err := Bot.Config.GetExchangeConfig(exchangeName) if err != nil { return err } - exchCfg.Enabled = false - err = Bot.Config.UpdateExchangeConfig(exchCfg) + err = e.removeExchange(exchangeName) if err != nil { return err } - for x := range Bot.Exchanges { - if strings.EqualFold(Bot.Exchanges[x].GetName(), name) { - Bot.Exchanges[x].SetEnabled(false) - Bot.Exchanges = append(Bot.Exchanges[:x], Bot.Exchanges[x+1:]...) - return nil - } - } + exchCfg.Enabled = false + return nil +} + +// GetExchangeByName returns an exchange given an exchange name +func GetExchangeByName(exchName string) exchange.IBotExchange { + return Bot.exchangeManager.getExchangeByName(exchName) +} + +// UnloadExchange unloads an exchange by name +func UnloadExchange(exchName string) error { + return Bot.exchangeManager.unloadExchange(exchName) +} - return ErrExchangeNotFound +// GetExchanges retrieves the loaded exchanges +func GetExchanges() []exchange.IBotExchange { + return Bot.exchangeManager.getExchanges() } // LoadExchange loads an exchange by name @@ -127,10 +156,8 @@ func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error { nameLower := strings.ToLower(name) var exch exchange.IBotExchange - if len(Bot.Exchanges) > 0 { - if GetExchangeByName(name) != nil { - return ErrExchangeAlreadyLoaded - } + if Bot.exchangeManager.getExchangeByName(nameLower) != nil { + return ErrExchangeAlreadyLoaded } switch nameLower { @@ -269,26 +296,29 @@ func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error { dryrunParamInteraction("enableallexchanges") } - exchCfg.Enabled = true - err = exch.Setup(exchCfg) - if err != nil { - return err - } - if !Bot.Settings.EnableExchangeHTTPRateLimiter { log.Warnf(log.ExchangeSys, "Loaded exchange %s rate limiting has been turned off.\n", - exch.GetName()) + exch.GetName(), + ) err = exch.DisableRateLimiter() if err != nil { log.Errorf(log.ExchangeSys, "Loaded exchange %s rate limiting cannot be turned off: %s.\n", exch.GetName(), - err) + err, + ) } } - Bot.Exchanges = append(Bot.Exchanges, exch) + exchCfg.Enabled = true + err = exch.Setup(exchCfg) + if err != nil { + exchCfg.Enabled = false + return err + } + + Bot.exchangeManager.add(exch) base := exch.GetBase() if base.API.AuthenticatedSupport || @@ -322,19 +352,6 @@ func SetupExchanges() { var wg sync.WaitGroup configs := Bot.Config.GetAllExchangeConfigs() for x := range configs { - if e := GetExchangeByName(configs[x].Name); e != nil { - err := ReloadExchange(configs[x].Name) - if err != nil { - log.Errorf(log.ExchangeSys, "ReloadExchange %s failed: %s\n", configs[x].Name, err) - continue - } - - if !e.IsEnabled() { - UnloadExchange(configs[x].Name) - continue - } - return - } if !configs[x].Enabled && !Bot.Settings.EnableAllExchanges { log.Debugf(log.ExchangeSys, "%s: Exchange support: Disabled\n", configs[x].Name) continue diff --git a/engine/exchange_test.go b/engine/exchange_test.go index 2f63d4d45b6..73cf8388e59 100644 --- a/engine/exchange_test.go +++ b/engine/exchange_test.go @@ -3,20 +3,17 @@ package engine import ( "testing" - "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/exchanges/bitfinex" ) var testSetup = false func SetupTest(t *testing.T) { if !testSetup { - if Bot == nil { - Bot = new(Engine) - } - Bot.Config = &config.Cfg - err := Bot.Config.LoadConfig("", true) + var err error + Bot, err = New() if err != nil { - t.Fatalf("SetupTest: Failed to load config: %s", err) + t.Fatal(err) } testSetup = true } @@ -42,6 +39,51 @@ func CleanupTest(t *testing.T) { } } +func TestExchangeManagerAdd(t *testing.T) { + t.Parallel() + var e exchangeManager + bitfinex := new(bitfinex.Bitfinex) + bitfinex.SetDefaults() + e.add(bitfinex) + if exch := e.getExchanges(); exch[0].GetName() != "Bitfinex" { + t.Error("unexpected exchange name") + } +} + +func TestExchangeManagerGetExchanges(t *testing.T) { + t.Parallel() + var e exchangeManager + if exchanges := e.getExchanges(); exchanges != nil { + t.Error("unexpected value") + } + bitfinex := new(bitfinex.Bitfinex) + bitfinex.SetDefaults() + e.add(bitfinex) + if exch := e.getExchanges(); exch[0].GetName() != "Bitfinex" { + t.Error("unexpected exchange name") + } +} + +func TestExchangeManagerRemoveExchange(t *testing.T) { + t.Parallel() + var e exchangeManager + if err := e.removeExchange("Bitfinex"); err != ErrNoExchangesLoaded { + t.Error("no exchanges should be loaded") + } + bitfinex := new(bitfinex.Bitfinex) + bitfinex.SetDefaults() + e.add(bitfinex) + if err := e.removeExchange(testExchange); err != ErrExchangeNotFound { + t.Error("Bitstamp exchange should return an error") + } + if err := e.removeExchange("BiTFiNeX"); err != nil { + t.Error("exchange should have been removed") + } + if e.Len() != 0 { + t.Error("exchange manager len should be 0") + } +} + func TestCheckExchangeExists(t *testing.T) { SetupTest(t) @@ -86,35 +128,11 @@ func TestGetExchangeByName(t *testing.T) { CleanupTest(t) } -func TestReloadExchange(t *testing.T) { - SetupTest(t) - - err := ReloadExchange("asdf") - if err != ErrExchangeNotFound { - t.Errorf("TestReloadExchange: Incorrect result: %s", - err) - } - - err = ReloadExchange(testExchange) - if err != nil { - t.Errorf("TestReloadExchange: Incorrect result: %s", - err) - } - - CleanupTest(t) - - err = ReloadExchange("asdf") - if err != ErrNoExchangesLoaded { - t.Errorf("TestReloadExchange: Incorrect result: %s", - err) - } -} - func TestUnloadExchange(t *testing.T) { SetupTest(t) err := UnloadExchange("asdf") - if err != ErrExchangeNotFound { + if err.Error() != "exchange asdf not found" { t.Errorf("TestUnloadExchange: Incorrect result: %s", err) } @@ -125,7 +143,7 @@ func TestUnloadExchange(t *testing.T) { err) } - err = UnloadExchange("asdf") + err = UnloadExchange(testExchange) if err != ErrNoExchangesLoaded { t.Errorf("TestUnloadExchange: Incorrect result: %s", err) diff --git a/engine/helpers.go b/engine/helpers.go index edaf3a0581a..4572d747882 100644 --- a/engine/helpers.go +++ b/engine/helpers.go @@ -9,6 +9,7 @@ import ( "encoding/pem" "errors" "fmt" + "io/ioutil" "math/big" "net" "os" @@ -31,7 +32,12 @@ import ( "github.com/thrasher-corp/gocryptotrader/gctscript/vm" log "github.com/thrasher-corp/gocryptotrader/logger" "github.com/thrasher-corp/gocryptotrader/portfolio" - "github.com/thrasher-corp/gocryptotrader/utils" +) + +var ( + errCertExpired = errors.New("gRPC TLS certificate has expired") + errCertDataIsNil = errors.New("gRPC TLS certificate PEM data is nil") + errCertTypeInvalid = errors.New("gRPC TLS certificate type is invalid") ) // GetSubsystemsStatus returns the status of various subsystems @@ -177,15 +183,16 @@ func GetExchangeoOTPByName(exchName string) (string, error) { // GetAuthAPISupportedExchanges returns a list of auth api enabled exchanges func GetAuthAPISupportedExchanges() []string { - var exchanges []string - for x := range Bot.Exchanges { - if !Bot.Exchanges[x].GetAuthenticatedAPISupport(exchange.RestAuthentication) && - !Bot.Exchanges[x].GetAuthenticatedAPISupport(exchange.WebsocketAuthentication) { + var exchangeNames []string + exchanges := GetExchanges() + for x := range exchanges { + if !exchanges[x].GetAuthenticatedAPISupport(exchange.RestAuthentication) && + !exchanges[x].GetAuthenticatedAPISupport(exchange.WebsocketAuthentication) { continue } - exchanges = append(exchanges, Bot.Exchanges[x].GetName()) + exchangeNames = append(exchangeNames, exchanges[x].GetName()) } - return exchanges + return exchangeNames } // IsOnline returns whether or not the engine has Internet connectivity @@ -652,12 +659,10 @@ func GetExchangeCryptocurrencyDepositAddress(exchName, accountID string, item cu // GetExchangeCryptocurrencyDepositAddresses obtains an exchanges deposit cryptocurrency list func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string { result := make(map[string]map[string]string) - for x := range Bot.Exchanges { - if !Bot.Exchanges[x].IsEnabled() { - continue - } - exchName := Bot.Exchanges[x].GetName() - if !Bot.Exchanges[x].GetAuthenticatedAPISupport(exchange.RestAuthentication) { + exchanges := GetExchanges() + for x := range exchanges { + exchName := exchanges[x].GetName() + if !exchanges[x].GetAuthenticatedAPISupport(exchange.RestAuthentication) { if Bot.Settings.Verbose { log.Debugf(log.ExchangeSys, "GetExchangeCryptocurrencyDepositAddresses: Skippping %s due to disabled authenticated API support.\n", exchName) } @@ -673,7 +678,7 @@ func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string { cryptoAddr := make(map[string]string) for y := range cryptoCurrencies { cryptocurrency := cryptoCurrencies[y] - depositAddr, err := Bot.Exchanges[x].GetDepositAddress(currency.NewCode(cryptocurrency), "") + depositAddr, err := exchanges[x].GetDepositAddress(currency.NewCode(cryptocurrency), "") if err != nil { log.Errorf(log.Global, "%s failed to get cryptocurrency deposit addresses. Err: %s\n", exchName, err) continue @@ -706,37 +711,30 @@ func FormatCurrency(p currency.Pair) currency.Pair { Bot.Config.Currency.CurrencyPairFormat.Uppercase) } -// GetExchanges returns a list of loaded exchanges -func GetExchanges(enabled bool) []string { - var exchanges []string - for x := range Bot.Exchanges { - if Bot.Exchanges[x].IsEnabled() && enabled { - exchanges = append(exchanges, Bot.Exchanges[x].GetName()) - continue - } - exchanges = append(exchanges, Bot.Exchanges[x].GetName()) +// GetExchangeNames returns a list of enabled or disabled exchanges +func GetExchangeNames(enabledOnly bool) []string { + exchangeNames := GetAvailableExchanges() + if enabledOnly { + return exchangeNames } - return exchanges + exchangeNames = append(exchangeNames, Bot.Config.GetDisabledExchanges()...) + return exchangeNames } // GetAllActiveTickers returns all enabled exchange tickers func GetAllActiveTickers() []EnabledExchangeCurrencies { var tickerData []EnabledExchangeCurrencies - - for _, exch := range Bot.Exchanges { - if !exch.IsEnabled() { - continue - } - - assets := exch.GetAssetTypes() - exchName := exch.GetName() + exchanges := GetExchanges() + for x := range exchanges { + assets := exchanges[x].GetAssetTypes() + exchName := exchanges[x].GetName() var exchangeTicker EnabledExchangeCurrencies exchangeTicker.ExchangeName = exchName for y := range assets { - currencies := exch.GetEnabledPairs(assets[y]) + currencies := exchanges[x].GetEnabledPairs(assets[y]) for z := range currencies { - tp, err := exch.FetchTicker(currencies[z], assets[y]) + tp, err := exchanges[x].FetchTicker(currencies[z], assets[y]) if err != nil { log.Errorf(log.ExchangeSys, "Exchange %s failed to retrieve %s ticker. Err: %s\n", exchName, currencies[z].String(), @@ -754,38 +752,70 @@ func GetAllActiveTickers() []EnabledExchangeCurrencies { // GetAllEnabledExchangeAccountInfo returns all the current enabled exchanges func GetAllEnabledExchangeAccountInfo() AllEnabledExchangeAccounts { var response AllEnabledExchangeAccounts - for _, individualBot := range Bot.Exchanges { - if individualBot != nil && individualBot.IsEnabled() { - if !individualBot.GetAuthenticatedAPISupport(exchange.RestAuthentication) { - if Bot.Settings.Verbose { - log.Debugf(log.ExchangeSys, "GetAllEnabledExchangeAccountInfo: Skippping %s due to disabled authenticated API support.\n", individualBot.GetName()) - } - continue - } - individualExchange, err := individualBot.FetchAccountInfo() - if err != nil { - log.Errorf(log.ExchangeSys, "Error encountered retrieving exchange account info for %s. Error %s\n", - individualBot.GetName(), err) - continue + exchanges := GetExchanges() + for x := range exchanges { + if !exchanges[x].GetAuthenticatedAPISupport(exchange.RestAuthentication) { + if Bot.Settings.Verbose { + log.Debugf(log.ExchangeSys, "GetAllEnabledExchangeAccountInfo: Skippping %s due to disabled authenticated API support.\n", exchanges[x].GetName()) } - response.Data = append(response.Data, individualExchange) + continue } + accountInfo, err := exchanges[x].FetchAccountInfo() + if err != nil { + log.Errorf(log.ExchangeSys, "Error encountered retrieving exchange account info for %s. Error %s\n", + exchanges[x].GetName(), err) + continue + } + response.Data = append(response.Data, accountInfo) } return response } -func checkCerts() error { - targetDir := utils.GetTLSDir(Bot.Settings.DataDir) - _, err := os.Stat(targetDir) - if os.IsNotExist(err) { - err := common.CreateDir(targetDir) - if err != nil { +func verifyCert(pemData []byte) error { + var pemBlock *pem.Block + pemBlock, _ = pem.Decode(pemData) + if pemBlock == nil { + return errCertDataIsNil + } + + if pemBlock.Type != "CERTIFICATE" { + return errCertTypeInvalid + } + + cert, err := x509.ParseCertificate(pemBlock.Bytes) + if err != nil { + return err + } + + if time.Now().After(cert.NotAfter) { + return errCertExpired + } + return nil +} + +func checkCerts(certDir string) error { + certFile := filepath.Join(certDir, "cert.pem") + keyFile := filepath.Join(certDir, "key.pem") + + if !file.Exists(certFile) || !file.Exists(keyFile) { + log.Warnln(log.Global, "gRPC certificate/key file missing, recreating...") + return genCert(certDir) + } + + pemData, err := ioutil.ReadFile(certFile) + if err != nil { + return fmt.Errorf("unable to open TLS cert file: %s", err) + } + + if err = verifyCert(pemData); err != nil { + if err != errCertExpired { return err } - return genCert(targetDir) + log.Warnln(log.Global, "gRPC certificate has expired, regenerating...") + return genCert(certDir) } - log.Debugln(log.Global, "gRPC TLS certs directory already exists, will use them.") + log.Infoln(log.Global, "gRPC TLS certificate and key files exist, will use them.") return nil } @@ -795,9 +825,6 @@ func genCert(targetDir string) error { return fmt.Errorf("failed to generate ecdsa private key: %s", err) } - notBefore := time.Now() - notAfter := notBefore.Add(time.Hour * 24 * 365) - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { @@ -820,14 +847,12 @@ func genCert(targetDir string) error { Organization: []string{"gocryptotrader"}, CommonName: host, }, - NotBefore: notBefore, - NotAfter: notAfter, + NotBefore: time.Now(), + NotAfter: time.Now().Add(time.Hour * 24 * 365), IsCA: true, BasicConstraintsValid: true, - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, IPAddresses: []net.IP{ net.ParseIP("127.0.0.1"), net.ParseIP("::1"), @@ -865,6 +890,6 @@ func genCert(targetDir string) error { return fmt.Errorf("failed to write cert.pem file %s", err) } - log.Debugf(log.Global, "TLS key.pem and cert.pem files written to %s\n", targetDir) + log.Infof(log.Global, "gRPC TLS key.pem and cert.pem files written to %s\n", targetDir) return nil } diff --git a/engine/helpers_test.go b/engine/helpers_test.go index f4322d8935c..c53b0fe0376 100644 --- a/engine/helpers_test.go +++ b/engine/helpers_test.go @@ -1,10 +1,21 @@ package engine import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "net" + "os" + "path/filepath" "testing" "time" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/common/file" "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/exchanges/account" @@ -14,10 +25,6 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" ) -const ( - TestConfig = "../testdata/configtest.json" -) - var ( helperTestLoaded = false ) @@ -29,7 +36,7 @@ func SetupTestHelpers(t *testing.T) { Bot = new(Engine) } Bot.Config = &config.Cfg - err := Bot.Config.LoadConfig("../testdata/configtest.json", true) + err := Bot.Config.LoadConfig(config.TestFile, true) if err != nil { t.Fatalf("SetupTest: Failed to load config: %s", err) } @@ -562,3 +569,167 @@ func TestGetCryptocurrenciesByExchange(t *testing.T) { t.Fatalf("Err %s", err) } } + +func TestGetExchangeNames(t *testing.T) { + SetupTest(t) + if e := GetExchangeNames(true); len(e) == 0 { + t.Error("exchange names should be populated") + } + if err := UnloadExchange(testExchange); err != nil { + t.Fatal(err) + } + if e := GetExchangeNames(true); common.StringDataCompare(e, testExchange) { + t.Error("Bitstamp should be missing") + } + if e := GetExchangeNames(false); len(e) != 27 { + t.Error("len should be all available exchanges") + } +} + +func mockCert(derType string, notAfter time.Time) ([]byte, error) { + privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return nil, err + } + + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) + if err != nil { + return nil, err + } + + host, err := os.Hostname() + if err != nil { + return nil, err + } + + dnsNames := []string{host} + if host != "localhost" { + dnsNames = append(dnsNames, "localhost") + } + + if notAfter.IsZero() { + notAfter = time.Now().Add(time.Hour * 24 * 365) + } + + template := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + Organization: []string{"gocryptotrader"}, + CommonName: host, + }, + NotBefore: time.Now(), + NotAfter: notAfter, + IsCA: true, + BasicConstraintsValid: true, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + IPAddresses: []net.IP{ + net.ParseIP("127.0.0.1"), + net.ParseIP("::1"), + }, + DNSNames: dnsNames, + } + + derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &privKey.PublicKey, privKey) + if err != nil { + return nil, err + } + + if derType == "" { + derType = "CERTIFICATE" + } + + certData := pem.EncodeToMemory(&pem.Block{Type: derType, Bytes: derBytes}) + if certData == nil { + return nil, err + } + + return certData, nil +} + +func TestVerifyCert(t *testing.T) { + t.Parallel() + + tester := []struct { + PEMType string + CreateBypass bool + NotAfter time.Time + ErrorExpected error + }{ + { + ErrorExpected: nil, + }, + { + CreateBypass: true, + ErrorExpected: errCertDataIsNil, + }, + { + PEMType: "MEOW", + ErrorExpected: errCertTypeInvalid, + }, + { + NotAfter: time.Now().Add(-time.Hour), + ErrorExpected: errCertExpired, + }, + } + + for x := range tester { + var cert []byte + var err error + if !tester[x].CreateBypass { + cert, err = mockCert(tester[x].PEMType, tester[x].NotAfter) + if err != nil { + t.Errorf("test %d unexpected error: %s", x, err) + continue + } + } + err = verifyCert(cert) + if err != tester[x].ErrorExpected { + t.Fatalf("test %d expected %v, got %v", x, tester[x].ErrorExpected, err) + } + } +} + +func TestCheckAndGenCerts(t *testing.T) { + t.Parallel() + + tempDir := filepath.Join(os.TempDir(), "gct-temp-tls") + cleanup := func() { + if err := os.RemoveAll(tempDir); err != nil { + t.Errorf("unable to remove temp dir %s, manual deletion required", tempDir) + } + } + + if err := genCert(tempDir); err != nil { + cleanup() + t.Fatal(err) + } + + defer cleanup() + if err := checkCerts(tempDir); err != nil { + t.Fatal(err) + } + + // Now delete cert.pem and test regeneration of cert/key files + certFile := filepath.Join(tempDir, "cert.pem") + if err := os.Remove(certFile); err != nil { + t.Fatal(err) + } + if err := checkCerts(tempDir); err != nil { + t.Fatal(err) + } + + // Now call checkCerts to test an expired cert + certData, err := mockCert("", time.Now().Add(-time.Hour)) + if err != nil { + t.Fatal(err) + } + err = file.Write(certFile, certData) + if err != nil { + t.Fatal(err) + } + if err = checkCerts(tempDir); err != nil { + t.Fatal(err) + } +} diff --git a/engine/restful_server.go b/engine/restful_server.go index b5c8ae9f496..c79a5d9167a 100644 --- a/engine/restful_server.go +++ b/engine/restful_server.go @@ -58,21 +58,17 @@ func RESTSaveAllSettings(w http.ResponseWriter, r *http.Request) { // GetAllActiveOrderbooks returns all enabled exchanges orderbooks func GetAllActiveOrderbooks() []EnabledExchangeOrderbooks { var orderbookData []EnabledExchangeOrderbooks - - for _, exch := range Bot.Exchanges { - if !exch.IsEnabled() { - continue - } - - assets := exch.GetAssetTypes() - exchName := exch.GetName() + exchanges := GetExchanges() + for x := range exchanges { + assets := exchanges[x].GetAssetTypes() + exchName := exchanges[x].GetName() var exchangeOB EnabledExchangeOrderbooks exchangeOB.ExchangeName = exchName for y := range assets { - currencies := exch.GetEnabledPairs(assets[y]) + currencies := exchanges[x].GetEnabledPairs(assets[y]) for z := range currencies { - ob, err := exch.FetchOrderbook(currencies[z], assets[y]) + ob, err := exchanges[x].FetchOrderbook(currencies[z], assets[y]) if err != nil { log.Errorf(log.RESTSys, "Exchange %s failed to retrieve %s orderbook. Err: %s\n", exchName, diff --git a/engine/routines.go b/engine/routines.go index b3622a2cbba..bfae8b85d3a 100644 --- a/engine/routines.go +++ b/engine/routines.go @@ -200,20 +200,28 @@ func WebsocketRoutine() { log.Debugln(log.WebsocketMgr, "Connecting exchange websocket services...") } - for i := range Bot.Exchanges { + exchanges := GetExchanges() + for i := range exchanges { go func(i int) { - if Bot.Exchanges[i].SupportsWebsocket() { + if exchanges[i].SupportsWebsocket() { if Bot.Settings.Verbose { - log.Debugf(log.WebsocketMgr, "Exchange %s websocket support: Yes Enabled: %v\n", Bot.Exchanges[i].GetName(), - common.IsEnabled(Bot.Exchanges[i].IsWebsocketEnabled())) + log.Debugf(log.WebsocketMgr, + "Exchange %s websocket support: Yes Enabled: %v\n", + exchanges[i].GetName(), + common.IsEnabled(exchanges[i].IsWebsocketEnabled()), + ) } // TO-DO: expose IsConnected() and IsConnecting so this can be simplified - if Bot.Exchanges[i].IsWebsocketEnabled() { - ws, err := Bot.Exchanges[i].GetWebsocket() + if exchanges[i].IsWebsocketEnabled() { + ws, err := exchanges[i].GetWebsocket() if err != nil { - log.Errorf(log.WebsocketMgr, "Exchange %s GetWebsocket error: %s\n", - Bot.Exchanges[i].GetName(), err) + log.Errorf( + log.WebsocketMgr, + "Exchange %s GetWebsocket error: %s\n", + exchanges[i].GetName(), + err, + ) return } @@ -232,7 +240,10 @@ func WebsocketRoutine() { } } } else if Bot.Settings.Verbose { - log.Debugf(log.WebsocketMgr, "Exchange %s websocket support: No\n", Bot.Exchanges[i].GetName()) + log.Debugf(log.WebsocketMgr, + "Exchange %s websocket support: No\n", + exchanges[i].GetName(), + ) } }(i) } diff --git a/engine/rpcserver.go b/engine/rpcserver.go index 7f300e86df4..d1ddcf8d616 100644 --- a/engine/rpcserver.go +++ b/engine/rpcserver.go @@ -82,7 +82,8 @@ func authenticateClient(ctx context.Context) (context.Context, error) { // StartRPCServer starts a gRPC server with TLS auth func StartRPCServer() { - err := checkCerts() + targetDir := utils.GetTLSDir(Bot.Settings.DataDir) + err := checkCerts(targetDir) if err != nil { log.Errorf(log.GRPCSys, "gRPC checkCerts failed. err: %s\n", err) return @@ -95,7 +96,6 @@ func StartRPCServer() { return } - targetDir := utils.GetTLSDir(Bot.Settings.DataDir) creds, err := credentials.NewServerTLSFromFile(filepath.Join(targetDir, "cert.pem"), filepath.Join(targetDir, "key.pem")) if err != nil { log.Errorf(log.GRPCSys, "gRPC server could not load TLS keys: %s\n", err) @@ -233,7 +233,7 @@ func (s *RPCServer) GetCommunicationRelayers(ctx context.Context, r *gctrpc.GetC // GetExchanges returns a list of exchanges // Param is whether or not you wish to list enabled exchanges func (s *RPCServer) GetExchanges(ctx context.Context, r *gctrpc.GetExchangesRequest) (*gctrpc.GetExchangesResponse, error) { - exchanges := strings.Join(GetExchanges(r.Enabled), ",") + exchanges := strings.Join(GetExchangeNames(r.Enabled), ",") return &gctrpc.GetExchangesResponse{Exchanges: exchanges}, nil } diff --git a/engine/syncer.go b/engine/syncer.go index 12329fd85b9..97827068bc9 100644 --- a/engine/syncer.go +++ b/engine/syncer.go @@ -281,20 +281,17 @@ func (e *ExchangeCurrencyPairSyncer) worker() { defer cleanup() for atomic.LoadInt32(&e.shutdown) != 1 { - for x := range Bot.Exchanges { - if !Bot.Exchanges[x].IsEnabled() { - continue - } - - exchangeName := Bot.Exchanges[x].GetName() - assetTypes := Bot.Exchanges[x].GetAssetTypes() - supportsREST := Bot.Exchanges[x].SupportsREST() - supportsRESTTickerBatching := Bot.Exchanges[x].SupportsRESTTickerBatchUpdates() + exchanges := GetExchanges() + for x := range exchanges { + exchangeName := exchanges[x].GetName() + assetTypes := exchanges[x].GetAssetTypes() + supportsREST := exchanges[x].SupportsREST() + supportsRESTTickerBatching := exchanges[x].SupportsRESTTickerBatchUpdates() var usingREST bool var usingWebsocket bool var switchedToRest bool - if Bot.Exchanges[x].SupportsWebsocket() && Bot.Exchanges[x].IsWebsocketEnabled() { - ws, err := Bot.Exchanges[x].GetWebsocket() + if exchanges[x].SupportsWebsocket() && exchanges[x].IsWebsocketEnabled() { + ws, err := exchanges[x].GetWebsocket() if err != nil { log.Errorf(log.SyncMgr, "%s unable to get websocket pointer. Err: %s\n", exchangeName, err) @@ -311,7 +308,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { } for y := range assetTypes { - enabledPairs := Bot.Exchanges[x].GetEnabledPairs(assetTypes[y]) + enabledPairs := exchanges[x].GetEnabledPairs(assetTypes[y]) for i := range enabledPairs { if atomic.LoadInt32(&e.shutdown) == 1 { return @@ -401,17 +398,17 @@ func (e *ExchangeCurrencyPairSyncer) worker() { if e.Cfg.Verbose { log.Debugf(log.SyncMgr, "%s Init'ing REST ticker batching\n", exchangeName) } - result, err = Bot.Exchanges[x].UpdateTicker(c.Pair, c.AssetType) + result, err = exchanges[x].UpdateTicker(c.Pair, c.AssetType) e.tickerBatchLastRequested[exchangeName] = time.Now() e.mux.Unlock() } else { if e.Cfg.Verbose { log.Debugf(log.SyncMgr, "%s Using recent batching cache\n", exchangeName) } - result, err = Bot.Exchanges[x].FetchTicker(c.Pair, c.AssetType) + result, err = exchanges[x].FetchTicker(c.Pair, c.AssetType) } } else { - result, err = Bot.Exchanges[x].UpdateTicker(c.Pair, c.AssetType) + result, err = exchanges[x].UpdateTicker(c.Pair, c.AssetType) } printTickerSummary(result, c.Pair, c.AssetType, exchangeName, "REST", err) if err == nil { @@ -452,7 +449,7 @@ func (e *ExchangeCurrencyPairSyncer) worker() { } e.setProcessing(c.Exchange, c.Pair, c.AssetType, SyncItemOrderbook, true) - result, err := Bot.Exchanges[x].UpdateOrderbook(c.Pair, c.AssetType) + result, err := exchanges[x].UpdateOrderbook(c.Pair, c.AssetType) printOrderbookSummary(result, c.Pair, c.AssetType, exchangeName, "REST", err) if err == nil { //nolint:gocritic Bot.CommsRelayer.StageOrderbookData(exchangeName, c.AssetType, result) @@ -483,16 +480,12 @@ func (e *ExchangeCurrencyPairSyncer) worker() { // Start starts an exchange currency pair syncer func (e *ExchangeCurrencyPairSyncer) Start() { log.Debugln(log.SyncMgr, "Exchange CurrencyPairSyncer started.") - - for x := range Bot.Exchanges { - if !Bot.Exchanges[x].IsEnabled() { - continue - } - - exchangeName := Bot.Exchanges[x].GetName() - supportsWebsocket := Bot.Exchanges[x].SupportsWebsocket() - assetTypes := Bot.Exchanges[x].GetAssetTypes() - supportsREST := Bot.Exchanges[x].SupportsREST() + exchanges := GetExchanges() + for x := range exchanges { + exchangeName := exchanges[x].GetName() + supportsWebsocket := exchanges[x].SupportsWebsocket() + assetTypes := exchanges[x].GetAssetTypes() + supportsREST := exchanges[x].SupportsREST() if !supportsREST && !supportsWebsocket { log.Warnf(log.SyncMgr, @@ -503,9 +496,8 @@ func (e *ExchangeCurrencyPairSyncer) Start() { var usingWebsocket bool var usingREST bool - - if supportsWebsocket && Bot.Exchanges[x].IsWebsocketEnabled() { - ws, err := Bot.Exchanges[x].GetWebsocket() + if supportsWebsocket && exchanges[x].IsWebsocketEnabled() { + ws, err := exchanges[x].GetWebsocket() if err != nil { log.Errorf(log.SyncMgr, "%s failed to get websocket. Err: %s\n", exchangeName, err) @@ -531,11 +523,12 @@ func (e *ExchangeCurrencyPairSyncer) Start() { } for y := range assetTypes { - enabledPairs := Bot.Exchanges[x].GetEnabledPairs(assetTypes[y]) + enabledPairs := exchanges[x].GetEnabledPairs(assetTypes[y]) for i := range enabledPairs { if e.exists(exchangeName, enabledPairs[i], assetTypes[y]) { continue } + c := CurrencyPairSyncAgent{ AssetType: assetTypes[y], Exchange: exchangeName, diff --git a/exchanges/README.md b/exchanges/README.md index 9333cc6efed..6843eca1d7d 100644 --- a/exchanges/README.md +++ b/exchanges/README.md @@ -44,4 +44,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/alphapoint/README.md b/exchanges/alphapoint/README.md index 99c6a8f757a..a84766958a1 100644 --- a/exchanges/alphapoint/README.md +++ b/exchanges/alphapoint/README.md @@ -45,4 +45,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/alphapoint/alphapoint_test.go b/exchanges/alphapoint/alphapoint_test.go index 562ece4552a..607a6e2703c 100644 --- a/exchanges/alphapoint/alphapoint_test.go +++ b/exchanges/alphapoint/alphapoint_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -507,7 +508,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.BTC, currency.LTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -530,7 +531,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.BTC, currency.LTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } diff --git a/exchanges/binance/README.md b/exchanges/binance/README.md index 11625cbd049..537f0235b43 100644 --- a/exchanges/binance/README.md +++ b/exchanges/binance/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/binance/binance_test.go b/exchanges/binance/binance_test.go index fd038a614b8..32edf7c0ec9 100644 --- a/exchanges/binance/binance_test.go +++ b/exchanges/binance/binance_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -392,7 +393,7 @@ func TestCancelExchangeOrder(t *testing.T) { } var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currency.NewPair(currency.LTC, currency.BTC), } @@ -416,7 +417,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { } var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currency.NewPair(currency.LTC, currency.BTC), } @@ -468,7 +469,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := b.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/bitfinex/README.md b/exchanges/bitfinex/README.md index 616cb503022..72d2a2c7c27 100644 --- a/exchanges/bitfinex/README.md +++ b/exchanges/bitfinex/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bitfinex/bitfinex_test.go b/exchanges/bitfinex/bitfinex_test.go index 9e1b0669adb..ab35c4a2be7 100644 --- a/exchanges/bitfinex/bitfinex_test.go +++ b/exchanges/bitfinex/bitfinex_test.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -802,7 +803,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -825,7 +826,7 @@ func TestCancelAllExchangeOrdera(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -867,7 +868,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := b.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/bitflyer/README.md b/exchanges/bitflyer/README.md index 34a95fecb11..7c3aa018333 100644 --- a/exchanges/bitflyer/README.md +++ b/exchanges/bitflyer/README.md @@ -136,4 +136,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bitflyer/bitflyer_test.go b/exchanges/bitflyer/bitflyer_test.go index 814781dba90..fb265a84066 100644 --- a/exchanges/bitflyer/bitflyer_test.go +++ b/exchanges/bitflyer/bitflyer_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -81,7 +82,7 @@ func TestGetTransactionByHashCA(t *testing.T) { func TestGetAddressInfoCA(t *testing.T) { t.Parallel() - v, err := b.GetAddressInfoCA("1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB") + v, err := b.GetAddressInfoCA(core.BitcoinDonationAddress) if err != nil { t.Error("Bitflyer - GetAddressInfoCA() error:", err) } @@ -328,7 +329,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -349,7 +350,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -373,7 +374,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := b.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/bithumb/README.md b/exchanges/bithumb/README.md index 052e307e524..91e19bb6eee 100644 --- a/exchanges/bithumb/README.md +++ b/exchanges/bithumb/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bithumb/bithumb_test.go b/exchanges/bithumb/bithumb_test.go index 4537e53f6bf..024e90094d6 100644 --- a/exchanges/bithumb/bithumb_test.go +++ b/exchanges/bithumb/bithumb_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -372,7 +373,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -395,7 +396,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -455,7 +456,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := b.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/bitmex/README.md b/exchanges/bitmex/README.md index d77a9fed37b..3a3f72c8629 100644 --- a/exchanges/bitmex/README.md +++ b/exchanges/bitmex/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bitmex/bitmex_test.go b/exchanges/bitmex/bitmex_test.go index b201bc572b5..279a7687da1 100644 --- a/exchanges/bitmex/bitmex_test.go +++ b/exchanges/bitmex/bitmex_test.go @@ -11,6 +11,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -541,7 +542,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "123456789012345678901234567890123456", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -563,7 +564,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "123456789012345678901234567890123456", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -614,7 +615,7 @@ func TestWithdraw(t *testing.T) { Description: "WITHDRAW IT ALL", OneTimePassword: 000000, }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/bitmex/bitmex_wrapper.go b/exchanges/bitmex/bitmex_wrapper.go index e0d2700d121..51b5a58cf42 100644 --- a/exchanges/bitmex/bitmex_wrapper.go +++ b/exchanges/bitmex/bitmex_wrapper.go @@ -255,7 +255,7 @@ func (b *Bitmex) UpdateTradablePairs(forceUpdate bool) error { } case asset.Futures: for y := range pairs { - if strings.Contains(pairs[y], "19") { + if strings.Contains(pairs[y], "20") { assetPairs = append(assetPairs, pairs[y]) } } diff --git a/exchanges/bitstamp/README.md b/exchanges/bitstamp/README.md index 0acefd1f55b..24d3a721f78 100644 --- a/exchanges/bitstamp/README.md +++ b/exchanges/bitstamp/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bitstamp/bitstamp_test.go b/exchanges/bitstamp/bitstamp_test.go index bbb1f8f4c0d..1d09ca63bbb 100644 --- a/exchanges/bitstamp/bitstamp_test.go +++ b/exchanges/bitstamp/bitstamp_test.go @@ -4,6 +4,7 @@ import ( "net/url" "testing" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -461,7 +462,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := b.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/bittrex/README.md b/exchanges/bittrex/README.md index 039bc2e938b..60d1d7a7a76 100644 --- a/exchanges/bittrex/README.md +++ b/exchanges/bittrex/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/bittrex/bittrex_test.go b/exchanges/bittrex/bittrex_test.go index 86671aef9e5..6f20a816ddf 100644 --- a/exchanges/bittrex/bittrex_test.go +++ b/exchanges/bittrex/bittrex_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -409,7 +410,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -431,7 +432,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -467,7 +468,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/btcmarkets/README.md b/exchanges/btcmarkets/README.md index 06a67665432..51605af7e6d 100644 --- a/exchanges/btcmarkets/README.md +++ b/exchanges/btcmarkets/README.md @@ -130,4 +130,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/btse/README.md b/exchanges/btse/README.md index cdb5fd7e867..53c100cea70 100644 --- a/exchanges/btse/README.md +++ b/exchanges/btse/README.md @@ -130,4 +130,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/btse/btse_test.go b/exchanges/btse/btse_test.go index d0cd92faaf3..633a6223147 100644 --- a/exchanges/btse/btse_test.go +++ b/exchanges/btse/btse_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -322,7 +323,7 @@ func TestCancelExchangeOrder(t *testing.T) { "-") var orderCancellation = &order.Cancel{ OrderID: "b334ecef-2b42-4998-b8a4-b6b14f6d2671", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -342,7 +343,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { "-") var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } diff --git a/exchanges/coinbasepro/README.md b/exchanges/coinbasepro/README.md index b734dd6ba3a..4574a34423f 100644 --- a/exchanges/coinbasepro/README.md +++ b/exchanges/coinbasepro/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/coinbasepro/coinbasepro_test.go b/exchanges/coinbasepro/coinbasepro_test.go index d0f08dc949f..c938b5fd3b3 100644 --- a/exchanges/coinbasepro/coinbasepro_test.go +++ b/exchanges/coinbasepro/coinbasepro_test.go @@ -10,6 +10,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -491,7 +492,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -513,7 +514,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -549,7 +550,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/coinbene/README.md b/exchanges/coinbene/README.md index c4fe862f946..13106aebfa1 100644 --- a/exchanges/coinbene/README.md +++ b/exchanges/coinbene/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/coinut/README.md b/exchanges/coinut/README.md index dc2cc3ced84..2220d38ba27 100644 --- a/exchanges/coinut/README.md +++ b/exchanges/coinut/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/coinut/coinut_test.go b/exchanges/coinut/coinut_test.go index d71e7b5f407..b903e9230c1 100644 --- a/exchanges/coinut/coinut_test.go +++ b/exchanges/coinut/coinut_test.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -317,7 +318,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.BTC, currency.USD) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -339,7 +340,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -389,7 +390,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/exchange_test.go b/exchanges/exchange_test.go index 532c7f0d0c7..606198ca35a 100644 --- a/exchanges/exchange_test.go +++ b/exchanges/exchange_test.go @@ -213,7 +213,6 @@ func TestSetAutoPairDefaults(t *testing.T) { } exch.Features.Supports.RESTCapabilities.AutoPairUpdates = false - cfg.UpdateExchangeConfig(exch) exch, err = cfg.GetExchangeConfig("Bitstamp") if err != nil { diff --git a/exchanges/exmo/README.md b/exchanges/exmo/README.md index 64e212d8b28..a73665582d1 100644 --- a/exchanges/exmo/README.md +++ b/exchanges/exmo/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/exmo/exmo_test.go b/exchanges/exmo/exmo_test.go index 8931b2acd84..0d66b1a9f02 100644 --- a/exchanges/exmo/exmo_test.go +++ b/exchanges/exmo/exmo_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -327,7 +328,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -349,7 +350,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -389,7 +390,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } _, err := e.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/gateio/README.md b/exchanges/gateio/README.md index f4e9763ca91..844979fbfa7 100644 --- a/exchanges/gateio/README.md +++ b/exchanges/gateio/README.md @@ -136,4 +136,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/gateio/gateio_test.go b/exchanges/gateio/gateio_test.go index ac92153e50d..7b702ab8016 100644 --- a/exchanges/gateio/gateio_test.go +++ b/exchanges/gateio/gateio_test.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -340,7 +341,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -362,7 +363,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -412,7 +413,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/gemini/README.md b/exchanges/gemini/README.md index 7e5284858c5..8ddad4dd84c 100644 --- a/exchanges/gemini/README.md +++ b/exchanges/gemini/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/gemini/gemini_test.go b/exchanges/gemini/gemini_test.go index f960cd899fc..d74a7a18d4d 100644 --- a/exchanges/gemini/gemini_test.go +++ b/exchanges/gemini/gemini_test.go @@ -7,6 +7,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -448,7 +449,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -484,7 +485,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders && !mockTests { diff --git a/exchanges/hitbtc/README.md b/exchanges/hitbtc/README.md index 7acbaef6440..3c22c1ce38b 100644 --- a/exchanges/hitbtc/README.md +++ b/exchanges/hitbtc/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/hitbtc/hitbtc_test.go b/exchanges/hitbtc/hitbtc_test.go index 2553858d19b..43c54a897d0 100644 --- a/exchanges/hitbtc/hitbtc_test.go +++ b/exchanges/hitbtc/hitbtc_test.go @@ -10,6 +10,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -288,7 +289,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -310,7 +311,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -346,7 +347,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/huobi/README.md b/exchanges/huobi/README.md index 6ef6ed77b49..99fe3622c22 100644 --- a/exchanges/huobi/README.md +++ b/exchanges/huobi/README.md @@ -136,4 +136,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/huobi/huobi_test.go b/exchanges/huobi/huobi_test.go index 49e9fc1b9e4..e6482309cb8 100644 --- a/exchanges/huobi/huobi_test.go +++ b/exchanges/huobi/huobi_test.go @@ -16,6 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/common/crypto" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -521,7 +522,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -544,7 +545,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -594,7 +595,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/itbit/README.md b/exchanges/itbit/README.md index 1c87aa4bbb7..f7df3c4d217 100644 --- a/exchanges/itbit/README.md +++ b/exchanges/itbit/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/itbit/itbit_test.go b/exchanges/itbit/itbit_test.go index c02f9d1c02f..d0d9682e73c 100644 --- a/exchanges/itbit/itbit_test.go +++ b/exchanges/itbit/itbit_test.go @@ -8,6 +8,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -328,7 +329,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -351,7 +352,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -396,7 +397,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/kraken/README.md b/exchanges/kraken/README.md index 7992a499466..a2646e19014 100644 --- a/exchanges/kraken/README.md +++ b/exchanges/kraken/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/kraken/kraken_test.go b/exchanges/kraken/kraken_test.go index 2f8bd9d5485..882b8f32517 100644 --- a/exchanges/kraken/kraken_test.go +++ b/exchanges/kraken/kraken_test.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -460,7 +461,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -483,7 +484,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -537,7 +538,7 @@ func TestWithdraw(t *testing.T) { Description: "WITHDRAW IT ALL", TradePassword: "Key", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/lakebtc/README.md b/exchanges/lakebtc/README.md index 0a0434768f1..1ff26915038 100644 --- a/exchanges/lakebtc/README.md +++ b/exchanges/lakebtc/README.md @@ -130,4 +130,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/lakebtc/lakebtc_test.go b/exchanges/lakebtc/lakebtc_test.go index 4158fc874a9..ebc2c0beab0 100644 --- a/exchanges/lakebtc/lakebtc_test.go +++ b/exchanges/lakebtc/lakebtc_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -324,7 +325,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -346,7 +347,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -382,7 +383,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/lbank/README.md b/exchanges/lbank/README.md index df02582895e..f596236b31a 100644 --- a/exchanges/lbank/README.md +++ b/exchanges/lbank/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/localbitcoins/README.md b/exchanges/localbitcoins/README.md index 22123daa035..9a9d01a87c8 100644 --- a/exchanges/localbitcoins/README.md +++ b/exchanges/localbitcoins/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/localbitcoins/localbitcoins_test.go b/exchanges/localbitcoins/localbitcoins_test.go index 84f86403e13..59c999389e4 100644 --- a/exchanges/localbitcoins/localbitcoins_test.go +++ b/exchanges/localbitcoins/localbitcoins_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -277,7 +278,7 @@ func TestCancelExchangeOrder(t *testing.T) { } var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currency.NewPair(currency.LTC, currency.BTC), } @@ -301,7 +302,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { } var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currency.NewPair(currency.LTC, currency.BTC), } @@ -339,7 +340,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders && !mockTests { diff --git a/exchanges/mock/README.md b/exchanges/mock/README.md index 9f9e7422ab9..96239a083f5 100644 --- a/exchanges/mock/README.md +++ b/exchanges/mock/README.md @@ -170,5 +170,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/nonce/README.md b/exchanges/nonce/README.md index a30717dd7a6..14ff1af5e70 100644 --- a/exchanges/nonce/README.md +++ b/exchanges/nonce/README.md @@ -41,4 +41,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/okcoin/README.md b/exchanges/okcoin/README.md index 578b12deaf5..9fb1b00a4bd 100644 --- a/exchanges/okcoin/README.md +++ b/exchanges/okcoin/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/okcoin/okcoin_test.go b/exchanges/okcoin/okcoin_test.go index 32714f3675b..909b3dc77f0 100644 --- a/exchanges/okcoin/okcoin_test.go +++ b/exchanges/okcoin/okcoin_test.go @@ -13,6 +13,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -149,7 +150,7 @@ func TestAccountWithdrawRequest(t *testing.T) { Currency: currency.BTC.String(), TradePwd: "1234", Destination: 4, - ToAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + ToAddress: core.BitcoinDonationAddress, Fee: 1, } _, err := o.AccountWithdraw(request) @@ -1014,7 +1015,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -1029,7 +1030,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -1067,7 +1068,7 @@ func TestWithdraw(t *testing.T) { Description: "WITHDRAW IT ALL", TradePassword: "Password", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, FeeAmount: 1, } diff --git a/exchanges/okex/README.md b/exchanges/okex/README.md index 5a6715db9c1..5afb6346365 100644 --- a/exchanges/okex/README.md +++ b/exchanges/okex/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/okex/okex_test.go b/exchanges/okex/okex_test.go index b6fa1a68e25..bb8b8885ff4 100644 --- a/exchanges/okex/okex_test.go +++ b/exchanges/okex/okex_test.go @@ -15,6 +15,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -154,7 +155,7 @@ func TestAccountWithdrawRequest(t *testing.T) { Currency: currency.BTC.String(), TradePwd: "1234", Destination: 4, - ToAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + ToAddress: core.BitcoinDonationAddress, Fee: 1, } @@ -1701,7 +1702,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -1717,7 +1718,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -1759,7 +1760,7 @@ func TestWithdraw(t *testing.T) { Description: "WITHDRAW IT ALL", TradePassword: "Password", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, FeeAmount: 1, } _, err := o.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) diff --git a/exchanges/okgroup/README.md b/exchanges/okgroup/README.md index d9f96ea3673..e986882f13e 100644 --- a/exchanges/okgroup/README.md +++ b/exchanges/okgroup/README.md @@ -129,5 +129,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/order/README.md b/exchanges/order/README.md index e903cc8485d..19692d0ab1c 100644 --- a/exchanges/order/README.md +++ b/exchanges/order/README.md @@ -44,5 +44,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/orderbook/README.md b/exchanges/orderbook/README.md index e9befce862d..f05429edcf6 100644 --- a/exchanges/orderbook/README.md +++ b/exchanges/orderbook/README.md @@ -72,4 +72,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/poloniex/README.md b/exchanges/poloniex/README.md index 743045d72ee..685235b9291 100644 --- a/exchanges/poloniex/README.md +++ b/exchanges/poloniex/README.md @@ -137,4 +137,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/poloniex/poloniex_test.go b/exchanges/poloniex/poloniex_test.go index 4852e6af07b..e49849edcb6 100644 --- a/exchanges/poloniex/poloniex_test.go +++ b/exchanges/poloniex/poloniex_test.go @@ -8,6 +8,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -285,7 +286,7 @@ func TestCancelExchangeOrder(t *testing.T) { } var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currency.NewPair(currency.LTC, currency.BTC), } @@ -310,7 +311,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -354,7 +355,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.LTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders && !mockTests { diff --git a/exchanges/request/README.md b/exchanges/request/README.md index fe20f726162..0335cee41ab 100644 --- a/exchanges/request/README.md +++ b/exchanges/request/README.md @@ -42,4 +42,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/stats/README.md b/exchanges/stats/README.md index f90c39e11ac..ae31f8170a8 100644 --- a/exchanges/stats/README.md +++ b/exchanges/stats/README.md @@ -45,4 +45,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/ticker/README.md b/exchanges/ticker/README.md index f67a4c91104..049bc7f9246 100644 --- a/exchanges/ticker/README.md +++ b/exchanges/ticker/README.md @@ -73,4 +73,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/withdraw/withdraw_test.go b/exchanges/withdraw/withdraw_test.go index e377ebacb2a..0af8f38151b 100644 --- a/exchanges/withdraw/withdraw_test.go +++ b/exchanges/withdraw/withdraw_test.go @@ -4,6 +4,7 @@ import ( "errors" "testing" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" ) @@ -36,7 +37,7 @@ var ( Description: "Test Withdrawal", Amount: 0.1, }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } invalidCryptoRequest = &CryptoRequest{} invalidCurrencyCryptoRequest = &CryptoRequest{ diff --git a/exchanges/yobit/README.md b/exchanges/yobit/README.md index fc89aca6578..c7df0c6b4d6 100644 --- a/exchanges/yobit/README.md +++ b/exchanges/yobit/README.md @@ -129,4 +129,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/yobit/yobit_test.go b/exchanges/yobit/yobit_test.go index 3fb435b1e9d..41f4bd46828 100644 --- a/exchanges/yobit/yobit_test.go +++ b/exchanges/yobit/yobit_test.go @@ -9,6 +9,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" @@ -394,7 +395,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -416,7 +417,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.LTC, currency.BTC) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -452,7 +453,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, } if areTestAPIKeysSet() && !canManipulateRealOrders { diff --git a/exchanges/zb/README.md b/exchanges/zb/README.md index 4d94cb06a92..107d497ae93 100644 --- a/exchanges/zb/README.md +++ b/exchanges/zb/README.md @@ -136,4 +136,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/zb/zb_test.go b/exchanges/zb/zb_test.go index 0bbd12cf393..ec92dd06d81 100644 --- a/exchanges/zb/zb_test.go +++ b/exchanges/zb/zb_test.go @@ -12,6 +12,7 @@ import ( "github.com/gorilla/websocket" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/config" + "github.com/thrasher-corp/gocryptotrader/core" "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" @@ -348,7 +349,7 @@ func TestCancelExchangeOrder(t *testing.T) { currencyPair := currency.NewPair(currency.XRP, currency.USDT) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -370,7 +371,7 @@ func TestCancelAllExchangeOrders(t *testing.T) { currencyPair := currency.NewPair(currency.XRP, currency.USDT) var orderCancellation = &order.Cancel{ OrderID: "1", - WalletAddress: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + WalletAddress: core.BitcoinDonationAddress, AccountID: "1", CurrencyPair: currencyPair, } @@ -420,7 +421,7 @@ func TestWithdraw(t *testing.T) { Currency: currency.BTC, Description: "WITHDRAW IT ALL", }, - Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB", + Address: core.BitcoinDonationAddress, FeeAmount: 1, } diff --git a/gctscript/README.md b/gctscript/README.md index 3874df1a251..53ea2d4169b 100644 --- a/gctscript/README.md +++ b/gctscript/README.md @@ -258,5 +258,5 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/gctscript/wrappers/gct/exchange/exchange.go b/gctscript/wrappers/gct/exchange/exchange.go index e8715123698..824a1b2d3d7 100644 --- a/gctscript/wrappers/gct/exchange/exchange.go +++ b/gctscript/wrappers/gct/exchange/exchange.go @@ -21,7 +21,7 @@ type Exchange struct{} // Exchanges returns slice of all current exchanges func (e Exchange) Exchanges(enabledOnly bool) []string { - return engine.GetExchanges(enabledOnly) + return engine.GetExchangeNames(enabledOnly) } // GetExchange returns IBotExchange for exchange or error if exchange is not found diff --git a/go.sum b/go.sum index 469d314c863..f579effd484 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,6 @@ github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvK github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg= -github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 h1:0IKlLyQ3Hs9nDaiK5cSHAGmcQEIC8l2Ts1u6x5Dfrqg= github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= diff --git a/main.go b/main.go index 0fe0a24dd34..290389bd8c8 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "log" "os" "runtime" "time" @@ -15,7 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/gctscript" gctscriptVM "github.com/thrasher-corp/gocryptotrader/gctscript/vm" - log "github.com/thrasher-corp/gocryptotrader/logger" + "github.com/thrasher-corp/gocryptotrader/logger" "github.com/thrasher-corp/gocryptotrader/signaler" ) @@ -32,6 +33,7 @@ func main() { flag.BoolVar(&settings.EnableAllExchanges, "enableallexchanges", false, "enables all exchanges") flag.BoolVar(&settings.EnableAllPairs, "enableallpairs", false, "enables all pairs for enabled exchanges") flag.BoolVar(&settings.EnablePortfolioManager, "portfoliomanager", true, "enables the portfolio manager") + flag.DurationVar(&settings.PortfolioManagerDelay, "portfoliomanagerdelay", time.Duration(0), "sets the portfolio managers sleep delay between updates") flag.BoolVar(&settings.EnableGRPC, "grpc", true, "enables the grpc server") flag.BoolVar(&settings.EnableGRPCProxy, "grpcproxy", false, "enables the grpc proxy server") flag.BoolVar(&settings.EnableWebsocketRPC, "websocketrpc", true, "enables the websocket RPC server") @@ -105,20 +107,19 @@ func main() { settings.CheckParamInteraction = true engine.Bot, err = engine.NewFromSettings(&settings) if engine.Bot == nil || err != nil { - log.Errorf(log.Global, "Unable to initialise bot engine. Error: %s\n", err) - os.Exit(1) + log.Fatalf("Unable to initialise bot engine. Error: %s\n", err) } gctscript.Setup() engine.PrintSettings(&engine.Bot.Settings) if err = engine.Bot.Start(); err != nil { - log.Errorf(log.Global, "Unable to start bot engine. Error: %s\n", err) + logger.Errorf(logger.Global, "Unable to start bot engine. Error: %s\n", err) os.Exit(1) } interrupt := signaler.WaitForInterrupt() - log.Infof(log.Global, "Captured %v, shutdown requested.\n", interrupt) + logger.Infof(logger.Global, "Captured %v, shutdown requested.\n", interrupt) engine.Bot.Stop() - log.Infoln(log.Global, "Exiting.") + logger.Infoln(logger.Global, "Exiting.") } diff --git a/portfolio/README.md b/portfolio/README.md index cf5b357944c..0a1d2c7791e 100644 --- a/portfolio/README.md +++ b/portfolio/README.md @@ -41,4 +41,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/testdata/README.md b/testdata/README.md index f3b7a360472..24b3f7ee203 100644 --- a/testdata/README.md +++ b/testdata/README.md @@ -41,4 +41,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** \ No newline at end of file +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** \ No newline at end of file diff --git a/testdata/http_mock/binance/binance.json b/testdata/http_mock/binance/binance.json index 3bedf4193b0..c3694440bca 100644 --- a/testdata/http_mock/binance/binance.json +++ b/testdata/http_mock/binance/binance.json @@ -45450,7 +45450,7 @@ "success": true, "id": "7213fea8e94b4a5593d507237e5a555b" }, - "queryString": "address=1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB\u0026amount=0\u0026asset=BTC\u0026name=WITHDRAW+IT+ALL\u0026recvWindow=5000\u0026signature=bec597908e6d2c223790cac9ca46300109216e056690a3f10a279b9eecc97e7e\u0026timestamp=1560233386000", + "queryString": "address=bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc\u0026amount=0\u0026asset=BTC\u0026name=WITHDRAW+IT+ALL\u0026recvWindow=5000\u0026signature=bec597908e6d2c223790cac9ca46300109216e056690a3f10a279b9eecc97e7e\u0026timestamp=1560233386000", "bodyParams": "", "headers": { "Key": [ diff --git a/testdata/http_mock/bitstamp/bitstamp.json b/testdata/http_mock/bitstamp/bitstamp.json index 8032e1f8f82..ad366125d33 100644 --- a/testdata/http_mock/bitstamp/bitstamp.json +++ b/testdata/http_mock/bitstamp/bitstamp.json @@ -28,7 +28,7 @@ } }, "queryString": "", - "bodyParams": "address=1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB\u0026amount=-1\u0026instant=1\u0026key=\u0026nonce=1560405519661130725\u0026signature=2CEEA36209A743A15CEF2C5AD724DEF2339E4FB5497DE58149507ED6CEEF98BA", + "bodyParams": "address=bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc\u0026amount=-1\u0026instant=1\u0026key=\u0026nonce=1560405519661130725\u0026signature=2CEEA36209A743A15CEF2C5AD724DEF2339E4FB5497DE58149507ED6CEEF98BA", "headers": { "Content-Type": [ "application/x-www-form-urlencoded" diff --git a/testdata/http_mock/gemini/gemini.json b/testdata/http_mock/gemini/gemini.json index e0e75a8c5fa..875777b9ca9 100644 --- a/testdata/http_mock/gemini/gemini.json +++ b/testdata/http_mock/gemini/gemini.json @@ -2706,7 +2706,7 @@ "result": "error" }, "queryString": "", - "bodyParams": "{\"address\":\"1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB\",\"amount\":\"-1\",\"nonce\":\"1565755733919473409\",\"request\":\"/v1/withdraw/btc\"}", + "bodyParams": "{\"address\":\"bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc\",\"amount\":\"-1\",\"nonce\":\"1565755733919473409\",\"request\":\"/v1/withdraw/btc\"}", "headers": { "Cache-Control": [ "no-cache" diff --git a/testdata/http_mock/localbitcoins/localbitcoins.json b/testdata/http_mock/localbitcoins/localbitcoins.json index 1553be6366d..7ca02489d4f 100644 --- a/testdata/http_mock/localbitcoins/localbitcoins.json +++ b/testdata/http_mock/localbitcoins/localbitcoins.json @@ -2640,7 +2640,7 @@ } }, "queryString": "", - "bodyParams": "address=1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB\u0026amount=-1", + "bodyParams": "address=bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc\u0026amount=-1", "headers": { "Apiauth-Key": [ "" diff --git a/testdata/http_mock/poloniex/poloniex.json b/testdata/http_mock/poloniex/poloniex.json index 10f443d0fef..0d601c66fe8 100644 --- a/testdata/http_mock/poloniex/poloniex.json +++ b/testdata/http_mock/poloniex/poloniex.json @@ -8716,7 +8716,7 @@ "response": "Withdrew 0.0 LTC." }, "queryString": "", - "bodyParams": "address=1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB\u0026amount=0\u0026command=withdraw\u0026currency=LTC\u0026nonce=1560225458841479798", + "bodyParams": "address=bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc\u0026amount=0\u0026command=withdraw\u0026currency=LTC\u0026nonce=1560225458841479798", "headers": { "Content-Type": [ "application/x-www-form-urlencoded" diff --git a/web/README.md b/web/README.md index a4887b58771..35e0b41b8f5 100644 --- a/web/README.md +++ b/web/README.md @@ -97,4 +97,4 @@ When submitting a PR, please abide by our coding guidelines: If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/web/src/app/pages/donate/donate.component.html b/web/src/app/pages/donate/donate.component.html index d86adc91fe6..b0bfee6d336 100644 --- a/web/src/app/pages/donate/donate.component.html +++ b/web/src/app/pages/donate/donate.component.html @@ -10,7 +10,7 @@ attach_money

Address:

-

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

+

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc