fixes in quotes
This commit is contained in:
@ -325,14 +325,15 @@ func (cont *Controller) SendQuote(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
bidPx, offerPx, bidSize, offerSize, err := req.toDecimals()
|
||||
bidPx, offerPx, _, _, err := req.toDecimals()
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusBadRequest, HTTPError{Error: err.Error()})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if err = cont.fixSender.SendQuote(req.ClOrdID, req.QuoteID, req.Symbol, req.Currency, bidPx, offerPx, bidSize, offerSize); err != nil {
|
||||
if err = cont.fixSender.SendQuote(
|
||||
req.ClOrdID, req.QuoteID, req.Symbol, req.SecurityIDSource, req.Currency, bidPx, offerPx); err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, HTTPError{Error: err.Error()})
|
||||
|
||||
return
|
||||
|
||||
@ -24,14 +24,13 @@ type Session struct {
|
||||
}
|
||||
|
||||
type QuoteRequest struct {
|
||||
ClOrdID string `json:"cl_ord_id" binding:"required"`
|
||||
QuoteID string `json:"quote_id" binding:"required"`
|
||||
Symbol string `json:"symbol" binding:"required"`
|
||||
Currency string `json:"currency"`
|
||||
BidPx string `json:"bid_px" binding:"required"`
|
||||
OfferPx string `json:"offer_px" binding:"required"`
|
||||
BidSize string `json:"bid_size"`
|
||||
OfferSize string `json:"offer_size"`
|
||||
ClOrdID string `json:"cl_ord_id" binding:"required"`
|
||||
QuoteID string `json:"quote_id" binding:"required"`
|
||||
Symbol string `json:"symbol" binding:"required"`
|
||||
Currency string `json:"currency"`
|
||||
BidPx string `json:"bid_px" binding:"required"`
|
||||
OfferPx string `json:"offer_px" binding:"required"`
|
||||
SecurityIDSource string `json:"security_id_source" binding:"required"`
|
||||
}
|
||||
|
||||
func (r QuoteRequest) toDecimals() (bidPx, offerPx, bidSize, offerSize decimal.Decimal, err error) {
|
||||
@ -45,19 +44,5 @@ func (r QuoteRequest) toDecimals() (bidPx, offerPx, bidSize, offerSize decimal.D
|
||||
return bidPx, offerPx, bidSize, offerSize, fmt.Errorf("invalid offer_px: %w", err)
|
||||
}
|
||||
|
||||
if r.BidSize != "" {
|
||||
bidSize, err = decimal.NewFromString(r.BidSize)
|
||||
if err != nil {
|
||||
return bidPx, offerPx, bidSize, offerSize, fmt.Errorf("invalid bid_size: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if r.OfferSize != "" {
|
||||
offerSize, err = decimal.NewFromString(r.OfferSize)
|
||||
if err != nil {
|
||||
return bidPx, offerPx, bidSize, offerSize, fmt.Errorf("invalid offer_size: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return bidPx, offerPx, bidSize, offerSize, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user