Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Commit

Permalink
stat: fix timestamp and remove inappropriate API
Browse files Browse the repository at this point in the history
  • Loading branch information
hexoul committed Nov 12, 2018
1 parent 6d45fd1 commit 89aee54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
20 changes: 2 additions & 18 deletions statistics/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io"
"os"
"strings"
"time"

kucoin "github.com/eeonevision/kucoin-go"
"github.com/gocolly/colly"
"github.com/jasonlvhit/gocron"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -37,9 +37,8 @@ func init() {
logger = log.New()

// Default configuration
timestampFormat := "02-01-2006 15:04:05"
logger.Formatter = &log.JSONFormatter{
TimestampFormat: timestampFormat,
TimestampFormat: time.RFC3339,
}
if f, err := os.OpenFile(logPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666); err == nil {
logger.Out = io.MultiWriter(f, os.Stdout)
Expand Down Expand Up @@ -133,18 +132,3 @@ func taskGatherTokenMetric(symbol, addr string) {
"txns": txns,
}).Info("GatherTokenMetric")
}

// GatherKucoinBalance records a balance of Kucoin account
func GatherKucoinBalance(k *kucoin.Kucoin, symbol string, job *gocron.Job) {
job.Do(taskGatherKucoinBalance, k, symbol)
}

func taskGatherKucoinBalance(k *kucoin.Kucoin, symbol string) {
if bal, err := k.GetCoinBalance(symbol); err == nil {
logger.WithFields(log.Fields{
"symbol": symbol,
"balance": bal.Balance,
"freeze": bal.FreezeBalance,
}).Info("GatherKucoinBalance")
}
}
15 changes: 0 additions & 15 deletions statistics/statistics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"
"time"

kucoin "github.com/eeonevision/kucoin-go"
"github.com/jasonlvhit/gocron"

coinmarketcap "github.com/hexoul/go-coinmarketcap"
Expand Down Expand Up @@ -36,17 +35,3 @@ func TestGatherTokenMetric(t *testing.T) {
gocron.Start()
time.Sleep(35 * time.Second)
}

func TestGatherKucoinBalance(t *testing.T) {
k := kucoin.New("API_KEY", "API_SECRET")
GatherKucoinBalance(k, "BTC", gocron.Every(10).Seconds())
gocron.Start()
time.Sleep(15 * time.Second)
}

func TestKucoinListMergedDealtOrders(t *testing.T) {
k := kucoin.New("API_KEY", "API_SECRET")
if ret, err := k.ListMergedDealtOrders("ETH-BTC", "BUY", 20, 1, 0, 0); err == nil {
t.Logf("%v\n", ret)
}
}

0 comments on commit 89aee54

Please sign in to comment.