diff --git a/go.mod b/go.mod index d07893f3c..8e4358027 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ go 1.13 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 - github.com/adshao/go-binance/v2 v2.2.1-0.20210119141603-20ceb26d876b + github.com/adshao/go-binance/v2 v2.2.1 github.com/c9s/rockhopper v1.2.1-0.20210217093258-2661955904a9 github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482 github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect diff --git a/go.sum b/go.sum index 7f2248cc0..5c686bb04 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/adshao/go-binance/v2 v2.2.1-0.20210119141603-20ceb26d876b h1:5GJlWxRjR3y7nPt/tIRCVcL4x/82yXpTBXsXJoLT0FY= github.com/adshao/go-binance/v2 v2.2.1-0.20210119141603-20ceb26d876b/go.mod h1:o+84WK3DQxq9vEKV9ncRcQi+J7RFCGhM27osbECZiJQ= +github.com/adshao/go-binance/v2 v2.2.1 h1:H5tfXqDu+bx1mZqJP+5gc8ahidgDFvj683M3RStg9C4= +github.com/adshao/go-binance/v2 v2.2.1/go.mod h1:o+84WK3DQxq9vEKV9ncRcQi+J7RFCGhM27osbECZiJQ= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= diff --git a/pkg/cmd/builtin.go b/pkg/cmd/builtin.go index b450e538d..4f2e8114a 100644 --- a/pkg/cmd/builtin.go +++ b/pkg/cmd/builtin.go @@ -5,13 +5,13 @@ import ( _ "github.com/c9s/bbgo/pkg/strategy/bollgrid" _ "github.com/c9s/bbgo/pkg/strategy/buyandhold" _ "github.com/c9s/bbgo/pkg/strategy/flashcrash" + _ "github.com/c9s/bbgo/pkg/strategy/gap" _ "github.com/c9s/bbgo/pkg/strategy/grid" _ "github.com/c9s/bbgo/pkg/strategy/mirrormaker" _ "github.com/c9s/bbgo/pkg/strategy/pricealert" _ "github.com/c9s/bbgo/pkg/strategy/support" _ "github.com/c9s/bbgo/pkg/strategy/swing" _ "github.com/c9s/bbgo/pkg/strategy/trailingstop" - _ "github.com/c9s/bbgo/pkg/strategy/gap" _ "github.com/c9s/bbgo/pkg/strategy/xmaker" _ "github.com/c9s/bbgo/pkg/strategy/xpuremaker" ) diff --git a/pkg/cmd/pnl.go b/pkg/cmd/pnl.go index 93e0848d8..19c815442 100644 --- a/pkg/cmd/pnl.go +++ b/pkg/cmd/pnl.go @@ -51,7 +51,6 @@ var PnLCmd = &cobra.Command{ return err } - sessionName, err := cmd.Flags().GetString("session") if err != nil { return err @@ -86,7 +85,7 @@ var PnLCmd = &cobra.Command{ return fmt.Errorf("session %s not found", sessionName) } - if err := environ.SyncSession(ctx, session) ; err != nil { + if err := environ.SyncSession(ctx, session); err != nil { return err } diff --git a/pkg/cmd/sync.go b/pkg/cmd/sync.go index 734476f23..29d361bf9 100644 --- a/pkg/cmd/sync.go +++ b/pkg/cmd/sync.go @@ -50,7 +50,7 @@ var SyncCmd = &cobra.Command{ } environ := bbgo.NewEnvironment() - if err := environ.ConfigureDatabase(ctx) ; err != nil { + if err := environ.ConfigureDatabase(ctx); err != nil { return err } @@ -64,7 +64,7 @@ var SyncCmd = &cobra.Command{ ) if len(since) > 0 { - loc, err := time.LoadLocation("Asia/Taipei") + loc, err := time.LoadLocation("Local") if err != nil { return err } @@ -110,4 +110,3 @@ var SyncCmd = &cobra.Command{ return nil }, } - diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 5044058c6..72393dd4f 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -21,4 +21,3 @@ var VersionCmd = &cobra.Command{ fmt.Println(version.Version) }, } - diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index 379aa0480..b38033f80 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -288,6 +288,14 @@ func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, until time.Time) (allDeposits []types.Deposit, err error) { startTime := since + + var emptyTime = time.Time{} + if startTime == emptyTime { + startTime, err = e.getLaunchDate() + if err != nil { + return nil, err + } + } txIDs := map[string]struct{}{} for startTime.Before(until) {