-
-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrating go-report-card badge and making it happy for better score
- Loading branch information
Showing
18 changed files
with
1,706 additions
and
1,705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,6 @@ _testmain.go | |
golang-crypto-trading-bot | ||
|
||
.bot_config.yaml | ||
.bot_config.yml | ||
.bot_config.yml | ||
|
||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
package strategies | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/saniales/golang-crypto-trading-bot/environment" | ||
"github.com/saniales/golang-crypto-trading-bot/exchanges" | ||
"github.com/saniales/golang-crypto-trading-bot/strategies" | ||
"github.com/sirupsen/logrus" | ||
tb "gopkg.in/tucnak/telebot.v2" | ||
) | ||
|
||
var telegramBot *tb.Bot | ||
|
||
var telegramIntegrationExample = strategies.IntervalStrategy{ | ||
Model: strategies.StrategyModel{ | ||
Name: "telegramIntegrationExample", | ||
Setup: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot, err := tb.NewBot(tb.Settings{ | ||
Token: "TOKEN_HERE", | ||
Poller: &tb.LongPoller{Timeout: 10 * time.Second}, | ||
}) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
telegramBot.Start() | ||
return nil | ||
}, | ||
OnUpdate: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot.Send(&tb.User{ | ||
Username: "YOUR-USERNAME-GROUP-OR-USER", | ||
}, "OMG SOMETHING HAPPENING!!!!!", tb.SendOptions{}) | ||
|
||
/* | ||
// Optionally it can have options | ||
telegramBot.Send(tb.User{ | ||
Username: "YOUR-JOINED-GROUP-USERNAME", | ||
}, "OMG SOMETHING HAPPENING!!!!!", tb.SendOptions{}) | ||
*/ | ||
return nil | ||
}, | ||
OnError: func(err error) { | ||
logrus.Errorf("I Got an error %s", err) | ||
telegramBot.Stop() | ||
}, | ||
TearDown: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot.Stop() | ||
return nil | ||
}, | ||
}, | ||
} | ||
package strategies | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/saniales/golang-crypto-trading-bot/environment" | ||
"github.com/saniales/golang-crypto-trading-bot/exchanges" | ||
"github.com/saniales/golang-crypto-trading-bot/strategies" | ||
"github.com/sirupsen/logrus" | ||
tb "gopkg.in/tucnak/telebot.v2" | ||
) | ||
|
||
var telegramBot *tb.Bot | ||
|
||
var telegramIntegrationExample = strategies.IntervalStrategy{ | ||
Model: strategies.StrategyModel{ | ||
Name: "telegramIntegrationExample", | ||
Setup: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot, err := tb.NewBot(tb.Settings{ | ||
Token: "TOKEN_HERE", | ||
Poller: &tb.LongPoller{Timeout: 10 * time.Second}, | ||
}) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
telegramBot.Start() | ||
return nil | ||
}, | ||
OnUpdate: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot.Send(&tb.User{ | ||
Username: "YOUR-USERNAME-GROUP-OR-USER", | ||
}, "OMG SOMETHING HAPPENING!!!!!", tb.SendOptions{}) | ||
|
||
/* | ||
// Optionally it can have options | ||
telegramBot.Send(tb.User{ | ||
Username: "YOUR-JOINED-GROUP-USERNAME", | ||
}, "OMG SOMETHING HAPPENING!!!!!", tb.SendOptions{}) | ||
*/ | ||
return nil | ||
}, | ||
OnError: func(err error) { | ||
logrus.Errorf("I Got an error %s", err) | ||
telegramBot.Stop() | ||
}, | ||
TearDown: func([]exchanges.ExchangeWrapper, []*environment.Market) error { | ||
telegramBot.Stop() | ||
return nil | ||
}, | ||
}, | ||
} |
Oops, something went wrong.