mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1325 from zenixls2/fix/listenkeyexpired
This commit is contained in:
commit
2058ce808b
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
type EventBase struct {
|
||||
Event string `json:"e"` // event name
|
||||
Time int64 `json:"E"` // event time
|
||||
Time types.MillisecondTimestamp `json:"E"` // event time
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -461,7 +461,7 @@ func (e *DepthEvent) String() (o string) {
|
|||
|
||||
func (e *DepthEvent) OrderBook() (book types.SliceOrderBook, err error) {
|
||||
book.Symbol = e.Symbol
|
||||
book.Time = types.NewMillisecondTimestampFromInt(e.EventBase.Time).Time()
|
||||
book.Time = e.EventBase.Time.Time()
|
||||
|
||||
// already in descending order
|
||||
book.Bids = e.Bids
|
||||
|
@ -500,7 +500,7 @@ func parseDepthEvent(val *fastjson.Value) (*DepthEvent, error) {
|
|||
var depth = &DepthEvent{
|
||||
EventBase: EventBase{
|
||||
Event: string(val.GetStringBytes("e")),
|
||||
Time: val.GetInt64("E"),
|
||||
Time: types.NewMillisecondTimestampFromInt(val.GetInt64("E")),
|
||||
},
|
||||
Symbol: string(val.GetStringBytes("s")),
|
||||
FirstUpdateID: val.GetInt64("U"),
|
||||
|
|
|
@ -397,7 +397,7 @@ func TestParseOrderFuturesUpdate(t *testing.T) {
|
|||
assert.Equal(t, "SELL", orderTradeEvent.OrderTrade.Side)
|
||||
assert.Equal(t, "x-NSUYEBKMe60cf610-f5c7-49a4-9c1", orderTradeEvent.OrderTrade.ClientOrderID)
|
||||
assert.Equal(t, "MARKET", orderTradeEvent.OrderTrade.OrderType)
|
||||
assert.Equal(t, int64(1639933384763), orderTradeEvent.Time)
|
||||
assert.Equal(t, types.NewMillisecondTimestampFromInt(1639933384763), orderTradeEvent.Time)
|
||||
assert.Equal(t, types.MillisecondTimestamp(time.UnixMilli(1639933384755)), orderTradeEvent.OrderTrade.OrderTradeTime)
|
||||
assert.Equal(t, fixedpoint.MustNewFromString("0.001"), orderTradeEvent.OrderTrade.OriginalQuantity)
|
||||
assert.Equal(t, fixedpoint.MustNewFromString("0.001"), orderTradeEvent.OrderTrade.OrderLastFilledQuantity)
|
||||
|
|
|
@ -88,7 +88,7 @@ func NewStream(ex *Exchange, client *binance.Client, futuresClient *futures.Clie
|
|||
if ok {
|
||||
err := f.AddUpdate(types.SliceOrderBook{
|
||||
Symbol: e.Symbol,
|
||||
Time: types.NewMillisecondTimestampFromInt(e.EventBase.Time).Time(),
|
||||
Time: e.EventBase.Time.Time(),
|
||||
Bids: e.Bids,
|
||||
Asks: e.Asks,
|
||||
}, e.FirstUpdateID, e.FinalUpdateID)
|
||||
|
|
|
@ -527,8 +527,7 @@ func (s *Strategy) handleAccountUpdate(ctx context.Context, e *binance.AccountUp
|
|||
if b.Asset != s.ProfitStats.FundingFeeCurrency {
|
||||
continue
|
||||
}
|
||||
|
||||
txnTime := time.UnixMilli(e.Time)
|
||||
txnTime := e.EventBase.Time.Time()
|
||||
fee := FundingFee{
|
||||
Asset: b.Asset,
|
||||
Amount: b.BalanceChange,
|
||||
|
|
Loading…
Reference in New Issue
Block a user