Merge pull request #5 from appleboy/gofmt

refactor: run gofmt -w -s
This commit is contained in:
Yo-An Lin 2020-10-09 15:24:34 +08:00 committed by GitHub
commit 57f0888c3c
33 changed files with 66 additions and 105 deletions

View File

@ -22,4 +22,3 @@ func SaveConfigFile(filename string, v interface{}) error {
return ioutil.WriteFile(filename, out, 0644)
}

View File

@ -48,16 +48,9 @@ func calculateMovingAverage(klines types.KLineWindow, period int) (values []Indi
return values
}
func (i *MovingAverageIndicator) SubscribeStore(store *MarketDataStore) {
i.store = store
// register kline update callback
store.OnUpdate(i.handleUpdate)
}

View File

@ -1,6 +1,5 @@
package bbgo
import (
"testing"
@ -9,9 +8,7 @@ import (
func TestCalculateMovingAverage(t *testing.T) {
klines := types.KLineWindow{
{
},
{},
}
_ = klines
}

View File

@ -15,7 +15,6 @@ type BackTestStream struct {
types.StandardStream
}
func (s *BackTestStream) Connect(ctx context.Context) error {
return nil
}

View File

@ -1,2 +1 @@
package bbgo

View File

@ -1,2 +1 @@
package bbgo

View File

@ -1,6 +1,5 @@
package bbgo
import (
"testing"
)
@ -9,5 +8,4 @@ func TestOrderProcessor(t *testing.T) {
processor := &OrderProcessor{}
_ = processor
}

View File

@ -1,2 +1 @@
package bbgo

View File

@ -15,4 +15,3 @@ type NullNotifier struct{}
func (n *NullNotifier) Notify(format string, args ...interface{}) {
}

View File

@ -98,7 +98,6 @@ func (m *StockManager) Distribution(level int) *Distribution {
sort.Float64s(priceLevels)
return &d
}

View File

@ -1,2 +1 @@
package cmd

View File

@ -16,7 +16,6 @@ const (
Closed
)
type OrderState string
const (
@ -26,7 +25,6 @@ const (
OrderStateConvert = OrderState("convert")
)
type OrderType string
// Order types that the API can return.

View File

@ -212,7 +212,6 @@ func (c *RestClient) newAuthenticatedRequest(m string, refURL string, data inter
return nil, errors.New("empty api secret")
}
req, err := c.newRequest(m, refURL, nil, p)
if err != nil {
return nil, err

View File

@ -71,7 +71,6 @@ func NewStream(key, secret string) *Stream {
stream.EmitBalanceUpdate(snapshot)
})
return stream
}

View File

@ -121,8 +121,6 @@ func (s *TradeService) scanRows(rows *sqlx.Rows) (trades []types.Trade, err err
return trades, rows.Err()
}
func (s *TradeService) Insert(trade types.Trade) error {
_, err := s.DB.NamedExec(`
INSERT INTO trades (id, exchange, symbol, price, quantity, quote_quantity, side, is_buyer, is_maker, fee, fee_currency, traded_at)

View File

@ -26,7 +26,6 @@ func (c Chan) Drain(duration, deadline time.Duration) (cnt int) {
}
}
func (c Chan) Emit() {
select {
case c <- struct{}{}:

View File

@ -11,5 +11,3 @@ func TrendIcon(trend int) string {
}
return ""
}

View File

@ -2,4 +2,3 @@ package types
const Green = "#228B22"
const Red = "#800000"

View File

@ -5,4 +5,3 @@ import "github.com/leekchan/accounting"
var USD = accounting.Accounting{Symbol: "$ ", Precision: 2}
var BTC = accounting.Accounting{Symbol: "BTC ", Precision: 2}
var BNB = accounting.Accounting{Symbol: "BNB ", Precision: 4}

View File

@ -38,7 +38,6 @@ func TestKLineWindow_Truncate(t *testing.T) {
assert.Len(t, win, 3)
assert.Equal(t, 11603.0, win.Last().Open)
win.Truncate(1)
assert.Len(t, win, 1)
assert.Equal(t, 11603.0, win.Last().Open)

View File

@ -238,5 +238,3 @@ func (sb *StreamOrderBook) BindStream(stream Stream) {
sb.C.Emit()
})
}

View File

@ -18,7 +18,6 @@ var BookChannel = Channel("book")
var KLineChannel = Channel("kline")
//go:generate callbackgen -type StandardStream -interface
type StandardStream struct {
Subscriptions []Subscription

View File

@ -30,7 +30,6 @@ func ParseFloat(s string) (float64, error) {
return strconv.ParseFloat(s, 64)
}
func MustParseFloat(s string) float64 {
if len(s) == 0 {
return 0.0
@ -52,4 +51,3 @@ func Zero(v float64) bool {
func NotZero(v float64) bool {
return math.Abs(v) > epsilon
}

View File

@ -20,4 +20,3 @@ func Render(tpl string, args interface{}) string {
}
return buf.String()
}

View File

@ -41,4 +41,3 @@ func (i *VolatileMemory) IsTextFresh(text string, ttl time.Duration) bool {
i.textTimes[text] = now
return false
}