Skip to content

Commit

Permalink
🔧 refactor(coinbase): add omitempty to field tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dboyliao committed Feb 27, 2025
1 parent 7723744 commit 214c7b2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/exchange/coinbase/stream_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ type ReceivedMessage struct {
Time time.Time `json:"time"`

// limit order fields
Size fixedpoint.Value `json:"size"`
Price fixedpoint.Value `json:"price"`
Size fixedpoint.Value `json:"size,omitempty"`
Price fixedpoint.Value `json:"price,omitempty"`

// market order fields
Funds fixedpoint.Value `json:"funds"`
Funds fixedpoint.Value `json:"funds,omitempty"`
}

func (m *ReceivedMessage) IsMarketOrder() bool {
Expand Down Expand Up @@ -179,14 +179,14 @@ type MatchMessage struct {
ProfileID string `json:"profile_id"`

// extra fields for taker
TakerUserID string `json:"taker_user_id"`
TakerProfileID string `json:"taker_profile_id"`
TakerFeeRate string `json:"taker_fee_rate"`
TakerUserID string `json:"taker_user_id,omitempty"`
TakerProfileID string `json:"taker_profile_id,omitempty"`
TakerFeeRate string `json:"taker_fee_rate,omitempty"`

// extra fields for maker
MakerUserID string `json:"maker_user_id"`
MakerProfileID string `json:"maker_profile_id"`
MakerFeeRate string `json:"maker_fee_rate"`
MakerUserID string `json:"maker_user_id,omitempty"`
MakerProfileID string `json:"maker_profile_id,omitempty"`
MakerFeeRate string `json:"maker_fee_rate,omitempty"`
}

func (m *MatchMessage) IsAuthTaker() bool {
Expand All @@ -204,11 +204,11 @@ type ChangeMessage struct {
NewSize fixedpoint.Value `json:"new_size"`

// STP fields
Price fixedpoint.Value `json:"price"`
Price fixedpoint.Value `json:"price,omitempty"`

// modify_order fields
OldPrice fixedpoint.Value `json:"old_price"`
NewPrice fixedpoint.Value `json:"new_price"`
OldPrice fixedpoint.Value `json:"old_price,omitempty"`
NewPrice fixedpoint.Value `json:"new_price,omitempty"`
}

func (m *ChangeMessage) IsStp() bool {
Expand Down

0 comments on commit 214c7b2

Please sign in to comment.