mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
commit
57f0888c3c
|
@ -22,4 +22,3 @@ func SaveConfigFile(filename string, v interface{}) error {
|
|||
|
||||
return ioutil.WriteFile(filename, out, 0644)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package bbgo
|
||||
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
|
@ -9,9 +8,7 @@ import (
|
|||
|
||||
func TestCalculateMovingAverage(t *testing.T) {
|
||||
klines := types.KLineWindow{
|
||||
{
|
||||
|
||||
},
|
||||
{},
|
||||
}
|
||||
_ = klines
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ type BackTestStream struct {
|
|||
types.StandardStream
|
||||
}
|
||||
|
||||
|
||||
func (s *BackTestStream) Connect(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
package bbgo
|
||||
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
package bbgo
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package bbgo
|
||||
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
@ -9,5 +8,4 @@ func TestOrderProcessor(t *testing.T) {
|
|||
processor := &OrderProcessor{}
|
||||
_ = processor
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
package bbgo
|
||||
|
||||
|
|
|
@ -15,4 +15,3 @@ type NullNotifier struct{}
|
|||
|
||||
func (n *NullNotifier) Notify(format string, args ...interface{}) {
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ func (m *StockManager) Distribution(level int) *Distribution {
|
|||
|
||||
sort.Float64s(priceLevels)
|
||||
|
||||
|
||||
return &d
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
package cmd
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -71,7 +71,6 @@ func NewStream(key, secret string) *Stream {
|
|||
stream.EmitBalanceUpdate(snapshot)
|
||||
})
|
||||
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -26,7 +26,6 @@ func (c Chan) Drain(duration, deadline time.Duration) (cnt int) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func (c Chan) Emit() {
|
||||
select {
|
||||
case c <- struct{}{}:
|
||||
|
|
|
@ -11,5 +11,3 @@ func TrendIcon(trend int) string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,4 +2,3 @@ package types
|
|||
|
||||
const Green = "#228B22"
|
||||
const Red = "#800000"
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -238,5 +238,3 @@ func (sb *StreamOrderBook) BindStream(stream Stream) {
|
|||
sb.C.Emit()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ var BookChannel = Channel("book")
|
|||
|
||||
var KLineChannel = Channel("kline")
|
||||
|
||||
|
||||
//go:generate callbackgen -type StandardStream -interface
|
||||
type StandardStream struct {
|
||||
Subscriptions []Subscription
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -20,4 +20,3 @@ func Render(tpl string, args interface{}) string {
|
|||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
|
|
@ -41,4 +41,3 @@ func (i *VolatileMemory) IsTextFresh(text string, ttl time.Duration) bool {
|
|||
i.textTimes[text] = now
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user