UNPKG

@reactivemarkets/switchboard-api

Version:

Generated api for Reactive Markets Switchboard network

612 lines (611 loc) 24.1 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExecutionReport = void 0; const flatbuffers = __importStar(require("flatbuffers")); const Enum_generated_js_1 = require("./Enum_generated.js"); const StrategyParameter_generated_js_1 = require("./StrategyParameter_generated.js"); /** * The Execution Report message is sent by the maker to communicate order * updates. This includes initial order acknowledgement, rejects, trade * executions, cancellations or any other status update. */ class ExecutionReport { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsExecutionReport(bb, obj) { return (obj || new ExecutionReport()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsExecutionReport(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new ExecutionReport()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } /** * The time that the order is valid from. */ effectiveTime() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0'); } /** * Transaction time. */ transactTime() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0'); } user(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } account(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } symbol(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } venue(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } tenor(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } execId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } orderId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } quoteId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 22); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } clOrderId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 24); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } /** * Security Type. defaults to Spot. */ securityType() { const offset = this.bb.__offset(this.bb_pos, 26); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.SecurityType.Spot; } /** * Order side. */ side() { const offset = this.bb.__offset(this.bb_pos, 28); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.Side.None; } /** * See OrderType. */ orderType() { const offset = this.bb.__offset(this.bb_pos, 30); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.OrderType.None; } /** * See TimeInForce. */ timeInForce() { const offset = this.bb.__offset(this.bb_pos, 32); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.TimeInForce.None; } /** * See ExecType. */ execType() { const offset = this.bb.__offset(this.bb_pos, 34); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.ExecType.None; } /** * Describes the current state of the order. */ orderStatus() { const offset = this.bb.__offset(this.bb_pos, 36); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.OrderStatus.None; } /** * Liquidity indicator. */ liqInd() { const offset = this.bb.__offset(this.bb_pos, 38); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.LiqInd.None; } /** * Order quantity. */ qty() { const offset = this.bb.__offset(this.bb_pos, 40); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Order price. */ price() { const offset = this.bb.__offset(this.bb_pos, 42); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } ccy(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 44); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } /** * Remaining order quantity. */ leavesQty() { const offset = this.bb.__offset(this.bb_pos, 46); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Total quantity executed by order fills. */ cumQty() { const offset = this.bb.__offset(this.bb_pos, 48); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Average price of order fills. */ avgPrice() { const offset = this.bb.__offset(this.bb_pos, 50); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Last trade quantity. */ lastQty() { const offset = this.bb.__offset(this.bb_pos, 52); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Last trade price. */ lastPrice() { const offset = this.bb.__offset(this.bb_pos, 54); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * The fixing date in YYYYMMDD format. */ fixingDate() { const offset = this.bb.__offset(this.bb_pos, 56); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } /** * The settlement date at the time of transaction in YYYYMMDD format. */ settlementDate() { const offset = this.bb.__offset(this.bb_pos, 58); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } execVenue(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 60); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } counterparty(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 62); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } /** * Optional code to identify the order reject reason when ExecType Rejected. */ errorCode() { const offset = this.bb.__offset(this.bb_pos, 64); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } strategy(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 66); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } /** * Strategy Parameters */ strategyParameters(index, obj) { const offset = this.bb.__offset(this.bb_pos, 68); return offset ? (obj || new StrategyParameter_generated_js_1.StrategyParameter()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } strategyParametersLength() { const offset = this.bb.__offset(this.bb_pos, 68); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } text(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 70); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } execVenues(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 72); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } execVenuesLength() { const offset = this.bb.__offset(this.bb_pos, 72); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } /** * Last forward points. */ lastFwdPoints() { const offset = this.bb.__offset(this.bb_pos, 74); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swap only, far leg last forward points. */ farLastFwdPoints() { const offset = this.bb.__offset(this.bb_pos, 76); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swap only, far leg all-in price. */ farPrice() { const offset = this.bb.__offset(this.bb_pos, 78); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swap only, far leg quantity. */ farQty() { const offset = this.bb.__offset(this.bb_pos, 80); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } farTenor(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 82); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } /** * Swaps only, far leg total quantity filled. */ farCumQty() { const offset = this.bb.__offset(this.bb_pos, 84); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, far leg average price of order fills. */ farAvgPrice() { const offset = this.bb.__offset(this.bb_pos, 86); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, far leg last trade quantity. */ farLastQty() { const offset = this.bb.__offset(this.bb_pos, 88); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, far last trade price. */ farLastPrice() { const offset = this.bb.__offset(this.bb_pos, 90); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, far leg fixing date in YYYYMMDD format. */ farFixingDate() { const offset = this.bb.__offset(this.bb_pos, 92); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } /** * Swaps only, far leg settlement date at the time of transaction in YYYYMMDD format. */ farSettlementDate() { const offset = this.bb.__offset(this.bb_pos, 94); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } /** * Swaps only, far leg remaining order quantity. */ farLeavesQty() { const offset = this.bb.__offset(this.bb_pos, 96); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Dodd-Frank mid price. */ midPrice() { const offset = this.bb.__offset(this.bb_pos, 98); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, far leg Dodd-Frank mid price */ farMidPrice() { const offset = this.bb.__offset(this.bb_pos, 100); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * Swaps only, Dodd-Frank mid swap points */ midSwapPoints() { const offset = this.bb.__offset(this.bb_pos, 102); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } /** * See ExecInst. */ execInst() { const offset = this.bb.__offset(this.bb_pos, 104); return offset ? this.bb.readInt16(this.bb_pos + offset) : Enum_generated_js_1.ExecInst.None; } static startExecutionReport(builder) { builder.startObject(51); } static addEffectiveTime(builder, effectiveTime) { builder.addFieldInt64(0, effectiveTime, BigInt('0')); } static addTransactTime(builder, transactTime) { builder.addFieldInt64(1, transactTime, BigInt('0')); } static addUser(builder, userOffset) { builder.addFieldOffset(2, userOffset, 0); } static addAccount(builder, accountOffset) { builder.addFieldOffset(3, accountOffset, 0); } static addSymbol(builder, symbolOffset) { builder.addFieldOffset(4, symbolOffset, 0); } static addVenue(builder, venueOffset) { builder.addFieldOffset(5, venueOffset, 0); } static addTenor(builder, tenorOffset) { builder.addFieldOffset(6, tenorOffset, 0); } static addExecId(builder, execIdOffset) { builder.addFieldOffset(7, execIdOffset, 0); } static addOrderId(builder, orderIdOffset) { builder.addFieldOffset(8, orderIdOffset, 0); } static addQuoteId(builder, quoteIdOffset) { builder.addFieldOffset(9, quoteIdOffset, 0); } static addClOrderId(builder, clOrderIdOffset) { builder.addFieldOffset(10, clOrderIdOffset, 0); } static addSecurityType(builder, securityType) { builder.addFieldInt16(11, securityType, Enum_generated_js_1.SecurityType.Spot); } static addSide(builder, side) { builder.addFieldInt16(12, side, Enum_generated_js_1.Side.None); } static addOrderType(builder, orderType) { builder.addFieldInt16(13, orderType, Enum_generated_js_1.OrderType.None); } static addTimeInForce(builder, timeInForce) { builder.addFieldInt16(14, timeInForce, Enum_generated_js_1.TimeInForce.None); } static addExecType(builder, execType) { builder.addFieldInt16(15, execType, Enum_generated_js_1.ExecType.None); } static addOrderStatus(builder, orderStatus) { builder.addFieldInt16(16, orderStatus, Enum_generated_js_1.OrderStatus.None); } static addLiqInd(builder, liqInd) { builder.addFieldInt16(17, liqInd, Enum_generated_js_1.LiqInd.None); } static addQty(builder, qty) { builder.addFieldFloat64(18, qty, 0.0); } static addPrice(builder, price) { builder.addFieldFloat64(19, price, 0.0); } static addCcy(builder, ccyOffset) { builder.addFieldOffset(20, ccyOffset, 0); } static addLeavesQty(builder, leavesQty) { builder.addFieldFloat64(21, leavesQty, 0.0); } static addCumQty(builder, cumQty) { builder.addFieldFloat64(22, cumQty, 0.0); } static addAvgPrice(builder, avgPrice) { builder.addFieldFloat64(23, avgPrice, 0.0); } static addLastQty(builder, lastQty) { builder.addFieldFloat64(24, lastQty, 0.0); } static addLastPrice(builder, lastPrice) { builder.addFieldFloat64(25, lastPrice, 0.0); } static addFixingDate(builder, fixingDate) { builder.addFieldInt32(26, fixingDate, 0); } static addSettlementDate(builder, settlementDate) { builder.addFieldInt32(27, settlementDate, 0); } static addExecVenue(builder, execVenueOffset) { builder.addFieldOffset(28, execVenueOffset, 0); } static addCounterparty(builder, counterpartyOffset) { builder.addFieldOffset(29, counterpartyOffset, 0); } static addErrorCode(builder, errorCode) { builder.addFieldInt32(30, errorCode, 0); } static addStrategy(builder, strategyOffset) { builder.addFieldOffset(31, strategyOffset, 0); } static addStrategyParameters(builder, strategyParametersOffset) { builder.addFieldOffset(32, strategyParametersOffset, 0); } static createStrategyParametersVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startStrategyParametersVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addText(builder, textOffset) { builder.addFieldOffset(33, textOffset, 0); } static addExecVenues(builder, execVenuesOffset) { builder.addFieldOffset(34, execVenuesOffset, 0); } static createExecVenuesVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startExecVenuesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addLastFwdPoints(builder, lastFwdPoints) { builder.addFieldFloat64(35, lastFwdPoints, 0.0); } static addFarLastFwdPoints(builder, farLastFwdPoints) { builder.addFieldFloat64(36, farLastFwdPoints, 0.0); } static addFarPrice(builder, farPrice) { builder.addFieldFloat64(37, farPrice, 0.0); } static addFarQty(builder, farQty) { builder.addFieldFloat64(38, farQty, 0.0); } static addFarTenor(builder, farTenorOffset) { builder.addFieldOffset(39, farTenorOffset, 0); } static addFarCumQty(builder, farCumQty) { builder.addFieldFloat64(40, farCumQty, 0.0); } static addFarAvgPrice(builder, farAvgPrice) { builder.addFieldFloat64(41, farAvgPrice, 0.0); } static addFarLastQty(builder, farLastQty) { builder.addFieldFloat64(42, farLastQty, 0.0); } static addFarLastPrice(builder, farLastPrice) { builder.addFieldFloat64(43, farLastPrice, 0.0); } static addFarFixingDate(builder, farFixingDate) { builder.addFieldInt32(44, farFixingDate, 0); } static addFarSettlementDate(builder, farSettlementDate) { builder.addFieldInt32(45, farSettlementDate, 0); } static addFarLeavesQty(builder, farLeavesQty) { builder.addFieldFloat64(46, farLeavesQty, 0.0); } static addMidPrice(builder, midPrice) { builder.addFieldFloat64(47, midPrice, 0.0); } static addFarMidPrice(builder, farMidPrice) { builder.addFieldFloat64(48, farMidPrice, 0.0); } static addMidSwapPoints(builder, midSwapPoints) { builder.addFieldFloat64(49, midSwapPoints, 0.0); } static addExecInst(builder, execInst) { builder.addFieldInt16(50, execInst, Enum_generated_js_1.ExecInst.None); } static endExecutionReport(builder) { const offset = builder.endObject(); builder.requiredField(offset, 10); // account builder.requiredField(offset, 12); // symbol builder.requiredField(offset, 14); // venue builder.requiredField(offset, 18); // exec_id builder.requiredField(offset, 20); // order_id return offset; } static createExecutionReport(builder, effectiveTime, transactTime, userOffset, accountOffset, symbolOffset, venueOffset, tenorOffset, execIdOffset, orderIdOffset, quoteIdOffset, clOrderIdOffset, securityType, side, orderType, timeInForce, execType, orderStatus, liqInd, qty, price, ccyOffset, leavesQty, cumQty, avgPrice, lastQty, lastPrice, fixingDate, settlementDate, execVenueOffset, counterpartyOffset, errorCode, strategyOffset, strategyParametersOffset, textOffset, execVenuesOffset, lastFwdPoints, farLastFwdPoints, farPrice, farQty, farTenorOffset, farCumQty, farAvgPrice, farLastQty, farLastPrice, farFixingDate, farSettlementDate, farLeavesQty, midPrice, farMidPrice, midSwapPoints, execInst) { ExecutionReport.startExecutionReport(builder); ExecutionReport.addEffectiveTime(builder, effectiveTime); ExecutionReport.addTransactTime(builder, transactTime); ExecutionReport.addUser(builder, userOffset); ExecutionReport.addAccount(builder, accountOffset); ExecutionReport.addSymbol(builder, symbolOffset); ExecutionReport.addVenue(builder, venueOffset); ExecutionReport.addTenor(builder, tenorOffset); ExecutionReport.addExecId(builder, execIdOffset); ExecutionReport.addOrderId(builder, orderIdOffset); ExecutionReport.addQuoteId(builder, quoteIdOffset); ExecutionReport.addClOrderId(builder, clOrderIdOffset); ExecutionReport.addSecurityType(builder, securityType); ExecutionReport.addSide(builder, side); ExecutionReport.addOrderType(builder, orderType); ExecutionReport.addTimeInForce(builder, timeInForce); ExecutionReport.addExecType(builder, execType); ExecutionReport.addOrderStatus(builder, orderStatus); ExecutionReport.addLiqInd(builder, liqInd); ExecutionReport.addQty(builder, qty); ExecutionReport.addPrice(builder, price); ExecutionReport.addCcy(builder, ccyOffset); ExecutionReport.addLeavesQty(builder, leavesQty); ExecutionReport.addCumQty(builder, cumQty); ExecutionReport.addAvgPrice(builder, avgPrice); ExecutionReport.addLastQty(builder, lastQty); ExecutionReport.addLastPrice(builder, lastPrice); ExecutionReport.addFixingDate(builder, fixingDate); ExecutionReport.addSettlementDate(builder, settlementDate); ExecutionReport.addExecVenue(builder, execVenueOffset); ExecutionReport.addCounterparty(builder, counterpartyOffset); ExecutionReport.addErrorCode(builder, errorCode); ExecutionReport.addStrategy(builder, strategyOffset); ExecutionReport.addStrategyParameters(builder, strategyParametersOffset); ExecutionReport.addText(builder, textOffset); ExecutionReport.addExecVenues(builder, execVenuesOffset); ExecutionReport.addLastFwdPoints(builder, lastFwdPoints); ExecutionReport.addFarLastFwdPoints(builder, farLastFwdPoints); ExecutionReport.addFarPrice(builder, farPrice); ExecutionReport.addFarQty(builder, farQty); ExecutionReport.addFarTenor(builder, farTenorOffset); ExecutionReport.addFarCumQty(builder, farCumQty); ExecutionReport.addFarAvgPrice(builder, farAvgPrice); ExecutionReport.addFarLastQty(builder, farLastQty); ExecutionReport.addFarLastPrice(builder, farLastPrice); ExecutionReport.addFarFixingDate(builder, farFixingDate); ExecutionReport.addFarSettlementDate(builder, farSettlementDate); ExecutionReport.addFarLeavesQty(builder, farLeavesQty); ExecutionReport.addMidPrice(builder, midPrice); ExecutionReport.addFarMidPrice(builder, farMidPrice); ExecutionReport.addMidSwapPoints(builder, midSwapPoints); ExecutionReport.addExecInst(builder, execInst); return ExecutionReport.endExecutionReport(builder); } } exports.ExecutionReport = ExecutionReport;