Bare Protocol

Since 1.52.0.0, YD Trading System has supported the bare-protocol interface which allows investors to send trading orders using self-assembled UDP packets.

Prerequisite #

To use the bare-protocol interface, you need to obtain your futures company's permission. Only after the administrator of your futures company turns on the bare-protocol interface feature in YD Trading System, you can use bare-protocol.

Due to bare-protocol orders can only be sent through UDP, you need to confirm the ydServer's UDP port with your futures company. ydServer's default ports are listed below; however, they might be changed.

ExchangeTCP PortUDP Port
CFFEX5000050002
SHFE & INE5100051002
DCE5200052002
CZCE5300053002

Order Datagram Structure #

OffsetsLength(Byte)Field TypeAnnotation
016IntegerHeader. After the successful login, you can obtain the header by method getClientPacketHeader(YD_CLIENT_PACKET_INSERT_ORDER) of ydApi. The header won't be changed during the ydServer's running time and need to be obtained again after the ydServer has been restarted.
164Integer(little-endian)Instrument Reference ID. Returned by InstrumentRef of YDInstrument.
201IntegerDirection(0:Buy, 1:Sell)
211IntegerOffsetFlag(0:Open, 1:Close, 3:CloseToday, 4:CloseYesterday)
221IntegerHedgeFlag(1:Speculation, 2:Arbitrage, 3:Hedge)
231IntegerConnectionSelection(0:Any, 1:Fixed, 2:Prefered)
248IEEE 754 Double(little-endian)Price
324Integer(little-endian)OrderVolume
364Integer(little-endian)OrderRef
401IntegerOrderType(0:Limit, 1:FAK, 2:Market, 3:FOK)
411IntegerSet to 0.
421IntegerConnection ID
435IntegerAlways set to 0

Cancel Order Datagram Structure #

OffsetsLength(Byte)Field TypeAnnotation
016IntegerHeader. After the successful login, you can obtain the header by method getClientPacketHeader(YD_CLIENT_PACKET_CANCEL_ORDER) of ydApi. The header won't be changed during the ydServer's running time and need to be obtained again after the ydServer has been restarted.
164Integer(little-endian)OrderSysID of the order to be cancelled.
201IntegerExchange Reference ID. Returned by ExchangeRef of YDExchange.
211IntegerConnectionSelection(0:Any, 1:Fixed, 2:Prefered)
221IntegerConnectionID
231IntegerAlways set to 0

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注