TimelordUK / jspurefix

native typescript FIX engine
MIT License
58 stars 27 forks source link

Custom FIX Fields #4

Closed aisfell closed 4 years ago

aisfell commented 4 years ago

I would like to add FIX4..4. MarketDataRequests with a custom optional field NoQuantityLevels:8000 and a subsequent group field Quantity:53 repeating itself up to #NoQuantityLevels

I tried to work with https://github.com/TimelordUK/jspurefix#dictionary-definitions but could not get it to work. Could you elaborate on this part a bit more?

Thanks!

TimelordUK commented 4 years ago

I will try to add a little example explaining how things are done.

aisfell commented 4 years ago

Great, thanks for the effort, looking forward to it!

TimelordUK commented 4 years ago

it is still in early stages but this demo switches to using quick fix notation with a local dictionary file - its easier to work with this imho. From here we can compile the definitions based on changes to the dictionary definitions in data\FIX44-MD.xml. Then we can add your new repeated group.

https://github.com/TimelordUK/jspf-md-demo

if you clone and install and then run

npm run generate
# npm run generate

> jspf-md-demo@1.0.0 generate C:\Users\Stephen\dev\ts\jspf-md-demo
> cd node_modules/jspurefix/dist && node jsfix-cmd "--dict=../../data/FIX44-MD.xml" "--compile" "--output=../../src/types/"

you will create definitions in src\types

then build the code

tsc

then run

# npm run md-app

> jspf-md-demo@1.0.0 md-app C:\Users\Stephen\dev\ts\jspf-md-demo
> cd dist/app && node app
2020-02-25T21:36:05.264Z [test_server:FixSession] info: [0] 8 (BeginString) = FIX4.4, [1] 9 (BodyLength) = 0000123
[2] 35 (MsgType) = V[MarketDataRequest], [3] 49 (SenderCompID) = init-comp
[4] 56 (TargetCompID) = accept-comp, [5] 34 (MsgSeqNum) = 2
[6] 57 (TargetSubID) = fix, [7] 52 (SendingTime) = 20200225-21:36:05.262
[8] 262 (MDReqID) = 1, [9] 263 (SubscriptionRequestType) = 1[SnapshotPlusUpdates]
[10] 264 (MarketDepth) = 0, [11] 267 (NoMDEntryTypes) = 2
[12] 269 (MDEntryType) = 0[Bid], [13] 269 (MDEntryType) = 0[Bid]
[14] 146 (NoRelatedSym) = 1, [15] 55 (Symbol) = EUR/USD
[16] 10 (CheckSum) = 132
2020-02-25T21:36:05.265Z [test_server:FixSession] info: forwarding msgType = 'V' to application
2020-02-25T21:36:05.266Z [test_server:MDServer] info: {
    "MDReqID": "1",
    "SubscriptionRequestType": "1",
    "MarketDepth": 0,
    "MDReqGrp": {
        "NoMDEntryTypes": [
            {
                "MDEntryType": "0"
            },
            {
                "MDEntryType": "1"
            }
        ]
    },
    "InstrmtMDReqGrp": {
        "NoRelatedSym": [
            {
                "Instrument": {
                    "Symbol": "EUR/USD"
                }
            }
        ]
    }
}
aisfell commented 4 years ago

@TimelordUK that's fantastic! Thanks! I will need to do some changes but I will get there with this demo.