Created
September 2, 2021 14:26
-
-
Save kailashyogeshwar85/48f20a2c1fd7169bdbcd5d79ba7a740c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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