Skip to content

Commit

Permalink
General engine improvements (thrasher-corp#437)
Browse files Browse the repository at this point in the history
* Add exchange manager to engine

* Several improvements for engine and friends

1) New file.Exists func
2) gRPC TLS cert expiration date check and regeneration
3) New donation var for use across the codebase
4) Use Go log package until the logger is initialised

* Add cert tests and create dir tree if it doesn't exist for file.Write

* Link up donation address to documentation tool plus minor adjustments

* Fix remaining donation addrs

* Move non-needed reload exchange funcs

* Revert accidental config_example.json changes 🕯️

* Use go logger for logging until the logger has initiliased, otherwise no output will be seen

* Link up portfolio delay val and other fixes

* Run go mod tidy after dependabot PR

* Address nitterinos
  • Loading branch information
thrasher- authored Feb 6, 2020
1 parent 2e6ff1c commit b949388
Show file tree
Hide file tree
Showing 186 changed files with 916 additions and 598 deletions.
9 changes: 6 additions & 3 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,25 +15,27 @@ 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
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
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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 |
Expand All @@ -152,25 +153,27 @@ 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 |
| [lozdog245](https://github.com/lozdog245) | 2 |
| [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 |
7 changes: 4 additions & 3 deletions cmd/config_builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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***
2 changes: 1 addition & 1 deletion cmd/documentation/cmd_templates/documentation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/common_templates/common_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{template "donations" .}}
{{end}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/comms.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/slack.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/smsglobal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/smtp.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/communications_templates/telegram.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/config_templates/config_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/currency_templates/currency_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{template "donations" .}}
{{end}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/currency_templates/fx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{template "donations" .}}
{{end}}
2 changes: 1 addition & 1 deletion cmd/documentation/currency_templates/fx_base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/currency_templates/fx_currencylayer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/currency_templates/fx_fixer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
37 changes: 27 additions & 10 deletions cmd/documentation/documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/documentation/events_templates/events_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{template "donations" .}}
{{end}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/alphapoint.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{template "donations" .}}
{{end}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/binance.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/bitfinex.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/bitflyer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/bithumb.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/bitmex.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion cmd/documentation/exchanges_templates/bitstamp.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Loading

0 comments on commit b949388

Please sign in to comment.