Skip to content

Commit

Permalink
fixing imports
Browse files Browse the repository at this point in the history
adding slack imtegration example
  • Loading branch information
saniales committed Aug 29, 2017
1 parent 4638497 commit 4a0cecf
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ _testmain.go
*.prof

golang-crypto-trading-bot
vendor/
4 changes: 2 additions & 2 deletions botHelpers/bot_helper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package botHelpers

import (
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/exchangeWrappers"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
)

//InitExchange initialize a new ExchangeWrapper binded to the specified exchange provided.
Expand Down
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

yaml "gopkg.in/yaml.v2"

"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/spf13/cobra"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"io/ioutil"
"os"

"github.com/AlessandroSanino1994/golang-crypto-trading-bot/botHelpers"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/exchangeWrappers"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/strategies"
"github.com/saniales/golang-crypto-trading-bot/botHelpers"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
"github.com/saniales/golang-crypto-trading-bot/strategies"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
)
Expand Down
2 changes: 1 addition & 1 deletion exchangeWrappers/bittrex_implementation.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package exchangeWrappers

import (
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/environment"

bittrexAPI "github.com/toorop/go-bittrex"
)
Expand Down
2 changes: 1 addition & 1 deletion exchangeWrappers/generic_exchange_wrapper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package exchangeWrappers

import "github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
import "github.com/saniales/golang-crypto-trading-bot/environment"

//ExchangeWrapper provides a generic wrapper for exchange services.
type ExchangeWrapper interface {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

package main

import "github.com/AlessandroSanino1994/golang-crypto-trading-bot/cmd"
import "github.com/saniales/golang-crypto-trading-bot/cmd"

func main() {
bot.Execute()
Expand Down
4 changes: 2 additions & 2 deletions strategies/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"sync"

"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/exchangeWrappers"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
)

var available map[string]Strategy //mapped name -> strategy
Expand Down
4 changes: 2 additions & 2 deletions strategies/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package strategies
import (
"time"

"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/exchangeWrappers"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
)

// IntervalStrategy is an interval based strategy.
Expand Down
42 changes: 42 additions & 0 deletions strategies/slack_integration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package strategies

import (
"log"
"time"

"github.com/nlopes/slack"

"github.com/shomali11/slacker"

"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
)

var bot *slacker.Slacker

// The following slack integration allows to send messages as a strategy.
// RTM not supported (and usually not requested when trading, this is an automated bot).
var slackIntegrationExample = IntervalStrategy{
model: StrategyModel{
Setup: func(exchangeWrappers.ExchangeWrapper, *environment.Market) error {
// connect slack token
bot = slacker.NewClient("YOUR-TOKEN-HERE")
bot.Init(func() {
log.Println("Slackbot Connected")
})
bot.Err(func(err string) {
log.Println("Error during slack bot connection: ", err)
})
return bot.Listen()
},
OnUpdate: func(exchangeWrappers.ExchangeWrapper, *environment.Market) error {
//if updates has requirements
bot.Client.PostMessage("DESIRED-CHANNEL", "OMG something happening!!!!!", slack.PostMessageParameters{})
return nil
},
OnError: func(err error) {
//log
},
},
Interval: time.Second * 10,
}
4 changes: 2 additions & 2 deletions strategies/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"time"

"github.com/AlessandroSanino1994/golang-crypto-trading-bot/environment"
"github.com/AlessandroSanino1994/golang-crypto-trading-bot/exchangeWrappers"
"github.com/saniales/golang-crypto-trading-bot/environment"
"github.com/saniales/golang-crypto-trading-bot/exchangeWrappers"
)

// Watch5Min prints out the info of the market every 5 minutes.
Expand Down

0 comments on commit 4a0cecf

Please sign in to comment.