From b02ac837ea3e7d04eae9c843e983a8b673f1e939 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 27 Jul 2023 16:28:54 +0800 Subject: [PATCH] max: handle SelfTradeBidFeeDiscounted --- pkg/exchange/max/convert.go | 2 ++ pkg/exchange/max/maxapi/v3/trade.go | 35 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pkg/exchange/max/convert.go b/pkg/exchange/max/convert.go index 4c578bde6..b6ea59ba2 100644 --- a/pkg/exchange/max/convert.go +++ b/pkg/exchange/max/convert.go @@ -211,6 +211,7 @@ func toGlobalTradeV3(t v3.Trade) ([]types.Trade, error) { IsMaker: t.IsMaker(), Fee: t.Fee, FeeCurrency: toGlobalCurrency(t.FeeCurrency), + FeeDiscounted: t.FeeDiscounted, QuoteQuantity: t.Funds, Time: types.Time(t.CreatedAt), IsMargin: isMargin, @@ -227,6 +228,7 @@ func toGlobalTradeV3(t v3.Trade) ([]types.Trade, error) { bidTrade.OrderID = t.SelfTradeBidOrderID bidTrade.Fee = t.SelfTradeBidFee bidTrade.FeeCurrency = toGlobalCurrency(t.SelfTradeBidFeeCurrency) + bidTrade.FeeDiscounted = t.SelfTradeBidFeeDiscounted bidTrade.IsBuyer = !trade.IsBuyer bidTrade.IsMaker = !trade.IsMaker trades = append(trades, bidTrade) diff --git a/pkg/exchange/max/maxapi/v3/trade.go b/pkg/exchange/max/maxapi/v3/trade.go index 1774e4ba5..d5569deb6 100644 --- a/pkg/exchange/max/maxapi/v3/trade.go +++ b/pkg/exchange/max/maxapi/v3/trade.go @@ -13,23 +13,24 @@ const ( ) type Trade struct { - ID uint64 `json:"id" db:"exchange_id"` - WalletType WalletType `json:"wallet_type,omitempty"` - Price fixedpoint.Value `json:"price"` - Volume fixedpoint.Value `json:"volume"` - Funds fixedpoint.Value `json:"funds"` - Market string `json:"market"` - MarketName string `json:"market_name"` - CreatedAt types.MillisecondTimestamp `json:"created_at"` - Side string `json:"side"` - OrderID uint64 `json:"order_id"` - Fee fixedpoint.Value `json:"fee"` // float number as string - FeeCurrency string `json:"fee_currency"` - 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"` + ID uint64 `json:"id" db:"exchange_id"` + WalletType WalletType `json:"wallet_type,omitempty"` + Price fixedpoint.Value `json:"price"` + Volume fixedpoint.Value `json:"volume"` + Funds fixedpoint.Value `json:"funds"` + Market string `json:"market"` + MarketName string `json:"market_name"` + CreatedAt types.MillisecondTimestamp `json:"created_at"` + Side string `json:"side"` + OrderID uint64 `json:"order_id"` + Fee fixedpoint.Value `json:"fee"` // float number as string + FeeCurrency string `json:"fee_currency"` + 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"` + SelfTradeBidFeeDiscounted bool `json:"self_trade_bid_fee_discounted"` + SelfTradeBidOrderID uint64 `json:"self_trade_bid_order_id"` } func (t Trade) IsBuyer() bool {