jspurefix 2.0.2 → 2.0.3
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/appveyor.yml +1 -0
- package/dist/runtime/session-launcher.js +2 -2
- package/dist/runtime/session-launcher.js.map +1 -1
- package/package.json +7 -7
- package/src/runtime/session-launcher.ts +2 -2
- package/dist/a-session-msg-factory.d.ts +0 -0
- package/dist/a-session-msg-factory.js +0 -1
- package/dist/a-session-msg-factory.js.map +0 -1
- package/dist/ascii-encoder.test.d.ts +0 -0
- package/dist/ascii-encoder.test.js +0 -1
- package/dist/ascii-encoder.test.js.map +0 -1
- package/dist/ascii-parser.test.d.ts +0 -0
- package/dist/ascii-parser.test.js +0 -1
- package/dist/ascii-parser.test.js.map +0 -1
- package/dist/ascii-segment.test.d.ts +0 -0
- package/dist/ascii-segment.test.js +0 -1
- package/dist/ascii-segment.test.js.map +0 -1
- package/dist/ascii-store-replay.test.d.ts +0 -0
- package/dist/ascii-store-replay.test.js +0 -1
- package/dist/ascii-store-replay.test.js.map +0 -1
- package/dist/ascii-tag-pos.test.d.ts +0 -0
- package/dist/ascii-tag-pos.test.js +0 -1
- package/dist/ascii-tag-pos.test.js.map +0 -1
- package/dist/buffer/segment-description.d.ts +0 -26
- package/dist/buffer/segment-description.js +0 -72
- package/dist/buffer/segment-description.js.map +0 -1
- package/dist/buffer/segment-summary.d.ts +0 -13
- package/dist/buffer/segment-summary.js +0 -20
- package/dist/buffer/segment-summary.js.map +0 -1
- package/dist/buffer/segment-type.d.ts +0 -8
- package/dist/buffer/segment-type.js +0 -13
- package/dist/buffer/segment-type.js.map +0 -1
- package/dist/buffer/tag-pos.d.ts +0 -12
- package/dist/buffer/tag-pos.js +0 -55
- package/dist/buffer/tag-pos.js.map +0 -1
- package/dist/buffer/tag-type.d.ts +0 -13
- package/dist/buffer/tag-type.js +0 -18
- package/dist/buffer/tag-type.js.map +0 -1
- package/dist/buffer/tags.d.ts +0 -21
- package/dist/buffer/tags.js +0 -122
- package/dist/buffer/tags.js.map +0 -1
- package/dist/dictionary/parser/fix-repository/repository-msg.d.ts +0 -0
- package/dist/dictionary/parser/fix-repository/repository-msg.js +0 -1
- package/dist/dictionary/parser/fix-repository/repository-msg.js.map +0 -1
- package/dist/execution-report.test.d.ts +0 -0
- package/dist/execution-report.test.js +0 -1
- package/dist/execution-report.test.js.map +0 -1
- package/dist/experiment.d.ts +0 -0
- package/dist/experiment.js +0 -1
- package/dist/experiment.js.map +0 -1
- package/dist/fix-repo-dict.test.d.ts +0 -0
- package/dist/fix-repo-dict.test.js +0 -1
- package/dist/fix-repo-dict.test.js.map +0 -1
- package/dist/fix-session-state-args.d.ts +0 -0
- package/dist/fix-session-state-args.js +0 -1
- package/dist/fix-session-state-args.js.map +0 -1
- package/dist/fix-session-state.d.ts +0 -0
- package/dist/fix-session-state.js +0 -1
- package/dist/fix-session-state.js.map +0 -1
- package/dist/fix-session.d.ts +0 -0
- package/dist/fix-session.js +0 -1
- package/dist/fix-session.js.map +0 -1
- package/dist/fix.txt +0 -1
- package/dist/fixml-alloc-parse.test.d.ts +0 -0
- package/dist/fixml-alloc-parse.test.js +0 -1
- package/dist/fixml-alloc-parse.test.js.map +0 -1
- package/dist/fixml-mkt-data-fut-parse.test.d.ts +0 -0
- package/dist/fixml-mkt-data-fut-parse.test.js +0 -1
- package/dist/fixml-mkt-data-fut-parse.test.js.map +0 -1
- package/dist/fixml-mkt-data-settle-parse.test.d.ts +0 -0
- package/dist/fixml-mkt-data-settle-parse.test.js +0 -1
- package/dist/fixml-mkt-data-settle-parse.test.js.map +0 -1
- package/dist/fixml-tc-bi-lateral-parse.test.d.ts +0 -0
- package/dist/fixml-tc-bi-lateral-parse.test.js +0 -1
- package/dist/fixml-tc-bi-lateral-parse.test.js.map +0 -1
- package/dist/includes.test.d.ts +0 -0
- package/dist/includes.test.js +0 -1
- package/dist/includes.test.js.map +0 -1
- package/dist/launcher.d.ts +0 -0
- package/dist/launcher.js +0 -1
- package/dist/launcher.js.map +0 -1
- package/dist/logon.test.d.ts +0 -0
- package/dist/logon.test.js +0 -1
- package/dist/logon.test.js.map +0 -1
- package/dist/make-fix-session.d.ts +0 -0
- package/dist/make-fix-session.js +0 -1
- package/dist/make-fix-session.js.map +0 -1
- package/dist/memory-store.test.d.ts +0 -0
- package/dist/memory-store.test.js +0 -1
- package/dist/memory-store.test.js.map +0 -1
- package/dist/object.json +0 -691
- package/dist/qf-full-msg.test.d.ts +0 -0
- package/dist/qf-full-msg.test.js +0 -1
- package/dist/qf-full-msg.test.js.map +0 -1
- package/dist/repo-full-ascii-msg.test.d.ts +0 -0
- package/dist/repo-full-ascii-msg.test.js +0 -1
- package/dist/repo-full-ascii-msg.test.js.map +0 -1
- package/dist/runtime/DITokens.d.ts +0 -20
- package/dist/runtime/DITokens.js +0 -25
- package/dist/runtime/DITokens.js.map +0 -1
- package/dist/runtime/app-launcher.d.ts +0 -27
- package/dist/runtime/app-launcher.js +0 -131
- package/dist/runtime/app-launcher.js.map +0 -1
- package/dist/runtime/launcher.d.ts +0 -29
- package/dist/runtime/launcher.js +0 -131
- package/dist/runtime/launcher.js.map +0 -1
- package/dist/sample/launcher.d.ts +0 -29
- package/dist/sample/launcher.js +0 -131
- package/dist/sample/launcher.js.map +0 -1
- package/dist/sample/tcp/trade-capture/app-launher.d.ts +0 -0
- package/dist/sample/tcp/trade-capture/app-launher.js +0 -1
- package/dist/sample/tcp/trade-capture/app-launher.js.map +0 -1
- package/dist/sample/tcp/trade-capture/jsfix.test_client.txt +0 -11
- package/dist/sample/tcp/trade-capture/jsfix.test_server.txt +0 -10
- package/dist/segment-description.d.ts +0 -0
- package/dist/segment-description.js +0 -1
- package/dist/segment-description.js.map +0 -1
- package/dist/segment-summary.d.ts +0 -0
- package/dist/segment-summary.js +0 -1
- package/dist/segment-summary.js.map +0 -1
- package/dist/segment-type.d.ts +0 -0
- package/dist/segment-type.js +0 -1
- package/dist/segment-type.js.map +0 -1
- package/dist/session-description.d.ts +0 -0
- package/dist/session-description.js +0 -1
- package/dist/session-description.js.map +0 -1
- package/dist/session-msg-factory.d.ts +0 -0
- package/dist/session-msg-factory.js +0 -1
- package/dist/session-msg-factory.js.map +0 -1
- package/dist/session-state.d.ts +0 -0
- package/dist/session-state.js +0 -1
- package/dist/session-state.js.map +0 -1
- package/dist/session-state.test.d.ts +0 -0
- package/dist/session-state.test.js +0 -1
- package/dist/session-state.test.js.map +0 -1
- package/dist/session.test.d.ts +0 -0
- package/dist/session.test.js +0 -1
- package/dist/session.test.js.map +0 -1
- package/dist/setup.d.ts +0 -0
- package/dist/setup.js +0 -1
- package/dist/setup.js.map +0 -1
- package/dist/skeleton-runner.d.ts +0 -0
- package/dist/skeleton-runner.js +0 -1
- package/dist/skeleton-runner.js.map +0 -1
- package/dist/structure.json +0 -631
- package/dist/tag-pos.d.ts +0 -0
- package/dist/tag-pos.js +0 -1
- package/dist/tag-pos.js.map +0 -1
- package/dist/tag-type.d.ts +0 -0
- package/dist/tag-type.js +0 -1
- package/dist/tag-type.js.map +0 -1
- package/dist/tags.d.ts +0 -0
- package/dist/tags.js +0 -1
- package/dist/tags.js.map +0 -1
- package/dist/test/ascii-encoder.test.d.ts +0 -1
- package/dist/test/ascii-encoder.test.js +0 -508
- package/dist/test/ascii-encoder.test.js.map +0 -1
- package/dist/test/ascii-parser.test.d.ts +0 -1
- package/dist/test/ascii-parser.test.js +0 -123
- package/dist/test/ascii-parser.test.js.map +0 -1
- package/dist/test/ascii-segment.test.d.ts +0 -1
- package/dist/test/ascii-segment.test.js +0 -86
- package/dist/test/ascii-segment.test.js.map +0 -1
- package/dist/test/ascii-store-replay.test.d.ts +0 -1
- package/dist/test/ascii-store-replay.test.js +0 -92
- package/dist/test/ascii-store-replay.test.js.map +0 -1
- package/dist/test/ascii-tag-pos.test.d.ts +0 -1
- package/dist/test/ascii-tag-pos.test.js +0 -105
- package/dist/test/ascii-tag-pos.test.js.map +0 -1
- package/dist/test/execution-report.test.d.ts +0 -1
- package/dist/test/execution-report.test.js +0 -494
- package/dist/test/execution-report.test.js.map +0 -1
- package/dist/test/experiment.d.ts +0 -23
- package/dist/test/experiment.js +0 -33
- package/dist/test/experiment.js.map +0 -1
- package/dist/test/expieriment.d.ts +0 -23
- package/dist/test/expieriment.js +0 -33
- package/dist/test/expieriment.js.map +0 -1
- package/dist/test/fix-log-replay.test.d.ts +0 -1
- package/dist/test/fix-log-replay.test.js +0 -47
- package/dist/test/fix-log-replay.test.js.map +0 -1
- package/dist/test/fix-repo-dict.test.d.ts +0 -1
- package/dist/test/fix-repo-dict.test.js +0 -128
- package/dist/test/fix-repo-dict.test.js.map +0 -1
- package/dist/test/fixml-alloc-parse.test.d.ts +0 -1
- package/dist/test/fixml-alloc-parse.test.js +0 -161
- package/dist/test/fixml-alloc-parse.test.js.map +0 -1
- package/dist/test/fixml-mkt-data-fut-parse.test.d.ts +0 -1
- package/dist/test/fixml-mkt-data-fut-parse.test.js +0 -61
- package/dist/test/fixml-mkt-data-fut-parse.test.js.map +0 -1
- package/dist/test/fixml-mkt-data-settle-parse.test.d.ts +0 -1
- package/dist/test/fixml-mkt-data-settle-parse.test.js +0 -34
- package/dist/test/fixml-mkt-data-settle-parse.test.js.map +0 -1
- package/dist/test/fixml-tc-bi-lateral-parse.test.d.ts +0 -1
- package/dist/test/fixml-tc-bi-lateral-parse.test.js +0 -97
- package/dist/test/fixml-tc-bi-lateral-parse.test.js.map +0 -1
- package/dist/test/includes.test.d.ts +0 -1
- package/dist/test/includes.test.js +0 -43
- package/dist/test/includes.test.js.map +0 -1
- package/dist/test/logon.test.d.ts +0 -1
- package/dist/test/logon.test.js +0 -93
- package/dist/test/logon.test.js.map +0 -1
- package/dist/test/memory-store.test.d.ts +0 -1
- package/dist/test/memory-store.test.js +0 -78
- package/dist/test/memory-store.test.js.map +0 -1
- package/dist/test/qf-full-msg.test.d.ts +0 -1
- package/dist/test/qf-full-msg.test.js +0 -81
- package/dist/test/qf-full-msg.test.js.map +0 -1
- package/dist/test/repo-full-ascii-msg.test.d.ts +0 -1
- package/dist/test/repo-full-ascii-msg.test.js +0 -87
- package/dist/test/repo-full-ascii-msg.test.js.map +0 -1
- package/dist/test/repo-full-fixml-msg.test.d.ts +0 -1
- package/dist/test/repo-full-fixml-msg.test.js +0 -139
- package/dist/test/repo-full-fixml-msg.test.js.map +0 -1
- package/dist/test/session-state.test.d.ts +0 -1
- package/dist/test/session-state.test.js +0 -73
- package/dist/test/session-state.test.js.map +0 -1
- package/dist/test/session.test.d.ts +0 -1
- package/dist/test/session.test.js +0 -280
- package/dist/test/session.test.js.map +0 -1
- package/dist/test/setup.d.ts +0 -45
- package/dist/test/setup.js +0 -102
- package/dist/test/setup.js.map +0 -1
- package/dist/test/skeleton-runner.d.ts +0 -15
- package/dist/test/skeleton-runner.js +0 -108
- package/dist/test/skeleton-runner.js.map +0 -1
- package/dist/test/time-formatter.test.d.ts +0 -1
- package/dist/test/time-formatter.test.js +0 -80
- package/dist/test/time-formatter.test.js.map +0 -1
- package/dist/test/to-views.d.ts +0 -11
- package/dist/test/to-views.js +0 -56
- package/dist/test/to-views.js.map +0 -1
- package/dist/test/view-decode.test.d.ts +0 -1
- package/dist/test/view-decode.test.js +0 -183
- package/dist/test/view-decode.test.js.map +0 -1
- package/dist/time-formatter.test.d.ts +0 -0
- package/dist/time-formatter.test.js +0 -1
- package/dist/time-formatter.test.js.map +0 -1
- package/dist/to-views.d.ts +0 -0
- package/dist/to-views.js +0 -1
- package/dist/to-views.js.map +0 -1
- package/dist/token.txt +0 -248
- package/dist/transport/FixEntity.d.ts +0 -8
- package/dist/transport/FixEntity.js +0 -12
- package/dist/transport/FixEntity.js.map +0 -1
- package/dist/transport/a-session-msg-factory.d.ts +0 -23
- package/dist/transport/a-session-msg-factory.js +0 -58
- package/dist/transport/a-session-msg-factory.js.map +0 -1
- package/dist/transport/fix-msg-factory.d.ts +0 -15
- package/dist/transport/fix-msg-factory.js +0 -3
- package/dist/transport/fix-msg-factory.js.map +0 -1
- package/dist/transport/fix-session-state-args.d.ts +0 -8
- package/dist/transport/fix-session-state-args.js +0 -3
- package/dist/transport/fix-session-state-args.js.map +0 -1
- package/dist/transport/fix-session-state.d.ts +0 -32
- package/dist/transport/fix-session-state.js +0 -133
- package/dist/transport/fix-session-state.js.map +0 -1
- package/dist/transport/fix-session.d.ts +0 -50
- package/dist/transport/fix-session.js +0 -291
- package/dist/transport/fix-session.js.map +0 -1
- package/dist/transport/make-fix-session.d.ts +0 -5
- package/dist/transport/make-fix-session.js +0 -3
- package/dist/transport/make-fix-session.js.map +0 -1
- package/dist/transport/session-description.d.ts +0 -17
- package/dist/transport/session-description.js +0 -3
- package/dist/transport/session-description.js.map +0 -1
- package/dist/transport/session-msg-factory.d.ts +0 -15
- package/dist/transport/session-msg-factory.js +0 -3
- package/dist/transport/session-msg-factory.js.map +0 -1
- package/dist/transport/session-state.d.ts +0 -25
- package/dist/transport/session-state.js +0 -30
- package/dist/transport/session-state.js.map +0 -1
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
require("reflect-metadata");
|
|
13
|
-
const buffer_1 = require("../buffer");
|
|
14
|
-
const ascii_1 = require("../buffer/ascii");
|
|
15
|
-
const quickfix_1 = require("../types/FIX4.4/quickfix");
|
|
16
|
-
const __1 = require("..");
|
|
17
|
-
const setup_1 = require("./env/setup");
|
|
18
|
-
let definitions;
|
|
19
|
-
let session;
|
|
20
|
-
let encoder;
|
|
21
|
-
let nos;
|
|
22
|
-
let er;
|
|
23
|
-
const localDate = new Date(2018, 6, 25);
|
|
24
|
-
const utcTimeStamp = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246));
|
|
25
|
-
const utcDate = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0));
|
|
26
|
-
const utcTime = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246));
|
|
27
|
-
let setup;
|
|
28
|
-
let buffer;
|
|
29
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
setup = new setup_1.Setup('session/qf-fix44.json', null);
|
|
31
|
-
yield setup.init();
|
|
32
|
-
definitions = setup.definitions;
|
|
33
|
-
const config = setup.clientConfig;
|
|
34
|
-
definitions = config.definitions;
|
|
35
|
-
session = setup.client.transmitter;
|
|
36
|
-
buffer = setup.client.txBuffer;
|
|
37
|
-
encoder = session.encoder;
|
|
38
|
-
nos = definitions.message.get('NewOrderSingle');
|
|
39
|
-
er = definitions.message.get('ExecutionReport');
|
|
40
|
-
}), 45000);
|
|
41
|
-
test('expect a definition ', () => {
|
|
42
|
-
expect(nos).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
function toFix(o, set, enc) {
|
|
45
|
-
const theEncode = enc ? enc : encoder;
|
|
46
|
-
session.buffer.reset();
|
|
47
|
-
if (set) {
|
|
48
|
-
theEncode.encode(o, set.name);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
theEncode.encode(o, nos.name);
|
|
52
|
-
}
|
|
53
|
-
return session.buffer.toString();
|
|
54
|
-
}
|
|
55
|
-
function toFixMessage(o, msg) {
|
|
56
|
-
session.encodeMessage(msg.msgType, o);
|
|
57
|
-
return session.buffer.toString();
|
|
58
|
-
}
|
|
59
|
-
test('encode heartbeat', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
const factory = session.config.factory;
|
|
61
|
-
const hb = factory.heartbeat('test01');
|
|
62
|
-
const hbd = definitions.message.get('Heartbeat');
|
|
63
|
-
const fix = toFixMessage(hb, hbd);
|
|
64
|
-
expect(fix).toBeTruthy();
|
|
65
|
-
const res = yield setup.client.parseText(fix);
|
|
66
|
-
expect(res.event).toEqual('msg');
|
|
67
|
-
expect(res.msgType).toEqual('0');
|
|
68
|
-
const len = res.view.getTyped(buffer_1.Tags.BodyLengthTag);
|
|
69
|
-
const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length;
|
|
70
|
-
expect(len).toEqual(expected);
|
|
71
|
-
}));
|
|
72
|
-
test('encode custom header PossDupFlag', () => {
|
|
73
|
-
const no = {
|
|
74
|
-
StandardHeader: {
|
|
75
|
-
PossDupFlag: true
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
|
|
79
|
-
expect(fix).toMatch('43=Y|');
|
|
80
|
-
});
|
|
81
|
-
test('encode custom header PossDupFlag', () => {
|
|
82
|
-
const no = {
|
|
83
|
-
StandardHeader: {
|
|
84
|
-
MsgSeqNum: 9999
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const fix = toFixMessage(no, definitions.message.get('Heartbeat'));
|
|
88
|
-
expect(fix).toMatch('34=9999|');
|
|
89
|
-
});
|
|
90
|
-
test('encode string ClOrdID ', () => {
|
|
91
|
-
const no = {};
|
|
92
|
-
no.ClOrdID = 'Order-a';
|
|
93
|
-
const fix = toFix(no);
|
|
94
|
-
expect(fix).toEqual('11=Order-a|');
|
|
95
|
-
});
|
|
96
|
-
test('should not encode empty string', () => {
|
|
97
|
-
const no = {};
|
|
98
|
-
no.ClOrdID = '';
|
|
99
|
-
const fix = toFix(no);
|
|
100
|
-
expect(fix).toEqual('');
|
|
101
|
-
});
|
|
102
|
-
test('should not encode null string', () => {
|
|
103
|
-
const no = {};
|
|
104
|
-
no.ClOrdID = null;
|
|
105
|
-
const fix = toFix(no);
|
|
106
|
-
expect(fix).toEqual('');
|
|
107
|
-
});
|
|
108
|
-
test('encode +ve numeric (int) Price ', () => {
|
|
109
|
-
const no = {};
|
|
110
|
-
no.Price = 100;
|
|
111
|
-
const fix = toFix(no);
|
|
112
|
-
expect(fix).toEqual('44=100|');
|
|
113
|
-
});
|
|
114
|
-
test('encode -ve numeric (int) Price ', () => {
|
|
115
|
-
const no = {};
|
|
116
|
-
no.Price = -100;
|
|
117
|
-
const fix = toFix(no);
|
|
118
|
-
expect(fix).toEqual('44=-100|');
|
|
119
|
-
});
|
|
120
|
-
test('encode +ve numeric (double 8dp) Price ', () => {
|
|
121
|
-
const no = {};
|
|
122
|
-
no.Price = 123.12345678;
|
|
123
|
-
const fix = toFix(no);
|
|
124
|
-
expect(fix).toEqual('44=123.12345678|');
|
|
125
|
-
});
|
|
126
|
-
test('encode +ve numeric (double 14dp) Price ', () => {
|
|
127
|
-
const no = {};
|
|
128
|
-
no.Price = 123.12345678901234;
|
|
129
|
-
const fix = toFix(no);
|
|
130
|
-
expect(fix).toEqual('44=123.12345678901234|');
|
|
131
|
-
});
|
|
132
|
-
test('encode -ve numeric (double 14dp) Price ', () => {
|
|
133
|
-
const no = {};
|
|
134
|
-
no.Price = -123.12345678901234;
|
|
135
|
-
const fix = toFix(no);
|
|
136
|
-
expect(fix).toEqual('44=-123.12345678901234|');
|
|
137
|
-
});
|
|
138
|
-
test('encode +ve string Price ', () => {
|
|
139
|
-
const no = {};
|
|
140
|
-
no.Price = '123.12345678901234';
|
|
141
|
-
const fix = toFix(no);
|
|
142
|
-
expect(fix).toEqual('44=123.12345678901234|');
|
|
143
|
-
});
|
|
144
|
-
test('encode LocalDate TradeDate ', () => {
|
|
145
|
-
const no = {};
|
|
146
|
-
no.TradeDate = localDate;
|
|
147
|
-
const fix = toFix(no);
|
|
148
|
-
expect(fix).toEqual('75=20180725|');
|
|
149
|
-
});
|
|
150
|
-
test('encode UTCTIMESTAMP ExpireTime ', () => {
|
|
151
|
-
const no = {};
|
|
152
|
-
no.ExpireTime = utcTimeStamp;
|
|
153
|
-
const fix = toFix(no);
|
|
154
|
-
expect(fix).toEqual('126=20180610-16:35:00.246|');
|
|
155
|
-
});
|
|
156
|
-
test('encode UTCTIMESTAMP ExpireTime - check padding', () => {
|
|
157
|
-
const no = {};
|
|
158
|
-
no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1));
|
|
159
|
-
const fix = toFix(no);
|
|
160
|
-
expect(fix).toEqual('126=20180101-00:00:00.001|');
|
|
161
|
-
});
|
|
162
|
-
test('encode UTCDATEONLY MDEntryDate', () => {
|
|
163
|
-
const mdGrp = definitions.component.get('MDFullGrp');
|
|
164
|
-
expect(mdGrp).toBeTruthy();
|
|
165
|
-
const grp = {
|
|
166
|
-
NoMDEntries: [
|
|
167
|
-
{
|
|
168
|
-
MDEntryType: '0',
|
|
169
|
-
MDEntryDate: utcDate
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
};
|
|
173
|
-
const fix = toFix(grp, mdGrp);
|
|
174
|
-
expect(fix).toEqual('268=1|269=0|272=20180610|');
|
|
175
|
-
});
|
|
176
|
-
test('encode UTCTIMEONLY MDEntryTime', () => {
|
|
177
|
-
const mdGrp = definitions.component.get('MDFullGrp');
|
|
178
|
-
expect(mdGrp).toBeTruthy();
|
|
179
|
-
const grp = {
|
|
180
|
-
NoMDEntries: [
|
|
181
|
-
{
|
|
182
|
-
MDEntryType: '0',
|
|
183
|
-
MDEntryTime: utcTime
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
};
|
|
187
|
-
const fix = toFix(grp, mdGrp);
|
|
188
|
-
expect(fix).toEqual('268=1|269=0|273=16:35:00.246|');
|
|
189
|
-
});
|
|
190
|
-
function getTCR1() {
|
|
191
|
-
const d0 = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
|
|
192
|
-
const d1 = new Date(Date.UTC(2018, 11, 2, 0, 0, 0));
|
|
193
|
-
const tcr = {
|
|
194
|
-
TradeRequestID: 'all-trades',
|
|
195
|
-
TradeRequestType: quickfix_1.TradeRequestType.AllTrades,
|
|
196
|
-
SubscriptionRequestType: quickfix_1.SubscriptionRequestType.SnapshotPlusUpdates,
|
|
197
|
-
TrdCapDtGrp: {
|
|
198
|
-
NoDates: [
|
|
199
|
-
{
|
|
200
|
-
TransactTime: d0
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
TransactTime: d1
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
return tcr;
|
|
209
|
-
}
|
|
210
|
-
test('encode TradeCaptureReportRequest with TransactTime', () => {
|
|
211
|
-
const tcr = getTCR1();
|
|
212
|
-
const d = definitions.message.get('TradeCaptureReportRequest');
|
|
213
|
-
const fix = toFix(tcr, d);
|
|
214
|
-
expect(fix).toEqual('568=all-trades|569=0|263=1|580=2|60=20181201-00:00:00.000|60=20181202-00:00:00.000|');
|
|
215
|
-
});
|
|
216
|
-
test('encode BOOLEAN (true) ReportToExch', () => {
|
|
217
|
-
expect(er).toBeTruthy();
|
|
218
|
-
const e = {};
|
|
219
|
-
e.ReportToExch = true;
|
|
220
|
-
const fix = toFix(e, er);
|
|
221
|
-
expect(fix).toEqual('113=Y|');
|
|
222
|
-
});
|
|
223
|
-
test('encode BOOLEAN (truthy) ReportToExch', () => {
|
|
224
|
-
expect(er).toBeTruthy();
|
|
225
|
-
const e = {};
|
|
226
|
-
e.ReportToExch = 1;
|
|
227
|
-
const fix = toFix(e, er);
|
|
228
|
-
expect(fix).toEqual('113=Y|');
|
|
229
|
-
});
|
|
230
|
-
test('encode BOOLEAN (string) ReportToExch', () => {
|
|
231
|
-
expect(er).toBeTruthy();
|
|
232
|
-
const e = {};
|
|
233
|
-
e.ReportToExch = 'TRUE';
|
|
234
|
-
const fix = toFix(e, er);
|
|
235
|
-
expect(fix).toEqual('113=Y|');
|
|
236
|
-
});
|
|
237
|
-
test('encode BOOLEAN (false) ReportToExch', () => {
|
|
238
|
-
expect(er).toBeTruthy();
|
|
239
|
-
const e = {};
|
|
240
|
-
e.ReportToExch = false;
|
|
241
|
-
const fix = toFix(e, er);
|
|
242
|
-
expect(fix).toEqual('113=N|');
|
|
243
|
-
});
|
|
244
|
-
test('encode BOOLEAN (falsy) ReportToExch', () => {
|
|
245
|
-
expect(er).toBeTruthy();
|
|
246
|
-
const e = {};
|
|
247
|
-
e.ReportToExch = 0;
|
|
248
|
-
const fix = toFix(e, er);
|
|
249
|
-
expect(fix).toEqual('113=N|');
|
|
250
|
-
});
|
|
251
|
-
test('encode RawData EncodedText', () => {
|
|
252
|
-
expect(er).toBeTruthy();
|
|
253
|
-
const toEncode = 'this is fix';
|
|
254
|
-
const e = {
|
|
255
|
-
EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
|
|
256
|
-
};
|
|
257
|
-
const fix = toFix(e, er);
|
|
258
|
-
expect(fix).toEqual('354=11|355=this is fix|');
|
|
259
|
-
});
|
|
260
|
-
test('encode empty RawData EncodedText', () => {
|
|
261
|
-
expect(er).toBeTruthy();
|
|
262
|
-
const toEncode = '';
|
|
263
|
-
const e = {
|
|
264
|
-
EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')
|
|
265
|
-
};
|
|
266
|
-
const fix = toFix(e, er);
|
|
267
|
-
expect(fix).toEqual('354=0|355=|');
|
|
268
|
-
});
|
|
269
|
-
function getParties() {
|
|
270
|
-
return {
|
|
271
|
-
'Parties': {
|
|
272
|
-
'NoPartyIDs': [
|
|
273
|
-
{
|
|
274
|
-
'PartyID': 'magna.',
|
|
275
|
-
'PartyIDSource': '9',
|
|
276
|
-
'PartyRole': 28
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
'PartyID': 'iaculis',
|
|
280
|
-
'PartyIDSource': 'F',
|
|
281
|
-
'PartyRole': 2
|
|
282
|
-
}
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function getPartiesNoPartyID() {
|
|
288
|
-
return {
|
|
289
|
-
'Parties': {
|
|
290
|
-
'NoPartyIDs': [
|
|
291
|
-
{
|
|
292
|
-
'PartyIDSource': '9',
|
|
293
|
-
'PartyRole': 28
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
test('encode repeated group of simple repository Parties', () => {
|
|
300
|
-
expect(er).toBeTruthy();
|
|
301
|
-
const e = getParties();
|
|
302
|
-
const fix = toFix(e, er);
|
|
303
|
-
expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|');
|
|
304
|
-
});
|
|
305
|
-
test('use a carat as log delimiter', () => {
|
|
306
|
-
expect(er).toBeTruthy();
|
|
307
|
-
const caratEncoder = new ascii_1.AsciiEncoder(session.buffer, definitions, new ascii_1.TimeFormatter(session.buffer), ascii_1.AsciiChars.Soh, ascii_1.AsciiChars.Carat);
|
|
308
|
-
const e = getParties();
|
|
309
|
-
const fix = toFix(e, er, caratEncoder);
|
|
310
|
-
expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
|
|
311
|
-
});
|
|
312
|
-
test('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {
|
|
313
|
-
expect(er).toBeTruthy();
|
|
314
|
-
const caratEncoder = new ascii_1.AsciiEncoder(session.buffer, definitions, new ascii_1.TimeFormatter(session.buffer), ascii_1.AsciiChars.Soh, ascii_1.AsciiChars.Carat);
|
|
315
|
-
const e = getParties();
|
|
316
|
-
const fix = toFix(e, er, caratEncoder);
|
|
317
|
-
expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^');
|
|
318
|
-
const trimmed = caratEncoder.trim().toString();
|
|
319
|
-
expect(trimmed).toEqual('453=2448=magna.447=9452=28448=iaculis447=F452=2');
|
|
320
|
-
});
|
|
321
|
-
test('encode repeated group with no PartyID - should encode', () => {
|
|
322
|
-
expect(er).toBeTruthy();
|
|
323
|
-
const e = getPartiesNoPartyID();
|
|
324
|
-
const fix = toFix(e, er);
|
|
325
|
-
expect(fix).toEqual('453=1|447=9|452=28|');
|
|
326
|
-
});
|
|
327
|
-
test('encode repeated group with no array - should throw', () => {
|
|
328
|
-
expect(er).toBeTruthy();
|
|
329
|
-
const e = {
|
|
330
|
-
'Parties': {
|
|
331
|
-
'NoPartyIDs': 'should be an array'
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
function run() {
|
|
335
|
-
toFix(e, er);
|
|
336
|
-
}
|
|
337
|
-
expect(run).toThrow(/expected array/);
|
|
338
|
-
});
|
|
339
|
-
test('encode repeated group with empty array', () => {
|
|
340
|
-
expect(er).toBeTruthy();
|
|
341
|
-
const e = {
|
|
342
|
-
'Parties': {
|
|
343
|
-
'NoPartyIDs': []
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
expect(toFix(e, er)).toEqual('453=0|');
|
|
347
|
-
});
|
|
348
|
-
function getInstrument() {
|
|
349
|
-
return {
|
|
350
|
-
'Instrument': {
|
|
351
|
-
'Symbol': 'ac,',
|
|
352
|
-
'SymbolSfx': 'non',
|
|
353
|
-
'SecurityID': 'Pellentesque',
|
|
354
|
-
'SecurityIDSource': 'B',
|
|
355
|
-
'Product': 2
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
function getInstrumentNestedGroup() {
|
|
360
|
-
return {
|
|
361
|
-
'Instrument': {
|
|
362
|
-
'Symbol': 'ac,',
|
|
363
|
-
'SymbolSfx': 'non',
|
|
364
|
-
'SecurityID': 'Pellentesque',
|
|
365
|
-
'SecurityIDSource': 'B',
|
|
366
|
-
'SecAltIDGrp': {
|
|
367
|
-
'NoSecurityAltID': [
|
|
368
|
-
{
|
|
369
|
-
'SecurityAltID': 'lorem',
|
|
370
|
-
'SecurityAltIDSource': 'consequat'
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
'SecurityAltID': 'sapien',
|
|
374
|
-
'SecurityAltIDSource': 'tempor'
|
|
375
|
-
}
|
|
376
|
-
]
|
|
377
|
-
},
|
|
378
|
-
'Product': 2
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
test('encode component', () => {
|
|
383
|
-
expect(er).toBeTruthy();
|
|
384
|
-
const e = getInstrument();
|
|
385
|
-
expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|');
|
|
386
|
-
});
|
|
387
|
-
test('encode component nested group', () => {
|
|
388
|
-
expect(er).toBeTruthy();
|
|
389
|
-
const e = getInstrumentNestedGroup();
|
|
390
|
-
expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|');
|
|
391
|
-
});
|
|
392
|
-
test('encode group missing delimiter', () => {
|
|
393
|
-
expect(er).toBeTruthy();
|
|
394
|
-
const e = getInstrumentNestedGroup();
|
|
395
|
-
delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID'];
|
|
396
|
-
function run() {
|
|
397
|
-
toFix(e, er);
|
|
398
|
-
}
|
|
399
|
-
expect(run).toThrow(/group instance \[1\] inconsisent delimeter 455 expected tag 456/);
|
|
400
|
-
});
|
|
401
|
-
test('encode group not an array of', () => {
|
|
402
|
-
expect(er).toBeTruthy();
|
|
403
|
-
const e = {
|
|
404
|
-
'Instrument': {
|
|
405
|
-
'Symbol': 'ac,',
|
|
406
|
-
'SymbolSfx': 'non',
|
|
407
|
-
'SecurityID': 'Pellentesque',
|
|
408
|
-
'SecurityIDSource': 'B',
|
|
409
|
-
'SecAltIDGrp': {
|
|
410
|
-
'NoSecurityAltID': {
|
|
411
|
-
elements: []
|
|
412
|
-
}
|
|
413
|
-
},
|
|
414
|
-
'Product': 2
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
function run() {
|
|
418
|
-
toFix(e, er);
|
|
419
|
-
}
|
|
420
|
-
expect(run).toThrow(/expected array instance for group NoSecurityAltID/);
|
|
421
|
-
});
|
|
422
|
-
function getCompID(securityType) {
|
|
423
|
-
switch (securityType) {
|
|
424
|
-
case quickfix_1.SecurityType.CommonStock: {
|
|
425
|
-
return 'DepA';
|
|
426
|
-
}
|
|
427
|
-
case quickfix_1.SecurityType.CorporateBond: {
|
|
428
|
-
return 'DepB';
|
|
429
|
-
}
|
|
430
|
-
case quickfix_1.SecurityType.ConvertibleBond: {
|
|
431
|
-
return 'DepC';
|
|
432
|
-
}
|
|
433
|
-
default:
|
|
434
|
-
return 'DepD';
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function createOrder(id, symbol, securityType, side, qty, price) {
|
|
438
|
-
return {
|
|
439
|
-
StandardHeader: {
|
|
440
|
-
DeliverToCompID: getCompID(securityType)
|
|
441
|
-
},
|
|
442
|
-
ClOrdID: `Cli${id}`,
|
|
443
|
-
Account: 'MyAcc',
|
|
444
|
-
Side: side,
|
|
445
|
-
Price: price,
|
|
446
|
-
OrdType: quickfix_1.OrdType.Limit,
|
|
447
|
-
OrderQtyData: {
|
|
448
|
-
OrderQty: qty
|
|
449
|
-
},
|
|
450
|
-
Instrument: {
|
|
451
|
-
SecurityType: securityType,
|
|
452
|
-
Symbol: symbol,
|
|
453
|
-
SecurityID: '459200101',
|
|
454
|
-
SecurityIDSource: quickfix_1.SecurityIDSource.IsinNumber
|
|
455
|
-
},
|
|
456
|
-
TimeInForce: quickfix_1.TimeInForce.Day
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
test('encode custom header 1 - expect DeliverToCompID DepA', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
460
|
-
const type = quickfix_1.SecurityType.CommonStock;
|
|
461
|
-
const o1 = createOrder(1, 'MS', type, quickfix_1.Side.Buy, 100, 1000.0);
|
|
462
|
-
const nosd = definitions.message.get('NewOrderSingle');
|
|
463
|
-
const fix = toFixMessage(o1, nosd);
|
|
464
|
-
expect(fix).toBeTruthy();
|
|
465
|
-
const res = yield setup.client.parseText(fix);
|
|
466
|
-
const tag = res.view.getTyped('DeliverToCompID');
|
|
467
|
-
expect(tag).toEqual('DepA');
|
|
468
|
-
expect(res.event).toEqual('msg');
|
|
469
|
-
expect(res.msgType).toEqual(__1.MsgType.NewOrderSingle);
|
|
470
|
-
const parsed = res.view.toObject();
|
|
471
|
-
expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepA');
|
|
472
|
-
}));
|
|
473
|
-
test('encode custom header 2 - expect DeliverToCompID DepC', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
474
|
-
const type = quickfix_1.SecurityType.ConvertibleBond;
|
|
475
|
-
const o1 = createOrder(1, 'MSCb', type, quickfix_1.Side.Buy, 100, 1000.0);
|
|
476
|
-
const nosd = definitions.message.get('NewOrderSingle');
|
|
477
|
-
const fix = toFixMessage(o1, nosd);
|
|
478
|
-
expect(fix).toBeTruthy();
|
|
479
|
-
const res = yield setup.client.parseText(fix);
|
|
480
|
-
const tag = res.view.getTyped('DeliverToCompID');
|
|
481
|
-
expect(tag).toEqual('DepC');
|
|
482
|
-
expect(res.event).toEqual('msg');
|
|
483
|
-
expect(res.msgType).toEqual(__1.MsgType.NewOrderSingle);
|
|
484
|
-
const parsed = res.view.toObject();
|
|
485
|
-
expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepC');
|
|
486
|
-
}));
|
|
487
|
-
test('encode custom header - include MsgSeqNum (for resends we do not want to overwrite)', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
488
|
-
const type = quickfix_1.SecurityType.ConvertibleBond;
|
|
489
|
-
const seqNum = 10;
|
|
490
|
-
const o1 = createOrder(1, 'MSCb', type, quickfix_1.Side.Buy, 100, 1000.0);
|
|
491
|
-
o1.StandardHeader.MsgSeqNum = seqNum;
|
|
492
|
-
o1.StandardHeader.PossDupFlag = true;
|
|
493
|
-
const nosd = definitions.message.get('NewOrderSingle');
|
|
494
|
-
expect(nosd).toBeTruthy();
|
|
495
|
-
const fix = toFixMessage(o1, nosd);
|
|
496
|
-
expect(fix).toBeTruthy();
|
|
497
|
-
const res = yield setup.client.parseText(fix);
|
|
498
|
-
expect(res.event).toEqual('msg');
|
|
499
|
-
expect(res.msgType).toEqual(__1.MsgType.NewOrderSingle);
|
|
500
|
-
const parsed = res.view.toObject();
|
|
501
|
-
const h = parsed.StandardHeader;
|
|
502
|
-
expect(h.DeliverToCompID).toEqual('DepC');
|
|
503
|
-
expect(h.MsgSeqNum).toEqual(seqNum);
|
|
504
|
-
expect(h.BeginString).toEqual('FIX4.4');
|
|
505
|
-
expect(h.PossDupFlag).toEqual(true);
|
|
506
|
-
expect(h.MsgType).toEqual(__1.MsgType.NewOrderSingle);
|
|
507
|
-
}));
|
|
508
|
-
//# sourceMappingURL=ascii-encoder.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ascii-encoder.test.js","sourceRoot":"","sources":["../../src/test/ascii-encoder.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AAGzB,sCAA+C;AAC/C,2CAAyE;AAEzE,uDAEkG;AAClG,0BAA4B;AAG5B,uCAAmC;AAGnC,IAAI,WAA2B,CAAA;AAC/B,IAAI,OAA4B,CAAA;AAChC,IAAI,OAAqB,CAAA;AACzB,IAAI,GAAsB,CAAA;AAC1B,IAAI,EAAqB,CAAA;AAEzB,MAAM,SAAS,GAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,YAAY,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1E,MAAM,OAAO,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE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CAAA;IACnD,MAAM,MAAM,GAAoB,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;IACnD,MAAM,CAAC,GAAoB,MAAM,CAAC,cAAc,CAAA;IAChD,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACzC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACvC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAO,CAAC,cAAc,CAAC,CAAA;AACnD,CAAC,CAAA,CAAC,CAAA","sourcesContent":["import 'reflect-metadata'\r\n\r\nimport { ComponentFieldDefinition, FixDefinitions, MessageDefinition } from '../dictionary/definition'\r\nimport { ElasticBuffer, Tags } from '../buffer'\r\nimport { AsciiChars, AsciiEncoder, TimeFormatter } from '../buffer/ascii'\r\nimport { ILooseObject } from '../collections/collection'\r\nimport { IInstrument, INewOrderSingle, IOrderQtyData, OrdType, SecurityIDSource,\r\n SecurityType, Side, TimeInForce, IStandardHeader, ITradeCaptureReportRequest,\r\n TradeRequestType, SubscriptionRequestType, ITrdCapDtGrpNoDates } from '../types/FIX4.4/quickfix'\r\nimport { MsgType } from '..'\r\nimport { ContainedFieldSet } from '../dictionary/contained'\r\nimport { AsciiMsgTransmitter } from '../transport/ascii/ascii-msg-transmitter'\r\nimport { Setup } from './env/setup'\r\nimport { ParsingResult } from './env/parsing-result'\r\n\r\nlet definitions: FixDefinitions\r\nlet session: AsciiMsgTransmitter\r\nlet encoder: AsciiEncoder\r\nlet nos: MessageDefinition\r\nlet er: MessageDefinition\r\n\r\nconst localDate: Date = new Date(2018, 6, 25)\r\nconst utcTimeStamp: Date = new Date(Date.UTC(2018, 5, 10, 16, 35, 0, 246))\r\nconst utcDate: Date = new Date(Date.UTC(2018, 5, 10, 0, 0, 0, 0))\r\nconst utcTime: Date = new Date(Date.UTC(2018, 0, 1, 16, 35, 0, 246))\r\nlet setup: Setup\r\nlet buffer: ElasticBuffer\r\n\r\nbeforeAll(async () => {\r\n setup = new Setup('session/qf-fix44.json', null)\r\n await setup.init()\r\n definitions = setup.definitions\r\n const config = setup.clientConfig\r\n definitions = config.definitions\r\n session = setup.client.transmitter as AsciiMsgTransmitter\r\n buffer = setup.client.txBuffer\r\n encoder = session.encoder as AsciiEncoder\r\n nos = definitions.message.get('NewOrderSingle')\r\n er = definitions.message.get('ExecutionReport')\r\n}, 45000)\r\n\r\ntest('expect a definition ', () => {\r\n expect(nos).toBeTruthy()\r\n})\r\n\r\nfunction toFix (o: ILooseObject, set?: ContainedFieldSet, enc?: AsciiEncoder): string {\r\n const theEncode = enc ? enc : encoder\r\n session.buffer.reset()\r\n if (set) {\r\n theEncode.encode(o, set.name)\r\n } else {\r\n theEncode.encode(o, nos.name)\r\n }\r\n return session.buffer.toString()\r\n}\r\n\r\nfunction toFixMessage (o: ILooseObject, msg: MessageDefinition): string {\r\n session.encodeMessage(msg.msgType, o)\r\n return session.buffer.toString()\r\n}\r\n\r\ntest('encode heartbeat', async () => {\r\n const factory = session.config.factory\r\n const hb = factory.heartbeat('test01')\r\n const hbd = definitions.message.get('Heartbeat')\r\n const fix = toFixMessage(hb, hbd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await setup.client.parseText(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual('0')\r\n const len = res.view.getTyped(Tags.BodyLengthTag)\r\n const expected = fix.length - '8=FIX4.4|9=0000081|'.length - '10=159|'.length\r\n expect(len).toEqual(expected)\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n PossDupFlag: true\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('43=Y|')\r\n})\r\n\r\ntest('encode custom header PossDupFlag', () => {\r\n const no: ILooseObject = {\r\n StandardHeader: {\r\n MsgSeqNum: 9999\r\n }\r\n }\r\n const fix: string = toFixMessage(no, definitions.message.get('Heartbeat'))\r\n expect(fix).toMatch('34=9999|')\r\n})\r\n\r\ntest('encode string ClOrdID ', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = 'Order-a'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('11=Order-a|')\r\n})\r\n\r\ntest('should not encode empty string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = ''\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('should not encode null string', () => {\r\n const no: ILooseObject = {}\r\n no.ClOrdID = null\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('')\r\n})\r\n\r\ntest('encode +ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=100|')\r\n})\r\n\r\ntest('encode -ve numeric (int) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -100\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-100|')\r\n})\r\n\r\ntest('encode +ve numeric (double 8dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678|')\r\n})\r\n\r\ntest('encode +ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = 123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode -ve numeric (double 14dp) Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = -123.12345678901234\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=-123.12345678901234|')\r\n})\r\n\r\ntest('encode +ve string Price ', () => {\r\n const no: ILooseObject = {}\r\n no.Price = '123.12345678901234'\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('44=123.12345678901234|')\r\n})\r\n\r\ntest('encode LocalDate TradeDate ', () => {\r\n const no: ILooseObject = {}\r\n no.TradeDate = localDate\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('75=20180725|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime ', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = utcTimeStamp\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180610-16:35:00.246|')\r\n})\r\n\r\ntest('encode UTCTIMESTAMP ExpireTime - check padding', () => {\r\n const no: ILooseObject = {}\r\n no.ExpireTime = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 1))\r\n const fix: string = toFix(no)\r\n expect(fix).toEqual('126=20180101-00:00:00.001|')\r\n})\r\n\r\ntest('encode UTCDATEONLY MDEntryDate', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryDate: utcDate\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|272=20180610|')\r\n})\r\n\r\ntest('encode UTCTIMEONLY MDEntryTime', () => {\r\n const mdGrp: ComponentFieldDefinition = definitions.component.get('MDFullGrp')\r\n expect(mdGrp).toBeTruthy()\r\n const grp: ILooseObject = {\r\n NoMDEntries: [\r\n {\r\n MDEntryType: '0',\r\n MDEntryTime: utcTime\r\n }\r\n ]\r\n }\r\n const fix: string = toFix(grp, mdGrp)\r\n expect(fix).toEqual('268=1|269=0|273=16:35:00.246|')\r\n})\r\n\r\nfunction getTCR1 (): ITradeCaptureReportRequest {\r\n const d0 = new Date(Date.UTC(2018, 11, 1, 0, 0, 0))\r\n const d1 = new Date(Date.UTC(2018, 11, 2, 0, 0, 0))\r\n const tcr = {\r\n TradeRequestID: 'all-trades',\r\n TradeRequestType: TradeRequestType.AllTrades,\r\n SubscriptionRequestType: SubscriptionRequestType.SnapshotPlusUpdates,\r\n TrdCapDtGrp : {\r\n NoDates: [\r\n {\r\n TransactTime: d0\r\n },\r\n {\r\n TransactTime: d1\r\n }\r\n ] as ITrdCapDtGrpNoDates[]\r\n }\r\n } as ITradeCaptureReportRequest\r\n return tcr\r\n}\r\n\r\ntest('encode TradeCaptureReportRequest with TransactTime', () => {\r\n const tcr = getTCR1()\r\n const d = definitions.message.get('TradeCaptureReportRequest')\r\n const fix: string = toFix(tcr, d)\r\n expect(fix).toEqual('568=all-trades|569=0|263=1|580=2|60=20181201-00:00:00.000|60=20181202-00:00:00.000|')\r\n})\r\n\r\ntest('encode BOOLEAN (true) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = true\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (truthy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 1\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (string) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 'TRUE'\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=Y|')\r\n})\r\n\r\ntest('encode BOOLEAN (false) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = false\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode BOOLEAN (falsy) ReportToExch', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {}\r\n e.ReportToExch = 0\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('113=N|')\r\n})\r\n\r\ntest('encode RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = 'this is fix'\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=11|355=this is fix|')\r\n})\r\n\r\ntest('encode empty RawData EncodedText', () => {\r\n expect(er).toBeTruthy()\r\n const toEncode: string = ''\r\n const e: ILooseObject = {\r\n EncodedText: Buffer.alloc(toEncode.length, toEncode, 'utf8')\r\n }\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('354=0|355=|')\r\n})\r\n\r\nfunction getParties (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n 'PartyID': 'magna.',\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n },\r\n {\r\n 'PartyID': 'iaculis',\r\n 'PartyIDSource': 'F',\r\n 'PartyRole': 2\r\n }]\r\n }\r\n }\r\n}\r\n\r\nfunction getPartiesNoPartyID (): ILooseObject {\r\n return {\r\n 'Parties': {\r\n 'NoPartyIDs': [\r\n {\r\n // missing PartyID\r\n 'PartyIDSource': '9',\r\n 'PartyRole': 28\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n\r\ntest('encode repeated group of simple repository Parties', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('453=2|448=magna.|447=9|452=28|448=iaculis|447=F|452=2|')\r\n})\r\n\r\ntest('use a carat as log delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n})\r\n\r\ntest('use a carat as log delimiter with Soh in buffer to show encoding still works', () => {\r\n expect(er).toBeTruthy()\r\n const caratEncoder = new AsciiEncoder(session.buffer, definitions, new TimeFormatter(session.buffer), AsciiChars.Soh, AsciiChars.Carat)\r\n const e: ILooseObject = getParties()\r\n const fix: string = toFix(e, er, caratEncoder)\r\n expect(fix).toEqual('453=2^448=magna.^447=9^452=28^448=iaculis^447=F^452=2^')\r\n const trimmed = caratEncoder.trim().toString()\r\n expect(trimmed).toEqual('453=2\u0001448=magna.\u0001447=9\u0001452=28\u0001448=iaculis\u0001447=F\u0001452=2\u0001')\r\n})\r\n\r\ntest('encode repeated group with no PartyID - should encode', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getPartiesNoPartyID()\r\n const fix: string = toFix(e, er)\r\n expect(fix).toEqual('453=1|447=9|452=28|')\r\n})\r\n\r\ntest('encode repeated group with no array - should throw', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': 'should be an array'\r\n }\r\n }\r\n function run (): void {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array/)\r\n})\r\n\r\ntest('encode repeated group with empty array', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Parties': {\r\n 'NoPartyIDs': []\r\n }\r\n }\r\n expect(toFix(e, er)).toEqual('453=0|')\r\n})\r\n\r\nfunction getInstrument (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\nfunction getInstrumentNestedGroup (): ILooseObject {\r\n return {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': [\r\n {\r\n 'SecurityAltID': 'lorem',\r\n 'SecurityAltIDSource': 'consequat'\r\n },\r\n {\r\n 'SecurityAltID': 'sapien',\r\n 'SecurityAltIDSource': 'tempor'\r\n }\r\n ]\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n}\r\n\r\ntest('encode component', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrument()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|460=2|')\r\n})\r\n\r\ntest('encode component nested group', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n expect(toFix(e, er)).toEqual('55=ac,|65=non|48=Pellentesque|22=B|454=2|455=lorem|456=consequat|455=sapien|456=tempor|460=2|')\r\n})\r\n\r\ntest('encode group missing delimiter', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = getInstrumentNestedGroup()\r\n delete e.Instrument.SecAltIDGrp.NoSecurityAltID[0]['SecurityAltID']\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/group instance \\[1\\] inconsisent delimeter 455 expected tag 456/)\r\n})\r\n\r\ntest('encode group not an array of', () => {\r\n expect(er).toBeTruthy()\r\n const e: ILooseObject = {\r\n 'Instrument': {\r\n 'Symbol': 'ac,',\r\n 'SymbolSfx': 'non',\r\n 'SecurityID': 'Pellentesque',\r\n 'SecurityIDSource': 'B',\r\n 'SecAltIDGrp': {\r\n 'NoSecurityAltID': {\r\n elements: []\r\n }\r\n },\r\n 'Product': 2\r\n }\r\n }\r\n function run () {\r\n toFix(e, er)\r\n }\r\n expect(run).toThrow(/expected array instance for group NoSecurityAltID/)\r\n})\r\n\r\nfunction getCompID (securityType: SecurityType): string {\r\n switch (securityType) {\r\n case SecurityType.CommonStock: {\r\n return 'DepA'\r\n }\r\n\r\n case SecurityType.CorporateBond: {\r\n return 'DepB'\r\n }\r\n\r\n case SecurityType.ConvertibleBond: {\r\n return 'DepC'\r\n }\r\n\r\n default:\r\n return 'DepD'\r\n }\r\n}\r\n\r\nfunction createOrder (id: number, symbol: string, securityType: SecurityType, side: Side, qty: number, price: number): INewOrderSingle {\r\n return {\r\n StandardHeader: {\r\n DeliverToCompID: getCompID(securityType)\r\n } as IStandardHeader,\r\n ClOrdID: `Cli${id}`,\r\n Account: 'MyAcc',\r\n Side: side,\r\n Price: price,\r\n OrdType: OrdType.Limit,\r\n OrderQtyData: {\r\n OrderQty: qty\r\n } as IOrderQtyData,\r\n Instrument: {\r\n SecurityType: securityType,\r\n Symbol: symbol,\r\n SecurityID: '459200101',\r\n SecurityIDSource: SecurityIDSource.IsinNumber\r\n } as IInstrument,\r\n TimeInForce: TimeInForce.Day\r\n } as INewOrderSingle\r\n}\r\n\r\ntest('encode custom header 1 - expect DeliverToCompID DepA', async () => {\r\n const type = SecurityType.CommonStock\r\n const o1 = createOrder(1, 'MS', type, Side.Buy, 100, 1000.0)\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await setup.client.parseText(fix)\r\n const tag = res.view.getTyped('DeliverToCompID')\r\n expect(tag).toEqual('DepA')\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepA')\r\n})\r\n\r\ntest('encode custom header 2 - expect DeliverToCompID DepC', async () => {\r\n const type = SecurityType.ConvertibleBond\r\n const o1 = createOrder(1, 'MSCb', type, Side.Buy, 100, 1000.0)\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await setup.client.parseText(fix)\r\n const tag = res.view.getTyped('DeliverToCompID')\r\n expect(tag).toEqual('DepC')\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n expect(parsed.StandardHeader.DeliverToCompID).toEqual('DepC')\r\n})\r\n\r\ntest('encode custom header - include MsgSeqNum (for resends we do not want to overwrite)', async () => {\r\n const type = SecurityType.ConvertibleBond\r\n const seqNum: number = 10\r\n const o1 = createOrder(1, 'MSCb', type, Side.Buy, 100, 1000.0)\r\n o1.StandardHeader.MsgSeqNum = seqNum\r\n o1.StandardHeader.PossDupFlag = true\r\n const nosd = definitions.message.get('NewOrderSingle')\r\n expect(nosd).toBeTruthy()\r\n const fix = toFixMessage(o1, nosd)\r\n expect(fix).toBeTruthy()\r\n const res: ParsingResult = await setup.client.parseText(fix)\r\n expect(res.event).toEqual('msg')\r\n expect(res.msgType).toEqual(MsgType.NewOrderSingle)\r\n const parsed: INewOrderSingle = res.view.toObject()\r\n const h: IStandardHeader = parsed.StandardHeader\r\n expect(h.DeliverToCompID).toEqual('DepC')\r\n expect(h.MsgSeqNum).toEqual(seqNum)\r\n expect(h.BeginString).toEqual('FIX4.4')\r\n expect(h.PossDupFlag).toEqual(true)\r\n expect(h.MsgType).toEqual(MsgType.NewOrderSingle)\r\n})\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|