jspurefix 1.1.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +1 -1
- package/README.md +48 -2
- package/appveyor.yml +43 -11
- package/data/FIX44-MD.xml +6596 -0
- package/data/examples/FIX.4.4/jsfix.test_client.txt +15 -13
- package/data/session/test-qf44-acceptor.json +21 -0
- package/data/session/test-qf44-initiator.json +22 -0
- package/dist/buffer/ascii/ascii-encoder.d.ts +9 -2
- package/dist/buffer/ascii/ascii-encoder.js +72 -31
- package/dist/buffer/ascii/ascii-encoder.js.map +1 -1
- package/dist/buffer/ascii/ascii-parser.d.ts +1 -0
- package/dist/buffer/ascii/ascii-parser.js +7 -1
- package/dist/buffer/ascii/ascii-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-segment-parser.d.ts +0 -2
- package/dist/buffer/ascii/ascii-segment-parser.js +19 -25
- package/dist/buffer/ascii/ascii-segment-parser.js.map +1 -1
- package/dist/buffer/ascii/ascii-view.d.ts +2 -0
- package/dist/buffer/ascii/ascii-view.js +4 -0
- package/dist/buffer/ascii/ascii-view.js.map +1 -1
- package/dist/buffer/ascii/time-formatter.js.map +1 -1
- package/dist/buffer/ascii-chars.d.ts +1 -0
- package/dist/buffer/ascii-chars.js +1 -0
- package/dist/buffer/ascii-chars.js.map +1 -1
- package/dist/buffer/elastic-buffer.d.ts +1 -0
- package/dist/buffer/elastic-buffer.js +8 -0
- package/dist/buffer/elastic-buffer.js.map +1 -1
- package/dist/buffer/encode-proxy.js.map +1 -1
- package/dist/buffer/fixml/fixml-encoder.d.ts +3 -0
- package/dist/buffer/fixml/fixml-encoder.js +6 -0
- package/dist/buffer/fixml/fixml-encoder.js.map +1 -1
- package/dist/buffer/fixml/fixml-view.d.ts +2 -0
- package/dist/buffer/fixml/fixml-view.js +3 -0
- package/dist/buffer/fixml/fixml-view.js.map +1 -1
- package/dist/buffer/msg-encoder.d.ts +2 -0
- package/dist/buffer/msg-encoder.js.map +1 -1
- package/dist/buffer/msg-view.d.ts +2 -0
- package/dist/buffer/msg-view.js.map +1 -1
- package/dist/buffer/tags.js +5 -5
- package/dist/buffer/tags.js.map +1 -1
- package/dist/collections/dictionary.d.ts +1 -0
- package/dist/collections/dictionary.js +5 -0
- package/dist/collections/dictionary.js.map +1 -1
- package/dist/config/js-fix-config.d.ts +2 -0
- package/dist/config/js-fix-config.js +1 -0
- package/dist/config/js-fix-config.js.map +1 -1
- package/dist/dict-parser.js +2 -2
- package/dist/dict-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/field-set-parser.js +11 -4
- package/dist/dictionary/parser/quickfix/field-set-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/message-parser.js +4 -0
- package/dist/dictionary/parser/quickfix/message-parser.js.map +1 -1
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.d.ts +1 -0
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js +15 -0
- package/dist/dictionary/parser/quickfix/quick-fix-xml-file-parser.js.map +1 -1
- package/dist/jsfix-cmd.js +2 -1
- package/dist/jsfix-cmd.js.map +1 -1
- package/dist/sample/http/oms/app.js +2 -0
- package/dist/sample/http/oms/app.js.map +1 -1
- package/dist/sample/launcher.d.ts +3 -2
- package/dist/sample/launcher.js +12 -3
- package/dist/sample/launcher.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → qf-md}/app.d.ts +0 -0
- package/dist/sample/tcp/qf-md/app.js +22 -0
- package/dist/sample/tcp/qf-md/app.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-client.d.ts +15 -0
- package/dist/sample/tcp/qf-md/md-client.js +42 -0
- package/dist/sample/tcp/qf-md/md-client.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-factory.d.ts +4 -0
- package/dist/sample/tcp/qf-md/md-factory.js +35 -0
- package/dist/sample/tcp/qf-md/md-factory.js.map +1 -0
- package/dist/sample/tcp/qf-md/md-server.d.ts +16 -0
- package/dist/sample/tcp/qf-md/md-server.js +44 -0
- package/dist/sample/tcp/qf-md/md-server.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/app.d.ts +1 -0
- package/dist/sample/tcp/recovering-skeleton/app.js +27 -0
- package/dist/sample/tcp/recovering-skeleton/app.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.d.ts +2 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js +3 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-2.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.d.ts +7 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js +52 -0
- package/dist/sample/tcp/recovering-skeleton/respawn-acceptor.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.d.ts +16 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js +45 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-client.js.map +1 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.d.ts +16 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js +52 -0
- package/dist/sample/tcp/recovering-skeleton/skeleton-server.js.map +1 -0
- package/dist/sample/tcp/skeleton/app.js +2 -0
- package/dist/sample/tcp/skeleton/app.js.map +1 -1
- package/dist/sample/tcp/skeleton/skeleton-session.d.ts +5 -1
- package/dist/sample/tcp/skeleton/skeleton-session.js +22 -3
- package/dist/sample/tcp/skeleton/skeleton-session.js.map +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js +1 -1
- package/dist/sample/tcp/tls-trade-capture/app.js.map +1 -1
- package/dist/sample/tcp/trade-capture/app.d.ts +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/app.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/app.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/index.js.map +1 -1
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.d.ts +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.js +8 -4
- package/dist/sample/tcp/trade-capture/trade-capture-client.js.map +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.js +1 -1
- package/dist/sample/tcp/trade-capture/trade-capture-server.js.map +1 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.d.ts +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.js +0 -0
- package/dist/sample/tcp/{trade_capture → trade-capture}/trade-factory.js.map +1 -1
- package/dist/store/fix-msg-ascii-store-resend.d.ts +6 -2
- package/dist/store/fix-msg-ascii-store-resend.js +49 -22
- package/dist/store/fix-msg-ascii-store-resend.js.map +1 -1
- package/dist/store/fix-msg-memory-store.d.ts +11 -8
- package/dist/store/fix-msg-memory-store.js +108 -42
- package/dist/store/fix-msg-memory-store.js.map +1 -1
- package/dist/store/fix-msg-store-record.d.ts +7 -3
- package/dist/store/fix-msg-store-record.js +5 -1
- package/dist/store/fix-msg-store-record.js.map +1 -1
- package/dist/store/fix-msg-store.d.ts +13 -9
- package/dist/store/fix-msg-store.js.map +1 -1
- package/dist/test/ascii-encode.test.js +20 -3
- package/dist/test/ascii-encode.test.js.map +1 -1
- package/dist/test/ascii-encoder.test.d.ts +1 -0
- package/dist/test/ascii-encoder.test.js +505 -0
- package/dist/test/ascii-encoder.test.js.map +1 -0
- package/dist/test/ascii-parser.test.js +8 -6
- package/dist/test/ascii-parser.test.js.map +1 -1
- package/dist/test/ascii-segment.test.js +6 -5
- package/dist/test/ascii-segment.test.js.map +1 -1
- package/dist/test/ascii-store-replay.test.js +59 -44
- package/dist/test/ascii-store-replay.test.js.map +1 -1
- package/dist/test/logon.test.js +1 -1
- package/dist/test/logon.test.js.map +1 -1
- package/dist/test/memory-store.test.js +24 -19
- package/dist/test/memory-store.test.js.map +1 -1
- package/dist/test/qf-full-msg.test.js +19 -14
- package/dist/test/qf-full-msg.test.js.map +1 -1
- package/dist/test/repo-full-ascii-msg.test.js +17 -15
- package/dist/test/repo-full-ascii-msg.test.js.map +1 -1
- package/dist/test/repo-full-fixml-msg.test.js +14 -14
- package/dist/test/repo-full-fixml-msg.test.js.map +1 -1
- package/dist/test/session-state.test.js +2 -2
- package/dist/test/session-state.test.js.map +1 -1
- package/dist/test/session.test.js +263 -143
- package/dist/test/session.test.js.map +1 -1
- package/dist/test/view-decode.test.js +2 -1
- package/dist/test/view-decode.test.js.map +1 -1
- package/dist/transport/a-session-msg-factory.d.ts +23 -0
- package/dist/transport/a-session-msg-factory.js +58 -0
- package/dist/transport/a-session-msg-factory.js.map +1 -0
- package/dist/transport/ascii/ascii-msg-transmitter.d.ts +1 -0
- package/dist/transport/ascii/ascii-msg-transmitter.js +39 -8
- package/dist/transport/ascii/ascii-msg-transmitter.js.map +1 -1
- package/dist/transport/ascii/ascii-session-msg-factory.d.ts +16 -0
- package/dist/transport/ascii/ascii-session-msg-factory.js +47 -0
- package/dist/transport/ascii/ascii-session-msg-factory.js.map +1 -0
- package/dist/transport/ascii/ascii-session.d.ts +10 -2
- package/dist/transport/ascii/ascii-session.js +86 -31
- package/dist/transport/ascii/ascii-session.js.map +1 -1
- package/dist/transport/ascii/index.d.ts +1 -0
- package/dist/transport/ascii/index.js +1 -0
- package/dist/transport/ascii/index.js.map +1 -1
- package/dist/transport/ascii-session-msg-factory.d.ts +16 -0
- package/dist/transport/ascii-session-msg-factory.js +47 -0
- package/dist/transport/ascii-session-msg-factory.js.map +1 -0
- package/dist/transport/duplex/http-duplex.js +2 -2
- package/dist/transport/duplex/http-duplex.js.map +1 -1
- package/dist/transport/fix-msg-factory.d.ts +1 -1
- package/dist/transport/fix-msg-factory.js.map +1 -1
- package/dist/transport/fix-session-state.d.ts +38 -12
- package/dist/transport/fix-session-state.js +49 -15
- package/dist/transport/fix-session-state.js.map +1 -1
- package/dist/transport/fix-session.d.ts +13 -6
- package/dist/transport/fix-session.js +143 -39
- package/dist/transport/fix-session.js.map +1 -1
- package/dist/transport/fixml/fixml-session-msg-factory.d.ts +13 -0
- package/dist/transport/fixml/fixml-session-msg-factory.js +68 -0
- package/dist/transport/fixml/fixml-session-msg-factory.js.map +1 -0
- package/dist/transport/fixml/fixml-session.js +1 -1
- package/dist/transport/fixml/fixml-session.js.map +1 -1
- package/dist/transport/fixml/index.d.ts +2 -1
- package/dist/transport/fixml/index.js +2 -1
- package/dist/transport/fixml/index.js.map +1 -1
- package/dist/transport/fixml-session-msg-factory.d.ts +13 -0
- package/dist/transport/fixml-session-msg-factory.js +68 -0
- package/dist/transport/fixml-session-msg-factory.js.map +1 -0
- package/dist/transport/http/http-acceptor.js +8 -7
- package/dist/transport/http/http-acceptor.js.map +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/msg-transmitter.js +4 -3
- package/dist/transport/msg-transmitter.js.map +1 -1
- package/dist/transport/msg-transport.js +3 -2
- package/dist/transport/msg-transport.js.map +1 -1
- package/dist/transport/session-description.d.ts +1 -1
- package/dist/transport/session-description.js.map +1 -1
- package/dist/transport/session-msg-factory.d.ts +2 -2
- package/dist/transport/session-msg-factory.js +2 -2
- package/dist/transport/session-msg-factory.js.map +1 -1
- package/dist/transport/tcp/acceptor.js +5 -3
- package/dist/transport/tcp/acceptor.js.map +1 -1
- package/dist/transport/tcp/index.d.ts +1 -0
- package/dist/transport/tcp/index.js +1 -0
- package/dist/transport/tcp/index.js.map +1 -1
- package/dist/transport/tcp/initiator.js +1 -0
- package/dist/transport/tcp/initiator.js.map +1 -1
- package/dist/transport/tcp/recovering-initiator.d.ts +17 -0
- package/dist/transport/tcp/recovering-initiator.js +30 -0
- package/dist/transport/tcp/recovering-initiator.js.map +1 -0
- package/dist/transport/tcp/recovering-tcp-initiator.d.ts +28 -0
- package/dist/transport/tcp/recovering-tcp-initiator.js +120 -0
- package/dist/transport/tcp/recovering-tcp-initiator.js.map +1 -0
- package/dist/transport/tcp/tcp-acceptor.d.ts +7 -0
- package/dist/transport/tcp/tcp-acceptor.js +43 -11
- package/dist/transport/tcp/tcp-acceptor.js.map +1 -1
- package/dist/transport/tcp/tcp-initiator.d.ts +4 -0
- package/dist/transport/tcp/tcp-initiator.js +72 -35
- package/dist/transport/tcp/tcp-initiator.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/advertisement.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/advertisement.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_instruction.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_instruction.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_instruction_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_instruction_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/allocation_report_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/allocation_report_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/assignment_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/assignment_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/bid_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/bid_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/bid_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/bid_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/business_message_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/business_message_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_assignment.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_assignment.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_inquiry.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_inquiry.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_inquiry_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_inquiry_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/collateral_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/collateral_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/confirmation_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/confirmation_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_replace_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_replace_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/cross_order_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/derivative_security_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/derivative_security_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/derivative_security_list_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/derivative_security_list_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/dont_know_trade.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/dont_know_trade.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/email.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/email.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/execution_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/execution_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/heartbeat.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/heartbeat.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/index.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/index.js +4 -0
- package/dist/types/FIX4.4/quickfix/index.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/ioi.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/ioi.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_execute.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_execute.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/list_strike_price.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/list_strike_price.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/logon.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/logon.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/logout.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/logout.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_incremental_refresh.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_incremental_refresh.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_request_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_request_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/mass_quote.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/mass_quote.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/mass_quote_acknowledgement.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/mass_quote_acknowledgement.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/multileg_order_cancel_replace.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/multileg_order_cancel_replace.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/network_counterparty_system_status_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_cross.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_cross.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_multileg.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_multileg.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/new_order_single.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/new_order_single.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/news.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/news.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_replace_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_replace_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_cancel_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_mass_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_mass_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/order_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/order_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_maintenance_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_maintenance_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_maintenance_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_maintenance_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/position_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/position_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_cancel.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_cancel.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_request_reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_request_reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_status_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_status_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/quote_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/quote_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/registration_instructions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/registration_instructions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/registration_instructions_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/registration_instructions_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/reject.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/reject.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/request_for_positions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/request_for_positions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/request_for_positions_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/request_for_positions_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/resend_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/resend_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/rfq_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/rfq_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_definition.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_definition.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_definition_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_definition_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_list.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_list.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_list_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_list_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_type_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_type_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/security_types.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/security_types.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/sequence_reset.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/sequence_reset.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/set/header.d.ts +31 -0
- package/dist/types/FIX4.4/quickfix/set/header.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/header.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/hop.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/set/hop.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/hop.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.d.ts +5 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/hop_no_hops.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.d.ts +31 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/standard_header.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.d.ts +6 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/standard_trailer.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.d.ts +6 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.js +3 -0
- package/dist/types/FIX4.4/quickfix/set/trailer.js.map +1 -0
- package/dist/types/FIX4.4/quickfix/settlement_instruction_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/settlement_instruction_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/settlement_instructions.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/settlement_instructions.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/test_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/test_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request_ack.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trade_capture_report_request_ack.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trading_session_status.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trading_session_status.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/trading_session_status_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/trading_session_status_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/user_request.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/user_request.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/user_response.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/user_response.js.map +1 -1
- package/dist/types/FIX4.4/quickfix/xm_lnon_fix.d.ts +4 -0
- package/dist/types/FIX4.4/quickfix/xm_lnon_fix.js.map +1 -1
- package/dist/types/FIX4.4/repo/enum/all-enum.js.map +1 -1
- package/package.json +25 -21
- package/script/build.sh +1 -0
- package/src/buffer/ascii/ascii-encoder.ts +110 -33
- package/src/buffer/ascii/ascii-parser.ts +8 -1
- package/src/buffer/ascii/ascii-segment-parser.ts +44 -38
- package/src/buffer/ascii/ascii-view.ts +5 -0
- package/src/buffer/ascii/time-formatter.ts +2 -2
- package/src/buffer/ascii-chars.ts +1 -0
- package/src/buffer/elastic-buffer.ts +9 -0
- package/src/buffer/encode-proxy.ts +2 -2
- package/src/buffer/fixml/fixml-encoder.ts +8 -0
- package/src/buffer/fixml/fixml-view.ts +5 -0
- package/src/buffer/msg-encoder.ts +2 -0
- package/src/buffer/msg-view.ts +3 -0
- package/src/buffer/tags.ts +1 -1
- package/src/collections/dictionary.ts +6 -0
- package/src/config/js-fix-config.ts +2 -0
- package/src/dictionary/parser/quickfix/field-set-parser.ts +11 -4
- package/src/dictionary/parser/quickfix/message-parser.ts +4 -0
- package/src/dictionary/parser/quickfix/quick-fix-xml-file-parser.ts +16 -0
- package/src/jsfix-cmd.ts +2 -1
- package/src/sample/http/oms/app.ts +2 -0
- package/src/sample/launcher.ts +17 -7
- package/src/sample/tcp/qf-md/app.ts +26 -0
- package/src/sample/tcp/qf-md/md-client.ts +51 -0
- package/src/sample/tcp/qf-md/md-factory.ts +34 -0
- package/src/sample/tcp/qf-md/md-server.ts +56 -0
- package/src/sample/tcp/recovering-skeleton/app.ts +33 -0
- package/src/sample/tcp/recovering-skeleton/respawn-acceptor.ts +41 -0
- package/src/sample/tcp/recovering-skeleton/skeleton-client.ts +54 -0
- package/src/sample/tcp/recovering-skeleton/skeleton-server.ts +60 -0
- package/src/sample/tcp/skeleton/app.ts +2 -0
- package/src/sample/tcp/skeleton/skeleton-session.ts +26 -4
- package/src/sample/tcp/tls-trade-capture/app.ts +1 -1
- package/src/sample/tcp/{trade_capture → trade-capture}/app.ts +0 -0
- package/src/sample/tcp/{trade_capture → trade-capture}/index.ts +0 -0
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-capture-client.ts +10 -5
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-capture-server.ts +2 -2
- package/src/sample/tcp/{trade_capture → trade-capture}/trade-factory.ts +0 -0
- package/src/store/fix-msg-ascii-store-resend.ts +87 -0
- package/src/store/fix-msg-memory-store.ts +171 -0
- package/src/store/fix-msg-store-record.ts +23 -0
- package/src/store/fix-msg-store.ts +23 -0
- package/src/store/index.ts +4 -0
- package/src/transport/a-session-msg-factory.ts +81 -0
- package/src/transport/ascii/ascii-msg-transmitter.ts +32 -11
- package/src/transport/ascii/ascii-session-msg-factory.ts +62 -0
- package/src/transport/ascii/ascii-session.ts +100 -36
- package/src/transport/ascii/index.ts +1 -0
- package/src/transport/duplex/http-duplex.ts +2 -2
- package/src/transport/fix-msg-factory.ts +1 -1
- package/src/transport/fix-session-state.ts +67 -15
- package/src/transport/fix-session.ts +156 -43
- package/src/transport/fixml/fixml-session-msg-factory.ts +76 -0
- package/src/transport/fixml/fixml-session.ts +1 -1
- package/src/transport/fixml/index.ts +2 -1
- package/src/transport/http/http-acceptor.ts +7 -6
- package/src/transport/index.ts +1 -1
- package/src/transport/msg-transmitter.ts +4 -3
- package/src/transport/msg-transport.ts +3 -2
- package/src/transport/session-description.ts +1 -1
- package/src/transport/tcp/acceptor.ts +5 -3
- package/src/transport/tcp/index.ts +1 -0
- package/src/transport/tcp/initiator.ts +1 -0
- package/src/transport/tcp/recovering-tcp-initiator.ts +149 -0
- package/src/transport/tcp/tcp-acceptor.ts +46 -11
- package/src/transport/tcp/tcp-initiator.ts +77 -40
- package/src/types/FIX4.4/quickfix/advertisement.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_instruction.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_instruction_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/allocation_report_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/assignment_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/bid_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/bid_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/business_message_reject.ts +5 -0
- package/src/types/FIX4.4/quickfix/collateral_assignment.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_inquiry.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_inquiry_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/collateral_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/confirmation.ts +4 -0
- package/src/types/FIX4.4/quickfix/confirmation_ack.ts +5 -0
- package/src/types/FIX4.4/quickfix/confirmation_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/cross_order_cancel_replace_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/cross_order_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/derivative_security_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/derivative_security_list_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/dont_know_trade.ts +4 -0
- package/src/types/FIX4.4/quickfix/email.ts +4 -0
- package/src/types/FIX4.4/quickfix/execution_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/heartbeat.ts +5 -0
- package/src/types/FIX4.4/quickfix/index.ts +4 -0
- package/src/types/FIX4.4/quickfix/ioi.ts +4 -0
- package/src/types/FIX4.4/quickfix/list_cancel_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/list_execute.ts +6 -1
- package/src/types/FIX4.4/quickfix/list_status.ts +4 -0
- package/src/types/FIX4.4/quickfix/list_status_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/list_strike_price.ts +4 -0
- package/src/types/FIX4.4/quickfix/logon.ts +4 -0
- package/src/types/FIX4.4/quickfix/logout.ts +6 -1
- package/src/types/FIX4.4/quickfix/market_data_incremental_refresh.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_request_reject.ts +4 -0
- package/src/types/FIX4.4/quickfix/market_data_snapshot_full_refresh.ts +4 -0
- package/src/types/FIX4.4/quickfix/mass_quote.ts +4 -0
- package/src/types/FIX4.4/quickfix/mass_quote_acknowledgement.ts +4 -0
- package/src/types/FIX4.4/quickfix/multileg_order_cancel_replace.ts +4 -0
- package/src/types/FIX4.4/quickfix/network_counterparty_system_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/network_counterparty_system_status_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_cross.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_multileg.ts +4 -0
- package/src/types/FIX4.4/quickfix/new_order_single.ts +4 -0
- package/src/types/FIX4.4/quickfix/news.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_cancel_reject.ts +5 -0
- package/src/types/FIX4.4/quickfix/order_cancel_replace_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_cancel_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_cancel_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_mass_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/order_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_maintenance_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_maintenance_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/position_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_cancel.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_request_reject.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_status_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/quote_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/registration_instructions.ts +4 -0
- package/src/types/FIX4.4/quickfix/registration_instructions_response.ts +4 -0
- package/src/types/FIX4.4/quickfix/reject.ts +6 -1
- package/src/types/FIX4.4/quickfix/request_for_positions.ts +4 -0
- package/src/types/FIX4.4/quickfix/request_for_positions_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/resend_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/rfq_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_definition.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_definition_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_list.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_list_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_status.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_status_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/security_type_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/security_types.ts +4 -0
- package/src/types/FIX4.4/quickfix/sequence_reset.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/hop.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/hop_no_hops.ts +5 -0
- package/src/types/FIX4.4/quickfix/set/standard_header.ts +31 -0
- package/src/types/FIX4.4/quickfix/set/standard_trailer.ts +5 -0
- package/src/types/FIX4.4/quickfix/settlement_instruction_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/settlement_instructions.ts +4 -0
- package/src/types/FIX4.4/quickfix/test_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_request.ts +4 -0
- package/src/types/FIX4.4/quickfix/trade_capture_report_request_ack.ts +4 -0
- package/src/types/FIX4.4/quickfix/trading_session_status.ts +5 -0
- package/src/types/FIX4.4/quickfix/trading_session_status_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/user_request.ts +5 -0
- package/src/types/FIX4.4/quickfix/user_response.ts +5 -0
- package/src/types/FIX4.4/quickfix/xm_lnon_fix.ts +5 -0
- package/src/types/FIX4.4/repo/enum/all-enum.ts +0 -1
- package/dist/sample/tcp/tls-trade-capture/jsfix.test_client.txt +0 -77
- package/dist/sample/tcp/tls-trade-capture/jsfix.test_server.txt +0 -77
- package/dist/sample/tcp/trade_capture/jsfix.test_client.txt +0 -75
- package/dist/sample/tcp/trade_capture/jsfix.test_server.txt +0 -75
- package/dist/sample/tcp/trade_capture/trade-capture-client.js.map +0 -1
- package/dist/sample/tcp/trade_capture/trade-capture-server.js.map +0 -1
- package/src/transport/session-msg-factory.ts +0 -195
- package/src/transport/tcp/resilient-initiator.ts +0 -35
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IFixMsgStore } from './fix-msg-store'
|
|
2
|
+
import { FixMsgStoreRecord, IFixMsgStoreRecord } from './fix-msg-store-record'
|
|
3
|
+
import { IJsFixConfig } from '../config'
|
|
4
|
+
import { MsgType } from '../types'
|
|
5
|
+
import { AsciiParser, MsgView } from '../buffer'
|
|
6
|
+
import { ISequenceReset, IStandardHeader } from '../types/FIX4.4/repo'
|
|
7
|
+
|
|
8
|
+
export class FixMsgAsciiStoreResend {
|
|
9
|
+
parser: AsciiParser
|
|
10
|
+
constructor (public readonly store: IFixMsgStore, public readonly config: IJsFixConfig) {
|
|
11
|
+
this.parser = new AsciiParser(this.config.definitions, null, this.config.delimiter)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public getResendRequest (startSeq: number, endSeq: number): Promise<IFixMsgStoreRecord[]> {
|
|
15
|
+
|
|
16
|
+
// need to cover request from start to end where any missing numbers are
|
|
17
|
+
// included as gaps to allow vector of messages to be sent by the session
|
|
18
|
+
// on a request
|
|
19
|
+
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
this.store.getSeqNumRange(startSeq, endSeq).then(res => {
|
|
22
|
+
resolve(this.inflateRange(startSeq, endSeq, res))
|
|
23
|
+
}).catch(e => {
|
|
24
|
+
reject(e)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private inflateRange (startSeq: number, endSeq: number, input: IFixMsgStoreRecord[]): IFixMsgStoreRecord[] {
|
|
30
|
+
const toResend: IFixMsgStoreRecord[] = []
|
|
31
|
+
let expected = startSeq
|
|
32
|
+
for (let i = 0; i < input.length; ++i) {
|
|
33
|
+
const record = input[i].clone()
|
|
34
|
+
const seqNum = record.seqNum
|
|
35
|
+
const toGap = seqNum - expected
|
|
36
|
+
if (toGap > 0) {
|
|
37
|
+
this.gap(expected, seqNum, toResend)
|
|
38
|
+
}
|
|
39
|
+
expected = seqNum + 1
|
|
40
|
+
if (record.encoded) {
|
|
41
|
+
this.inflate(record)
|
|
42
|
+
}
|
|
43
|
+
toResend.push(record)
|
|
44
|
+
}
|
|
45
|
+
if (endSeq - expected > 0) {
|
|
46
|
+
this.gap(expected, endSeq + 1, toResend)
|
|
47
|
+
}
|
|
48
|
+
return toResend
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public gap (beginGap: number, seqNum: number, arr: IFixMsgStoreRecord[]) {
|
|
52
|
+
if (beginGap > 0) {
|
|
53
|
+
arr.push(this.sequenceResetGap(beginGap, seqNum))
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// if records were sent as encoded text then inflate back to object
|
|
58
|
+
// so can be resent or examined
|
|
59
|
+
|
|
60
|
+
public inflate (record: IFixMsgStoreRecord): void {
|
|
61
|
+
if (record.obj) return
|
|
62
|
+
if (!record.encoded) return
|
|
63
|
+
const parser = this.parser
|
|
64
|
+
parser.on('error', (e: Error) => {
|
|
65
|
+
record.obj = null
|
|
66
|
+
})
|
|
67
|
+
parser.on('msg', (view: MsgView) => {
|
|
68
|
+
record.obj = view.toObject()
|
|
69
|
+
})
|
|
70
|
+
// inline parse
|
|
71
|
+
parser.parseText(record.encoded)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public sequenceResetGap (startGap: number, newSeq: number): IFixMsgStoreRecord {
|
|
75
|
+
const factory = this.config.factory
|
|
76
|
+
const gapFill: ISequenceReset = factory.sequenceReset(newSeq, true) as ISequenceReset
|
|
77
|
+
gapFill.StandardHeader = factory.header(MsgType.SequenceReset, startGap) as IStandardHeader
|
|
78
|
+
gapFill.StandardHeader.PossDupFlag = true
|
|
79
|
+
gapFill.NewSeqNo = newSeq
|
|
80
|
+
return new FixMsgStoreRecord(
|
|
81
|
+
MsgType.SequenceReset,
|
|
82
|
+
new Date(),
|
|
83
|
+
newSeq,
|
|
84
|
+
gapFill,
|
|
85
|
+
null)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { IFixMsgStore } from './fix-msg-store'
|
|
2
|
+
import { IJsFixConfig, IJsFixLogger } from '../config'
|
|
3
|
+
import { IFixMsgStoreRecord } from './fix-msg-store-record'
|
|
4
|
+
import { Dictionary } from '../collections'
|
|
5
|
+
import { MsgType } from '../types'
|
|
6
|
+
import { IFixMsgStoreState } from '.'
|
|
7
|
+
|
|
8
|
+
export class FixMsgMemoryStore implements IFixMsgStore {
|
|
9
|
+
protected readonly logger: IJsFixLogger
|
|
10
|
+
public heartbeat: boolean = true
|
|
11
|
+
private sortedBySeqNum: IFixMsgStoreRecord[] = []
|
|
12
|
+
private excluded: Dictionary<boolean> = new Dictionary<boolean>()
|
|
13
|
+
public length: number = 0
|
|
14
|
+
private sessionMessages: string[] = [
|
|
15
|
+
MsgType.Logon,
|
|
16
|
+
MsgType.Logout,
|
|
17
|
+
MsgType.ResendRequest,
|
|
18
|
+
MsgType.Heartbeat,
|
|
19
|
+
MsgType.TestRequest,
|
|
20
|
+
MsgType.SequenceReset
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
public constructor (public readonly id: string, public readonly config: IJsFixConfig) {
|
|
24
|
+
this.logger = config.logFactory.logger(`${this.id}:FixMsgMemoryStore`)
|
|
25
|
+
this.setExcMsgType([])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static search (ar: IFixMsgStoreRecord[], target?: number, isDate?: boolean): number {
|
|
29
|
+
let m: number = 0
|
|
30
|
+
let n: number = ar.length - 1
|
|
31
|
+
while (m <= n) {
|
|
32
|
+
const k: number = (n + m) >> 1
|
|
33
|
+
const check: number = isDate ? ar[k].timestamp.getDate() : ar[k].seqNum
|
|
34
|
+
const cmp: number = target - check
|
|
35
|
+
if (cmp > 0) {
|
|
36
|
+
m = k + 1
|
|
37
|
+
} else if (cmp < 0) {
|
|
38
|
+
n = k - 1
|
|
39
|
+
} else {
|
|
40
|
+
return k
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return -m - 1
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public getMsgType (msgType: string): Promise<IFixMsgStoreRecord[]> {
|
|
47
|
+
return new Promise((resolve, reject: any) => {
|
|
48
|
+
const data = this.sortedBySeqNum
|
|
49
|
+
if (data === null) reject(new Error('no store'))
|
|
50
|
+
const required = data.filter(x => x.msgType === msgType)
|
|
51
|
+
resolve(required)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private getIndex (seq: number): number {
|
|
56
|
+
const arr = this.sortedBySeqNum
|
|
57
|
+
let index = FixMsgMemoryStore.search(arr, seq)
|
|
58
|
+
if (index < 0) {
|
|
59
|
+
index = -(index + 1)
|
|
60
|
+
}
|
|
61
|
+
return index
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private bounded (fromIdx: number, toIdx: number) {
|
|
65
|
+
const arr = this.sortedBySeqNum
|
|
66
|
+
return fromIdx >= 0 && fromIdx <= arr.length && toIdx >= fromIdx && toIdx <= arr.length
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public get (from: number): Promise<IFixMsgStoreRecord> {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
this.getSeqNumRange(from, from).then(res => {
|
|
72
|
+
if (res.length > 0) {
|
|
73
|
+
const record = res[0].clone()
|
|
74
|
+
resolve(record)
|
|
75
|
+
} else {
|
|
76
|
+
reject(new Error(`${from} not in store`))
|
|
77
|
+
}
|
|
78
|
+
}).catch(e => {
|
|
79
|
+
reject(e)
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public getSeqNumRange (from: number, to?: number): Promise<IFixMsgStoreRecord[]> {
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
const arr = this.sortedBySeqNum
|
|
87
|
+
if (from < 0) reject(new Error(`illegal from ${from}`))
|
|
88
|
+
if (to < 0) reject(new Error(`illegal to ${to}`))
|
|
89
|
+
let fromIdx = this.getIndex(from)
|
|
90
|
+
const toEnd = to === 0 || isNaN(to)
|
|
91
|
+
let toIdx = toEnd ? arr.length - 1 : this.getIndex(to)
|
|
92
|
+
if (this.bounded(fromIdx, toIdx)) {
|
|
93
|
+
resolve(arr.slice(fromIdx, toIdx + 1))
|
|
94
|
+
} else {
|
|
95
|
+
reject(new Error(`incorrect bounds from=${from}, fromIdx=${fromIdx}, to=${to}, toIdx=${toIdx}, length=${arr.length}`))
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private buildState (): IFixMsgStoreState {
|
|
101
|
+
const arr = this.sortedBySeqNum
|
|
102
|
+
return {
|
|
103
|
+
firstSeq: arr.length > 0 ? arr[0].seqNum : 0,
|
|
104
|
+
lastSeq: arr.length > 0 ? arr[arr.length - 1].seqNum : 0,
|
|
105
|
+
id: this.id,
|
|
106
|
+
length: arr.length
|
|
107
|
+
} as IFixMsgStoreState
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public getState (): Promise<IFixMsgStoreState> {
|
|
111
|
+
return new Promise((resolve, reject) => {
|
|
112
|
+
try {
|
|
113
|
+
resolve(this.buildState())
|
|
114
|
+
} catch (e) {
|
|
115
|
+
reject(e)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public clear (): Promise<IFixMsgStoreState> {
|
|
121
|
+
this.sortedBySeqNum = []
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
try {
|
|
124
|
+
resolve(this.buildState())
|
|
125
|
+
} catch (e) {
|
|
126
|
+
reject(e)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public put (record: IFixMsgStoreRecord): Promise<IFixMsgStoreState> {
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
if (this.excluded.containsKey(record.msgType)) {
|
|
134
|
+
resolve(this.buildState())
|
|
135
|
+
} else {
|
|
136
|
+
const arr = this.sortedBySeqNum
|
|
137
|
+
const idx = FixMsgMemoryStore.search(arr, record.seqNum)
|
|
138
|
+
if (idx >= 0) { // seen this before
|
|
139
|
+
reject(new Error(`this seqNum ${record.seqNum} already in store`))
|
|
140
|
+
}
|
|
141
|
+
arr.splice(-idx, 0, record)
|
|
142
|
+
this.length = arr.length
|
|
143
|
+
resolve(this.buildState())
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public setExcMsgType (exclude: string[]): void {
|
|
149
|
+
this.excluded.clear()
|
|
150
|
+
this.excludeRange(this.sessionMessages)
|
|
151
|
+
this.excludeRange(exclude)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private excludeRange (exclude: string[]): void {
|
|
155
|
+
exclude.forEach(s => {
|
|
156
|
+
this.excluded.add(s, true)
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
exists (seqNum: number): Promise<boolean> {
|
|
161
|
+
return new Promise((resolve, reject) => {
|
|
162
|
+
try {
|
|
163
|
+
const arr = this.sortedBySeqNum
|
|
164
|
+
let index = FixMsgMemoryStore.search(arr, seqNum)
|
|
165
|
+
resolve(index >= 0)
|
|
166
|
+
} catch (e) {
|
|
167
|
+
reject(e)
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ILooseObject } from '../collections/collection'
|
|
2
|
+
|
|
3
|
+
export interface IFixMsgStoreRecord {
|
|
4
|
+
readonly msgType: string
|
|
5
|
+
readonly timestamp: Date
|
|
6
|
+
readonly seqNum: number
|
|
7
|
+
obj?: ILooseObject
|
|
8
|
+
readonly encoded?: string
|
|
9
|
+
clone (): IFixMsgStoreRecord
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class FixMsgStoreRecord implements IFixMsgStoreRecord {
|
|
13
|
+
constructor (public readonly msgType: string,
|
|
14
|
+
public readonly timestamp: Date,
|
|
15
|
+
public readonly seqNum: number,
|
|
16
|
+
public obj?: ILooseObject,
|
|
17
|
+
public readonly encoded?: string) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
clone (): IFixMsgStoreRecord {
|
|
21
|
+
return new FixMsgStoreRecord(this.msgType, this.timestamp, this.seqNum, this.obj, this.encoded)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
a message store that represents a single entity which can be queried for recovery
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { IFixMsgStoreRecord } from './fix-msg-store-record'
|
|
6
|
+
|
|
7
|
+
export interface IFixMsgStoreState {
|
|
8
|
+
readonly length: number,
|
|
9
|
+
readonly firstSeq: number,
|
|
10
|
+
readonly lastSeq: number
|
|
11
|
+
readonly id: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IFixMsgStore {
|
|
15
|
+
clear (): Promise<IFixMsgStoreState>
|
|
16
|
+
getState (): Promise<IFixMsgStoreState>
|
|
17
|
+
put (record: IFixMsgStoreRecord): Promise<IFixMsgStoreState>
|
|
18
|
+
get (seq: number): Promise<IFixMsgStoreRecord>
|
|
19
|
+
exists (seq: number): Promise<boolean>
|
|
20
|
+
// if to = 0, then to the end of sequence
|
|
21
|
+
getSeqNumRange (from: number, to?: number): Promise<IFixMsgStoreRecord[]>
|
|
22
|
+
getMsgType (msgType: string): Promise<IFixMsgStoreRecord[]>
|
|
23
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ISessionMsgFactory } from './fix-msg-factory'
|
|
2
|
+
import { ISessionDescription } from './session-description'
|
|
3
|
+
import { ILooseObject } from '../collections/collection'
|
|
4
|
+
import { MsgType } from '../types'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
IHeartbeat,
|
|
8
|
+
IReject,
|
|
9
|
+
IResendRequest,
|
|
10
|
+
ISequenceReset,
|
|
11
|
+
IStandardHeader,
|
|
12
|
+
IStandardTrailer,
|
|
13
|
+
ITestRequest
|
|
14
|
+
} from '../types/FIX4.4/repo'
|
|
15
|
+
|
|
16
|
+
export interface ObjectMutator { (description: ISessionDescription, type: string, o: ILooseObject): ILooseObject
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export abstract class ASessionMsgFactory implements ISessionMsgFactory {
|
|
20
|
+
public isAscii: boolean
|
|
21
|
+
constructor (public readonly description: ISessionDescription, public mutator: ObjectMutator = null) {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public reject (msgType: string, seqNo: number, msg: string, reason: number): ILooseObject {
|
|
25
|
+
const o: IReject = {
|
|
26
|
+
RefMsgType: msgType,
|
|
27
|
+
SessionRejectReason: reason,
|
|
28
|
+
RefSeqNum: seqNo,
|
|
29
|
+
Text: msg
|
|
30
|
+
} as IReject
|
|
31
|
+
return this.mutator ? this.mutator(this.description, MsgType.Reject, o) : o
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// see implementations Ascii and Fixml
|
|
35
|
+
public abstract logon (userRequestId: string, isResponse: boolean): ILooseObject
|
|
36
|
+
public abstract logout (msgType: string, text: string): ILooseObject
|
|
37
|
+
public abstract header (msgType: string, seqNum: number, time: Date, overrideData?: Partial<IStandardHeader>): ILooseObject
|
|
38
|
+
|
|
39
|
+
protected mutate (o: ILooseObject, type: string): ILooseObject {
|
|
40
|
+
return this.mutator ? this.mutator(this.description, type, o) : o
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public testRequest (reqId: string = `ping-${new Date().toUTCString()}`): ILooseObject {
|
|
44
|
+
const o: ITestRequest = {
|
|
45
|
+
TestReqID: reqId
|
|
46
|
+
} as ITestRequest
|
|
47
|
+
return this.mutate(o, MsgType.TestRequest)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public heartbeat (testReqId: string): ILooseObject {
|
|
51
|
+
const o: IHeartbeat = {
|
|
52
|
+
TestReqID: testReqId
|
|
53
|
+
} as IHeartbeat
|
|
54
|
+
return this.mutate(o, MsgType.Heartbeat)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public resendRequest (from: number, to: number): ILooseObject {
|
|
58
|
+
const o: IResendRequest = {
|
|
59
|
+
BeginSeqNo: from,
|
|
60
|
+
EndSeqNo: to
|
|
61
|
+
} as IResendRequest
|
|
62
|
+
return this.mutate(o, MsgType.ResendRequest)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public sequenceReset (newSeqNo: number, gapFill?: boolean): ILooseObject {
|
|
66
|
+
const o: ISequenceReset = {
|
|
67
|
+
GapFillFlag: gapFill === true,
|
|
68
|
+
NewSeqNo: newSeqNo
|
|
69
|
+
} as ISequenceReset
|
|
70
|
+
return this.mutate(o, MsgType.SequenceReset)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public trailer (checksum: number): ILooseObject {
|
|
74
|
+
const s = checksum.toString()
|
|
75
|
+
const padded = s.padStart(3, '0')
|
|
76
|
+
const o = {
|
|
77
|
+
CheckSum: padded
|
|
78
|
+
} as IStandardTrailer
|
|
79
|
+
return this.mutate(o, 'StandardTrailer')
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsciiEncoder, TimeFormatter } from '../../buffer'
|
|
1
|
+
import { AsciiChars, AsciiEncoder, TimeFormatter } from '../../buffer'
|
|
2
2
|
import { MsgTransmitter } from '../msg-transmitter'
|
|
3
3
|
import { ILooseObject } from '../../collections/collection'
|
|
4
4
|
import { ContainedFieldSet, MessageDefinition } from '../../dictionary'
|
|
@@ -18,20 +18,40 @@ export class AsciiMsgTransmitter extends MsgTransmitter {
|
|
|
18
18
|
this.msgSeqNum = (config.description.LastSentSeqNum || 0) + 1 // adding 1 as this the next sequence # to use.
|
|
19
19
|
const buffer = this.buffer
|
|
20
20
|
const tf: TimeFormatter = new TimeFormatter(buffer)
|
|
21
|
-
this.encoder = new AsciiEncoder(buffer, config.definitions, tf,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
this.encoder = new AsciiEncoder(buffer, config.definitions, tf,
|
|
22
|
+
config.delimiter || AsciiChars.Soh,
|
|
23
|
+
config.logDelimiter || AsciiChars.Pipe)
|
|
24
|
+
const components = config.definitions.component
|
|
25
|
+
this.header = components.get('StandardHeader')
|
|
26
|
+
this.trailer = components.get('StandardTrailer')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private checksum (): number {
|
|
30
|
+
const buffer = this.buffer
|
|
31
|
+
const encoder: AsciiEncoder = this.encoder as AsciiEncoder
|
|
32
|
+
let checksum: number = buffer.sum()
|
|
33
|
+
if (encoder.delimiter !== encoder.logDelimiter) {
|
|
34
|
+
const changes = encoder.tags.nextTagPos
|
|
35
|
+
checksum -= changes * encoder.logDelimiter
|
|
36
|
+
checksum += changes * encoder.delimiter
|
|
37
|
+
}
|
|
38
|
+
checksum = checksum % 256
|
|
39
|
+
return checksum
|
|
24
40
|
}
|
|
25
41
|
|
|
26
42
|
public encodeMessage (msgType: string, obj: ILooseObject): void {
|
|
27
43
|
const encoder: AsciiEncoder = this.encoder as AsciiEncoder
|
|
28
44
|
const factory = this.config.factory
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
let headerProps: Partial<IStandardHeader> = {}
|
|
46
|
+
const { StandardHeader, ...bodyProps } = obj
|
|
47
|
+
if (StandardHeader) {
|
|
48
|
+
const { BeginString, BodyLength, MsgType, SenderCompID, SendingTime, TargetCompID, TargetSubID, ...hp } = StandardHeader
|
|
49
|
+
headerProps = hp // pick up any optional applied by application
|
|
50
|
+
headerProps.OrigSendingTime = SendingTime // when first sent
|
|
33
51
|
}
|
|
34
|
-
|
|
52
|
+
|
|
53
|
+
const sendingTime = this.time || new Date()
|
|
54
|
+
const hdr: ILooseObject = factory.header(msgType, this.msgSeqNum, sendingTime, headerProps)
|
|
35
55
|
|
|
36
56
|
// Only increment sequence number if this is not a duplicate message.
|
|
37
57
|
if (!headerProps.PossDupFlag) {
|
|
@@ -42,15 +62,16 @@ export class AsciiMsgTransmitter extends MsgTransmitter {
|
|
|
42
62
|
buffer.reset()
|
|
43
63
|
const msgDef: MessageDefinition = this.definitions.message.get(msgType)
|
|
44
64
|
if (!msgDef) {
|
|
65
|
+
this.emit('error', new Error(`ascii transmitter cannot find definition for ${msgType}`))
|
|
45
66
|
return
|
|
46
67
|
}
|
|
47
68
|
encoder.encode(hdr, this.header.name)
|
|
48
|
-
encoder.encode(
|
|
69
|
+
encoder.encode(bodyProps, msgDef.name)
|
|
49
70
|
const lenPos = encoder.bodyLengthPos
|
|
50
71
|
const bodyLength: number = Math.max(4, this.config.description.BodyLengthChars || 7)
|
|
51
72
|
const len = buffer.getPos() - encoder.msgTypePos
|
|
52
73
|
buffer.patchPaddedNumberAtPos(lenPos, len, bodyLength)
|
|
53
|
-
|
|
74
|
+
let checksum: number = this.checksum()
|
|
54
75
|
const trl: ILooseObject = factory.trailer(checksum)
|
|
55
76
|
encoder.encode(trl, this.trailer.name)
|
|
56
77
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ISessionDescription } from '../session-description'
|
|
2
|
+
import { ILooseObject } from '../../collections/collection'
|
|
3
|
+
import { MsgType } from '../../types'
|
|
4
|
+
import { ASessionMsgFactory, ObjectMutator } from '../a-session-msg-factory'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
EncryptMethod,
|
|
8
|
+
ILogon,
|
|
9
|
+
ILogout,
|
|
10
|
+
IStandardHeader
|
|
11
|
+
} from '../../types/FIX4.4/repo'
|
|
12
|
+
|
|
13
|
+
export class AsciiSessionMsgFactory extends ASessionMsgFactory {
|
|
14
|
+
|
|
15
|
+
constructor (readonly description: ISessionDescription, mutator: ObjectMutator = null) {
|
|
16
|
+
super(description, mutator)
|
|
17
|
+
this.isAscii = description.application.protocol === 'ascii'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public logon (): ILooseObject {
|
|
21
|
+
const description = this.description
|
|
22
|
+
const o: ILogon = {
|
|
23
|
+
Username: description.Username,
|
|
24
|
+
Password: description.Password,
|
|
25
|
+
HeartBtInt: description.HeartBtInt,
|
|
26
|
+
ResetSeqNumFlag: description.ResetSeqNumFlag,
|
|
27
|
+
EncryptMethod: EncryptMethod.None
|
|
28
|
+
} as ILogon
|
|
29
|
+
return this.mutate(o, MsgType.Logon)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public logout (text: string): ILooseObject {
|
|
33
|
+
const o: ILogout = {
|
|
34
|
+
Text: text
|
|
35
|
+
} as ILogout
|
|
36
|
+
return this.mutate(o, MsgType.Logout)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public header (msgType: string, seqNum: number, time: Date, overrideData?: Partial<IStandardHeader>): ILooseObject {
|
|
40
|
+
const description = this.description
|
|
41
|
+
const bodyLength: number = Math.max(4, description.BodyLengthChars || 7)
|
|
42
|
+
const placeHolder = Math.pow(10, bodyLength - 1) + 1
|
|
43
|
+
const o: IStandardHeader = {
|
|
44
|
+
BeginString: description.BeginString,
|
|
45
|
+
BodyLength: placeHolder,
|
|
46
|
+
MsgType: msgType,
|
|
47
|
+
SenderCompID: description.SenderCompId,
|
|
48
|
+
MsgSeqNum: seqNum,
|
|
49
|
+
SendingTime: time,
|
|
50
|
+
TargetCompID: description.TargetCompID,
|
|
51
|
+
TargetSubID: description.TargetSubID,
|
|
52
|
+
...overrideData
|
|
53
|
+
}
|
|
54
|
+
return this.mutate(o, 'StandardHeader')
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class SessionMsgFactory extends AsciiSessionMsgFactory {
|
|
59
|
+
constructor (public readonly description: ISessionDescription, public mutator: ObjectMutator = null) {
|
|
60
|
+
super(description, mutator)
|
|
61
|
+
}
|
|
62
|
+
}
|