Skip to content

Commit

Permalink
Build cancel orders without using quickfixgo-fix50sp2
Browse files Browse the repository at this point in the history
The use of quickfixgo-fix50sp2 messages types grows the size of
the binaries from 15 to 80MiB.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
  • Loading branch information
sylr committed Nov 23, 2022
1 parent 728f5bf commit fc61159
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cmd/cancel/mass/mass.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/quickfixgo/tag"
"github.com/rs/zerolog"
"github.com/spf13/cobra"
"github.com/sylr/quickfixgo-fix50sp2/ordermasscancelrequest"

"sylr.dev/fix/config"
"sylr.dev/fix/pkg/cli/complete"
Expand Down Expand Up @@ -263,10 +262,11 @@ func buildMessage(session config.Session) (quickfix.Messagable, error) {
case quickfix.BeginStringFIXT11:
switch session.DefaultApplVerID {
case "FIX.5.0SP2":
message := ordermasscancelrequest.New(
field.NewClOrdID(optionOrderSymbol+"_CANCELREQ"),
field.NewMassCancelRequestType(enum.MassCancelRequestType_CANCEL_ORDERS_FOR_A_SECURITY),
field.NewTransactTime(time.Now()))
message := quickfix.NewMessage()
message.Header.Set(field.NewMsgType(enum.MsgType_ORDER_MASS_CANCEL_REQUEST))
message.Body.Set(field.NewClOrdID(optionOrderSymbol + "_CANCELREQ"))
message.Body.Set(field.NewMassCancelRequestType(enum.MassCancelRequestType_CANCEL_ORDERS_FOR_A_SECURITY))
message.Body.Set(field.NewTransactTime(time.Now()))
message.Body.Set(field.NewSide(eside))
message.Body.Set(field.NewSymbol(optionOrderSymbol))
return message, nil
Expand Down
10 changes: 5 additions & 5 deletions cmd/cancel/order/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/quickfixgo/tag"
"github.com/rs/zerolog"
"github.com/spf13/cobra"
"github.com/sylr/quickfixgo-fix50sp2/ordercancelrequest"

"sylr.dev/fix/config"
"sylr.dev/fix/pkg/cli/complete"
Expand Down Expand Up @@ -273,10 +272,11 @@ func buildMessage(session config.Session) (quickfix.Messagable, error) {
case quickfix.BeginStringFIXT11:
switch session.DefaultApplVerID {
case "FIX.5.0SP2":
message := ordercancelrequest.New(
field.NewClOrdID(orderId+"_CANCEL"),
field.NewSide(eside),
field.NewTransactTime(time.Now()))
message := quickfix.NewMessage()
message.Header.Set(field.NewMsgType(enum.MsgType_ORDER_CANCEL_REQUEST))
message.Body.Set(field.NewClOrdID(orderId + "_CANCEL"))
message.Body.Set(field.NewSide(eside))
message.Body.Set(field.NewTransactTime(time.Now()))
message.Body.Set(field.NewOrderID(orderId))
message.Body.Set(field.NewOrigClOrdID(orderId))
message.Body.Set(field.NewSymbol(optionOrderSymbol))
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ require (
github.com/spf13/pflag v1.0.5
github.com/sylr/quickfixgo-fix50sp2/marketdataincrementalrefresh v0.0.0-20220401195242-281940b8a21e
github.com/sylr/quickfixgo-fix50sp2/marketdatasnapshotfullrefresh v0.0.0-20220401195242-281940b8a21e
github.com/sylr/quickfixgo-fix50sp2/ordercancelrequest v0.0.0-20220401195242-281940b8a21e
github.com/sylr/quickfixgo-fix50sp2/ordermasscancelrequest v0.0.0-20220401195242-281940b8a21e
golang.org/x/crypto v0.1.0
golang.org/x/term v0.2.0
sylr.dev/yaml/age/v3 v3.0.0-20220527135827-28ffff5246ba
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ github.com/sylr/quickfixgo-fix50sp2/marketdataincrementalrefresh v0.0.0-20220401
github.com/sylr/quickfixgo-fix50sp2/marketdataincrementalrefresh v0.0.0-20220401195242-281940b8a21e/go.mod h1:Y+n22fYjye1/k2WZI2CvXkI/fctyK5n+W+JEO6Lm8Ww=
github.com/sylr/quickfixgo-fix50sp2/marketdatasnapshotfullrefresh v0.0.0-20220401195242-281940b8a21e h1:8XKdB93K4wo67ii+24Q2TVBUR3ePE7vld4C6RaL+hx0=
github.com/sylr/quickfixgo-fix50sp2/marketdatasnapshotfullrefresh v0.0.0-20220401195242-281940b8a21e/go.mod h1:1XIFhk2nD4JvmemzCJ6JF8J7AgMM59cvVaGySfFWR9w=
github.com/sylr/quickfixgo-fix50sp2/ordercancelrequest v0.0.0-20220401195242-281940b8a21e h1:Njfrl0DtBxrETptx7tul9Xk2u8vVX1EyJd6IyxRUs40=
github.com/sylr/quickfixgo-fix50sp2/ordercancelrequest v0.0.0-20220401195242-281940b8a21e/go.mod h1:jzMbDM9WeFDIwvZt9o/oKAeU1Ek3cXeL/g6crsmPFJI=
github.com/sylr/quickfixgo-fix50sp2/ordermasscancelrequest v0.0.0-20220401195242-281940b8a21e h1:umMECa428yH+9TISu+SNO7Ck8oZgJCvST1TtTiTMWLo=
github.com/sylr/quickfixgo-fix50sp2/ordermasscancelrequest v0.0.0-20220401195242-281940b8a21e/go.mod h1:TsGSYcjossjVxEzofRKw8j/8knjjQHWFvz2HdmoG83Y=
github.com/sylr/quickfixgo-tag v0.0.0-20220401193001-96cf7367fdfa h1:rNZGd/w6irrFOt0is49fO3ncZFTSTpJoFPuv4VPwTrk=
github.com/sylr/quickfixgo-tag v0.0.0-20220401193001-96cf7367fdfa/go.mod h1:W1mRUo/BCgwb8r/AMNRcjPccxah1VHLrku2lyEi6sa8=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down

0 comments on commit fc61159

Please sign in to comment.