Skip to content

Instantly share code, notes, and snippets.

@kailashyogeshwar85
Created September 2, 2021 14:26
Show Gist options
  • Save kailashyogeshwar85/48f20a2c1fd7169bdbcd5d79ba7a740c to your computer and use it in GitHub Desktop.
Save kailashyogeshwar85/48f20a2c1fd7169bdbcd5d79ba7a740c to your computer and use it in GitHub Desktop.
package engine
import "encoding/json"
type Trade struct {
TakerOrderID string `json:"taker_order_id"`
MakerOrderID string `json:"maker_order_id"`
Quantity uint64 `json:"quantity"`
Price uint64 `json:"price"`
Timestamp int64 `json:"timestamp"`
}
// struct to json
func (trade *Trade) FromJSON(msg []byte) error {
return json.Unmarshal(msg, trade)
}
func (trade *Trade) ToJSON() []byte {
str, _ := json.Marshal(trade)
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment