You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

package virtualData
import (
"encoding/json"
"matchmaking-system/internal/data/socket/publicData"
"matchmaking-system/internal/data/tradedeal/virtual"
"matchmaking-system/internal/pkg/logging/applogger"
"matchmaking-system/internal/pkg/logging/common"
)
// SpotOrderProcessing
//
// @Description: 现货订单订阅处理
// @param topIc
// @param msg
// @return []byte
// @return *public.OrderSub
func SpotOrderProcessing(topIc string, msg virtual.SpotsTallyCache) ([]byte, *publicData.OrderSub) {
price, err := publicData.CheckSymbol(topIc, msg.Symbol)
if err != nil {
applogger.Warn("%v SpotOrderProcessing.CheckSymbol.err:%v--%v", common.ErrSpots, msg.Symbol, err)
}
orderM := &publicData.OrderSub{
OrderId: msg.OrderId,
Price: price,
Status: msg.Status,
Symbol: topIc,
Count: 0,
OpenPrice: msg.OpenPrice,
Market: msg.Symbol,
OrderNumber: msg.Order.OrderNumber,
TradeType: msg.Order.TradeType,
UserId: msg.UserId,
}
orderStr, err := json.Marshal(orderM)
if err != nil {
return []byte{}, orderM
}
return orderStr, orderM
}