max: add fee_discounted to Trade struct for RESTful api

This commit is contained in:
c9s 2023-07-25 13:35:08 +08:00
parent c42ad19955
commit f5feb72355
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
4 changed files with 12 additions and 8 deletions

View File

@ -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
}

View File

@ -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"`

View File

@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/c9s/bbgo/pkg/exchange/max/maxapi"
"net/url"
"reflect"
"regexp"

View File

@ -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"`