Trayport gRPC Trade Connector
Features
custom-trayportConnector KeyNotes
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 to0)
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>
| Attribute | Description |
|---|---|
| Label | A label for the term. |
| Default | The default value for this term. |
| Type | The data type of the term. Allowed values: string, integer, double, dateTime, boolean |
Supported order attributes
| Settings | Column | Custom Tag | Description |
|---|---|---|---|
<attributeKey>Tag7000 | 7000 | Terms for Instrument Identifiers. See Term Labels section above. | |
account | <attributeKey>Tag7001 | 7001 | Account Name. The name of the trading account associated with this order, if applicable. |
mifid.decisionMaker | <attributeKey>Tag7010 | 7010 | Decision Maker. Code used to identify the person or algorithm within the company who is responsible for the investment decision. |
mifid.executionMaker | <attributeKey>Tag7011 | 7011 | Execution Maker. Code used to identify the person or algorithm within the company who is responsible for the execution. |
mifid.derivativeIndicator | <attributeKey>Tag7012 | 7012 | Derivative Indicator. Specify true if the transaction reduces risk in an objectively measurable way. |
mifid.DEA | <attributeKey>Tag7013 | 7013 | DEA. Specify true if the order is being submitted to the trading venue using Direct Electronic Access (DEA) |
<attributeKey>Tag7014 | 7014 | DEA Client ID. If DEA is used, the code of the DEA user must be specified in this field. | |
mifid.liquidityProvision | <attributeKey>Tag7015 | 7015 | Liquidity Provision. Specify true if the order is submitted to a trading venue as part of a market making strategy. |
mifid.tradingCapacity | <attributeKey>Tag7016 | 7016 | Trading Capacity. Specifies whether the order results from the counterparty carrying out matched principal trading |
status | <attributeKey>Tag7020 | 7020 | Status. The type of order. |
companyId | <attributeKey>Tag7021 | 7021 | Company ID. Numeric. The ID of the company. Must be a valid company ID. |
brokerId | <attributeKey>Tag7022 | 7022 | Broker ID. Numeric. The ID of the broker to which you are submitting this order. Must be a valid broker ID. |
allOrNone | <attributeKey>Tag7023 | 7023 | The all or none status of the order. Set to true to submit the order on an all or none basis. |
<attributeKey>Tag7123 | 7123 | JDMemo. Value that will reflect back to sender in trades and orders. Only for TradeOrder. | |
skipPrice | <attributeKey>Tag7124 | 7124 | Specify 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 servicestart-service-order.bat- start Trayport gRPC Server for Order environment servicestop-service-order.bat- stop Trayport gRPC Server for Order environment serviceuninstall-service-order.bat- uninstall Trayport gRPC Server for Order environment serviceinstall-service-data.bat- install Trayport gRPC Server for Data environment as servicestart-service-data.bat- start Trayport gRPC Server for Data environment servicestop-service-data.bat- stop Trayport gRPC Server for Data environment serviceuninstall-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 Value | Description |
|---|---|
| Event | Logs only events to the log file. |
| Diagnostic | Logs events and diagnostics to the log file. |
| EventSourceDiagnostic | Uses 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
| Parameter | Default Value | Description |
|---|---|---|
| ➡️ gRPC Settings | ||
grpc.host | localhost | gRPC Server Host. |
grpc.port | 5100 | gRPC Server Port. |
grpc.keepAliveInterval | 10s | The interval between PING frames. |
grpc.keepAliveTimeout | 15s | The timeout for a PING frame to be acknowledged. If sender does not receive an acknowledgment within this time, it will close the connection. |
grpc.keepAliveWithoutCalls | false | Is it permissible to send keepalive pings from the client without any outstanding streams. |
| ➡️ Trayport Session Settings | ||
host | jouledirect | Joule Direct Host alias. |
port | 443 | Joule Direct Port. |
username | Joule Direct Username | |
password | Joule Direct Password | |
brokerId | The ID of the broker to which you are submitting this order. This is an integer and must be a valid broker ID. | |
companyId | The ID of the company. This is an integer and must be a valid company ID. | |
account | The name of the trading account associated with this order, if applicable. | |
routeId | The ID of the route. This is an integer and must be a valid route ID. | |
status | FIRM | The type of order. Valid values: WITHHELD, FIRM, REFERENCE, INDICATIVE, TYPE_RFQ, INTERNAL. |
allOrNone | false | The all or none status of the order. To submit the order on an all or none basis, set this settings to true |
skipPrice | false | Set to true to skip price. Only for TradeOrder action. |
sendMarketAsDay | false | Set to true to send market order as Good For Day limit order with price 0. |
reconnectInterval | 10s | Reconnection interval. The first time after connection lost connector tries to reconnect immediately. |
heartbeatInterval | 15s | The interval between client heartbeats. |
heartbeatTimeout | 0 | The heartbeat timeout. Zero means heartbeatInterval * 2.5. |
CAfile | The root certificates to verify the server's identity instead of the system's default. Generally they should be PEM-encoded. | |
| ➡️ Broker Mapping Settings | ||
brokerMapping[].brokerId | Broker ID. Required. | |
brokerMapping[].account | Account. Optional. | |
brokerMapping[].terms[].label | Term label. Required. | |
brokerMapping[].terms[].desc | Term description. Optional. | |
brokerMapping[].terms[].defValue | Term default value. Optional. | |
brokerMapping[].terms[].dataType | STRING | Term data type. Optional. Allowed values: STRING, INTEGER, DOUBLE, DATE_TIME, BOOLEAN, DATE_LIST, DOUBLE_LIST |
| ➡️ Sync Settings | ||
syncSettings.discardIfRemove | true | Turn on to skip synchronization and discard orders if connection.disconnectAction = REMOVE. |
| ➡️ MiFID Settings | ||
mifid.decisionMaker | Code 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.executionMaker | Code 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.DEA | true | This 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.liquidityProvision | false | This 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.derivativeIndicator | false | This 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.tradingCapacity | Shows 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.disconnectAction | REMOVE | Specifies what the server should do if the API loses its connection to the server. valid values: REMOVE, WITHHOLD, NOTHING. |
connection.disconnectUpstreamWithoutDelay | true | Specifies 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.enableTradeUpdateOnMetadata | true | Specifies 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.enableAltMetadataLegCopy | false | Specifies if you want to use the alternative mechanism for copying metadata on broken spread leg trades. |
connection.enableMetadataForIdentify | false | Metadata includes features such as local attributes and Automated Trading. |
connection.calculatedPrices.enabled | false | Toggle calculated prices - true or false. |
connection.calculatedPrices.maximumDepth | 4 | Maximum Depth. |
connection.calculatedPrices.enableNonConsecutiveSpreads | true | Toggle 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
Trayport gRPC Server
https://www.trayport.com/downloads/JouleDirect/API/gRPCServer.zip