add db tags

This commit is contained in:
c9s 2020-11-02 22:17:18 +08:00
parent 8388f443a9
commit f223940b69

View File

@ -10,10 +10,10 @@ import (
type OrderType string
const (
OrderTypeLimit OrderType = "LIMIT"
OrderTypeMarket OrderType = "MARKET"
OrderTypeStopLimit OrderType = "STOP_LIMIT"
OrderTypeStopMarket OrderType = "STOP_MARKET"
OrderTypeLimit OrderType = "LIMIT"
OrderTypeMarket OrderType = "MARKET"
OrderTypeStopLimit OrderType = "STOP_LIMIT"
OrderTypeStopMarket OrderType = "STOP_MARKET"
)
type OrderStatus string
@ -29,31 +29,31 @@ const (
type Order struct {
SubmitOrder
OrderID uint64 `json:"orderID"` // order id
Status OrderStatus `json:"status"`
ExecutedQuantity float64 `json:"executedQuantity"`
CreationTime time.Time
OrderID uint64 `json:"orderID" db:"order_id"` // order id
Status OrderStatus `json:"status" db:"status"`
ExecutedQuantity float64 `json:"executedQuantity" db:"executed_quantity"`
CreationTime time.Time `json:"creationTime" db:"created_at"`
}
type SubmitOrder struct {
ClientOrderID string `json:"clientOrderID"`
ClientOrderID string `json:"clientOrderID" db:"client_order_id"`
Symbol string
Side SideType
Type OrderType
Symbol string `json:"symbol" db:"symbol"`
Side SideType `json:"side" db:"side"`
Type OrderType `json:"orderType" db:"order_type"`
Quantity float64
Price float64
StopPrice float64
Quantity float64 `json:"quantity" db:"quantity"`
Price float64 `json:"price" db:"price"`
StopPrice float64 `json:"stopPrice" db:"stop_price"`
Market Market
Market Market `json:"market" db:"-"`
// TODO: we can probably remove these field
StopPriceString string
PriceString string
QuantityString string
StopPriceString string `json:"-"`
PriceString string `json:"-"`
QuantityString string `json:"-"`
TimeInForce string `json:"timeInForce"` // GTC, IOC, FOK
TimeInForce string `json:"timeInForce" db:"time_in_force"` // GTC, IOC, FOK
}
func (o *SubmitOrder) SlackAttachment() slack.Attachment {