2023-03-08 09:18:18 +00:00
|
|
|
package v3
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
|
|
|
"github.com/c9s/bbgo/pkg/types"
|
|
|
|
)
|
|
|
|
|
2023-07-25 05:35:08 +00:00
|
|
|
type Liquidity string
|
|
|
|
|
|
|
|
const (
|
|
|
|
LiquidityMaker = "maker"
|
|
|
|
LiquidityTaker = "taker"
|
|
|
|
)
|
|
|
|
|
2023-03-08 09:18:18 +00:00
|
|
|
type Trade struct {
|
2023-07-27 08:28:54 +00:00
|
|
|
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"`
|
2024-04-08 08:10:22 +00:00
|
|
|
Fee *fixedpoint.Value `json:"fee"` // float number in string, could be optional
|
2023-07-27 08:28:54 +00:00
|
|
|
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"`
|
2023-03-08 09:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t Trade) IsBuyer() bool {
|
|
|
|
return t.Side == "bid"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t Trade) IsMaker() bool {
|
|
|
|
return t.Liquidity == "maker"
|
|
|
|
}
|