Skip to content

Instantly share code, notes, and snippets.

@kailashyogeshwar85
Created September 2, 2021 14:21
Show Gist options
  • Save kailashyogeshwar85/9ff3a48c35672326809abe3c43dc5e84 to your computer and use it in GitHub Desktop.
Save kailashyogeshwar85/9ff3a48c35672326809abe3c43dc5e84 to your computer and use it in GitHub Desktop.
ome-order
package engine
import (
"encoding/json"
"github.com/shopspring/decimal"
)
// Order Type
type Order struct {
ID string `json:"id"`
Side Side `json:"side"`
Quantity decimal.Decimal `json:"quantity"`
Price decimal.Decimal `json:"price"`
Timestamp int64 `json:"timestamp"`
}
// Convert order to struct from json
func (order *Order) FromJSON(msg []byte) error {
return json.Unmarshal(msg, order)
}
// Convert order to json from order struct
func (order *Order) toJSON() []byte {
str, _ := json.Marshal(order)
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment