Skip to main content

Trayport gRPC Trade Connector

Features

custom-trayportConnector Key
Instruments
FUTURE
Request Types
SUBMITCANCELREPLACE
Order Types
MARKETLIMIT
Time In Force
GTCIOCFOK
Order ID Mapper
CUSTOM
Order Status Request
Cancel On Disconnect
Commission
Post Only
Fast Cancel
Fast Replace

Notes

Communication

graph LR
subgraph Ember
Algo-->TC[Trayport TC]
end
subgraph TR[gRPC Server]
C[GV Connector]
end
TC==gRPC==>C
C==GV API==>Exchange

Order Update (Replace)

Trayport does not support In-Flight-Mitigation for UPDATE order action.
I.e. in update request they expect "desired outstanding quantity" rather than "total intended quantity (including the amount already executed for this chain of orders)".

The Ember Trading API always expects the total intended quantity for Replace requests. When sending an update to Trayport, the connector adjusts the outbound quantity accordingly.

Note: In case of an in-flight trade, this adjustment cannot prevent overfills.

Time In Force

Trayport does not reject orders with an unsupported TIF. For example, if the instrument does not support IOC/FOK, the order is silently converted to GTC.

TradeOrder Action

To use a trade order action instead of a regular order, populate QuoteId in the new order request. Supported two formats:

  • <engineId>#<brokerId>#<orderId>#<routeId>
  • <orderId> (in this case engId and brokerId will be set to 0)

MiFID attributes are also supported, as with Order actions.

Symbols are also required.

Note: For some instruments, Trayport may apply a "better price" algorithm and trade a different order.

Order Update - "The order does not exist" rejection

Sometimes order replace can fail with "The order does not exist" error.

Trayport explanation:

It is possible that the API's internal orderbook had not completed the synchronization of the previous order ID change.
Waiting a greater amount of time between sending the next update should have allowed the transmission of the request.

If you experience this error following a rapid update a suitable response would be to wait a short period,
say 50ms (as a pure example) and then attempt to resubmit the request.

Symbology

Trayport connector expects symbol as instrument attributes concatenated with #:
<InstID>#<SeqSpan>#<FirstSequenceID>#<FirstSequenceItemID>#<SecondSequenceItemID>

Term Labels

Terms can be passed via attribute 7000 with the following format: <Label>#<Default>#<Type>,<Label>#<Default>#<Type>

AttributeDescription
LabelA label for the term.
DefaultThe default value for this term.
TypeThe data type of the term. Allowed values: string, integer, double, dateTime, boolean

Supported order attributes

SettingsColumnCustom TagDescription
<attributeKey>Tag70007000Terms for Instrument Identifiers. See Term Labels section above.
account<attributeKey>Tag70017001Account Name. The name of the trading account associated with this order, if applicable.
mifid.decisionMaker<attributeKey>Tag70107010Decision Maker. Code used to identify the person or algorithm within the company who is responsible for the investment decision.
mifid.executionMaker<attributeKey>Tag70117011Execution Maker. Code used to identify the person or algorithm within the company who is responsible for the execution.
mifid.derivativeIndicator<attributeKey>Tag70127012Derivative Indicator. Specify true if the transaction reduces risk in an objectively measurable way.
mifid.DEA<attributeKey>Tag70137013DEA. Specify true if the order is being submitted to the trading venue using Direct Electronic Access (DEA)
<attributeKey>Tag70147014DEA Client ID. If DEA is used, the code of the DEA user must be specified in this field.
mifid.liquidityProvision<attributeKey>Tag70157015Liquidity Provision. Specify true if the order is submitted to a trading venue as part of a market making strategy.
mifid.tradingCapacity<attributeKey>Tag70167016Trading Capacity. Specifies whether the order results from the counterparty carrying out matched principal trading
status<attributeKey>Tag70207020Status. The type of order.
companyId<attributeKey>Tag70217021Company ID. Numeric. The ID of the company. Must be a valid company ID.
brokerId<attributeKey>Tag70227022Broker ID. Numeric. The ID of the broker to which you are submitting this order. Must be a valid broker ID.
allOrNone<attributeKey>Tag70237023The all or none status of the order. Set to true to submit the order on an all or none basis.
<attributeKey>Tag71237123JDMemo. Value that will reflect back to sender in trades and orders. Only for TradeOrder.
skipPrice<attributeKey>Tag71247124Specify true to skip price. Only for TradeOrder.

Trayport gRPC Server Windows Environment

In resources folder we provide script to automatically download and install Trayport gRPC Server. This script also generates bat files to launch this server as standalone application or Windows Service. Default listening ports are 5100 for Order environment and 5200 for Data environment.

Installation guide

From resources folder copy 'grpcserverenv' folder where you want to install Trayport gRPC Server.

You can also download it from this link: grpcserverenv

Launch Power Shell and move to the 'grpcserverenv' folder. Execute next command to start installation process:

.\install-grpc-server.ps1

Scripts description

After installation directory you can find several scripts to launch Trayport gRPC server:

  • start-grpcserver-order.bat - Start standalone Trayport gRPC Server for Order environment.
  • start-grpcserver-data.bat - Start standalone Trayport gRPC Server for Data environment.
  • start-grpcserver-all.bat - Start 2 standalone Trayport gRPC Server for both Order and Data environments.

Additionally inside installation directory in service folder you can find several scripts to launch Trayport gRPC server as service:

  • install-service-order.bat - install Trayport gRPC Server for Order environment as service
  • start-service-order.bat - start Trayport gRPC Server for Order environment service
  • stop-service-order.bat - stop Trayport gRPC Server for Order environment service
  • uninstall-service-order.bat - uninstall Trayport gRPC Server for Order environment service
  • install-service-data.bat - install Trayport gRPC Server for Data environment as service
  • start-service-data.bat - start Trayport gRPC Server for Data environment service
  • stop-service-data.bat - stop Trayport gRPC Server for Data environment service
  • uninstall-service-data.bat - uninstall Trayport gRPC Server for Data environment service

Trayport gRPC Server Diagnostic logging

In addition it is possible to turn on the Joule Direct dotnet API logging legacy mechanism, by default this is set to use a null logger. Changing to other logger types is not a recommended option but can be useful for detailed diagnostic work. It can be added in appsettings.json.

"JouleDirectApiLogging": {
"LoggerType": "Null", //OR "Event", "Diagnostic", "EventSourceDiagnostic"
"LogFolder": "",
"LogLevel": "Info" //OR "Debug", "Info", "Warn", "Alert", "Error", "Fatal"
}

Possible values for LoggerType:

LoggerType ValueDescription
EventLogs only events to the log file.
DiagnosticLogs events and diagnostics to the log file.
EventSourceDiagnosticUses a dotnet EventSource for more lightweight diagnostic logging instead of writing to a file on disk. The event source name is trayport-jdapi.

Trayport Order synchronization

Order synchronization is not supported. All active orders are discarded on reconnect. Sessions are created with cancel-on-disconnect enabled by default.

Configuration

Connector settings

ParameterDefault ValueDescription
➡️ gRPC Settings
grpc.hostlocalhostgRPC Server Host.
grpc.port5100gRPC Server Port.
grpc.keepAliveInterval10sThe interval between PING frames.
grpc.keepAliveTimeout15sThe timeout for a PING frame to be acknowledged. If sender does not receive an acknowledgment within this time, it will close the connection.
grpc.keepAliveWithoutCallsfalseIs it permissible to send keepalive pings from the client without any outstanding streams.
➡️ Trayport Session Settings
hostjouledirectJoule Direct Host alias.
port443Joule Direct Port.
usernameJoule Direct Username
passwordJoule Direct Password
brokerIdThe ID of the broker to which you are submitting this order. This is an integer and must be a valid broker ID.
companyIdThe ID of the company. This is an integer and must be a valid company ID.
accountThe name of the trading account associated with this order, if applicable.
routeIdThe ID of the route. This is an integer and must be a valid route ID.
statusFIRMThe type of order. Valid values: WITHHELD, FIRM, REFERENCE, INDICATIVE, TYPE_RFQ, INTERNAL.
allOrNonefalseThe all or none status of the order. To submit the order on an all or none basis, set this settings to true
skipPricefalseSet to true to skip price. Only for TradeOrder action.
sendMarketAsDayfalseSet to true to send market order as Good For Day limit order with price 0.
reconnectInterval10sReconnection interval. The first time after connection lost connector tries to reconnect immediately.
heartbeatInterval15sThe interval between client heartbeats.
heartbeatTimeout0The heartbeat timeout. Zero means heartbeatInterval * 2.5.
CAfileThe root certificates to verify the server's identity instead of the system's default. Generally they should be PEM-encoded.
➡️ Broker Mapping Settings
brokerMapping[].brokerIdBroker ID. Required.
brokerMapping[].accountAccount. Optional.
brokerMapping[].terms[].labelTerm label. Required.
brokerMapping[].terms[].descTerm description. Optional.
brokerMapping[].terms[].defValueTerm default value. Optional.
brokerMapping[].terms[].dataTypeSTRINGTerm data type. Optional. Allowed values: STRING, INTEGER, DOUBLE, DATE_TIME, BOOLEAN, DATE_LIST, DOUBLE_LIST
➡️ Sync Settings
syncSettings.discardIfRemovetrueTurn on to skip synchronization and discard orders if connection.disconnectAction = REMOVE.
➡️ MiFID Settings
mifid.decisionMakerCode used to identify the person or algorithm within the company who is responsible for the investment decision, under the MiFID II regulation. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 22 Annex I (Table 2, Field 57).
mifid.executionMakerCode used to identify the person or algorithm within the company who is responsible for the execution under the MiFID II regulation. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 22 Annex I (Table 2, Field 59)
mifid.DEAtrueThis field returns true if the order was submitted to the trading venue using Direct Electronic Access (DEA) as defined in the MiFID II regulation. Otherwise it returns false. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 24 Annex I (Table 2, Field 2).
mifid.liquidityProvisionfalseThis field returns true if the order is submitted to a trading venue as part of a market making strategy, as defined in the MiFID II regulation. Otherwise it returns false. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 24 Annex I (Table 2, Field 8).
mifid.derivativeIndicatorfalseThis field returns true if the transaction reduces risk in an objectively measurable way in accordance with the MiFID II regulation. Otherwise it returns false. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 22 Annex I (Table 2, Field 64).
mifid.tradingCapacityShows whether the order results from the counterparty carrying out matched principal trading under the MiFID II regulation. A full description of this field can be found in the MiFID Regulatory Technical Standards (RTS) 22 Annex I (Table 2, Field 29). Valid values: DEAL, MTCH, AOTC.
➡️ Connection Options
connection.disconnectActionREMOVESpecifies what the server should do if the API loses its connection to the server. valid values: REMOVE, WITHHOLD, NOTHING.
connection.disconnectUpstreamWithoutDelaytrueSpecifies if you want to bypass the standard 30 second grace period when a disconnection between the JD API and the Aggregation Server is detected. Set to true to trigger the disconnect actions immediately.
connection.enableTradeUpdateOnMetadatatrueSpecifies if you want to receive a trade update containing only metadata changes. This option defaults should be on if MLEG instruments are used. Trade updates are still received if non-metadata changes are updated on the trade, irrespective of the setting.
connection.enableAltMetadataLegCopyfalseSpecifies if you want to use the alternative mechanism for copying metadata on broken spread leg trades.
connection.enableMetadataForIdentifyfalseMetadata includes features such as local attributes and Automated Trading.
connection.calculatedPrices.enabledfalseToggle calculated prices - true or false.
connection.calculatedPrices.maximumDepth4Maximum Depth.
connection.calculatedPrices.enableNonConsecutiveSpreadstrueToggle non-consecutive spreads - true or false.

Config sample

connectors {
TRAYPORT : ${template.connector.trayport} {
settings {
grpc {
host = "localhost"
port = 5100
}

host = "jouledirecttest" # UAT
port = 443

username = "<USERNAME>"
password = "<PASSWORD>"

brokerId = <BROKER_ID>
routeId = <ROUTE_ID>
companyId = <COMPANY_ID>
account = "<ACCOUNT>"

# broker to account/terms mapping
# this mapping will override default values
brokerMapping = [
{
brokerId = 100

account = "<BROKER_ACCOUNT>"
terms = [{label = "Execution"}, {label = "Customer"}]
},
{
brokerId = 200

terms = [{label = "Open/Close"}]
}
]
}
}
}

GUI

Joule.application

Trayport gRPC Server

https://www.trayport.com/downloads/JouleDirect/API/gRPCServer.zip