diff --git a/pkg/exchange/max/convert.go b/pkg/exchange/max/convert.go index 48b7687f7..3368ffc7b 100644 --- a/pkg/exchange/max/convert.go +++ b/pkg/exchange/max/convert.go @@ -285,9 +285,6 @@ func convertWebSocketTrade(t max.TradeUpdate) (*types.Trade, error) { // skip trade ID that is the same. however this should not happen var side = toGlobalSideType(t.Side) - // trade time - mts := time.Unix(0, t.Timestamp*int64(time.Millisecond)) - return &types.Trade{ ID: t.ID, OrderID: t.OrderID, @@ -301,7 +298,7 @@ func convertWebSocketTrade(t max.TradeUpdate) (*types.Trade, error) { Fee: t.Fee, FeeCurrency: toGlobalCurrency(t.FeeCurrency), QuoteQuantity: t.Price.Mul(t.Volume), - Time: types.Time(mts), + Time: types.Time(t.Timestamp.Time()), }, nil } diff --git a/pkg/exchange/max/maxapi/userdata.go b/pkg/exchange/max/maxapi/userdata.go index 26ff6cf4b..03a06f8cc 100644 --- a/pkg/exchange/max/maxapi/userdata.go +++ b/pkg/exchange/max/maxapi/userdata.go @@ -104,8 +104,8 @@ type TradeUpdate struct { FeeCurrency string `json:"fc"` FeeDiscounted bool `json:"fd"` - Timestamp int64 `json:"T"` - UpdateTime int64 `json:"TU"` + Timestamp types.MillisecondTimestamp `json:"T"` + UpdateTime int64 `json:"TU"` OrderID uint64 `json:"oi"` diff --git a/pkg/exchange/max/maxapi/v3/get_wallet_trades_request_requestgen.go b/pkg/exchange/max/maxapi/v3/get_wallet_trades_request_requestgen.go index 647916103..2baeeb611 100644 --- a/pkg/exchange/max/maxapi/v3/get_wallet_trades_request_requestgen.go +++ b/pkg/exchange/max/maxapi/v3/get_wallet_trades_request_requestgen.go @@ -6,7 +6,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/c9s/bbgo/pkg/exchange/max/maxapi" "net/url" "reflect" "regexp" diff --git a/pkg/exchange/max/maxapi/v3/trade.go b/pkg/exchange/max/maxapi/v3/trade.go index c9e975bb0..1774e4ba5 100644 --- a/pkg/exchange/max/maxapi/v3/trade.go +++ b/pkg/exchange/max/maxapi/v3/trade.go @@ -5,6 +5,13 @@ import ( "github.com/c9s/bbgo/pkg/types" ) +type Liquidity string + +const ( + LiquidityMaker = "maker" + LiquidityTaker = "taker" +) + type Trade struct { ID uint64 `json:"id" db:"exchange_id"` WalletType WalletType `json:"wallet_type,omitempty"` @@ -18,7 +25,8 @@ type Trade struct { OrderID uint64 `json:"order_id"` Fee fixedpoint.Value `json:"fee"` // float number as string FeeCurrency string `json:"fee_currency"` - Liquidity string `json:"liquidity"` + FeeDiscounted bool `json:"fee_discounted"` + Liquidity Liquidity `json:"liquidity"` SelfTradeBidFee fixedpoint.Value `json:"self_trade_bid_fee"` SelfTradeBidFeeCurrency string `json:"self_trade_bid_fee_currency"` SelfTradeBidOrderID uint64 `json:"self_trade_bid_order_id"`