Imported from previous forum
Hello,
Could you help me?
- What mesage should I use to close a position?
- How to set take profit and stop loss to an existed or a new order?
- Where to get all the orders which are filled into a position?
- What kind of ID should I record for later closing position/ update , ExecID, OrderID, ClOrdID?
Thank you in advance.
Regards,
Yan
Yan,
this is a whole basket of questions. I have moved the thread to FIX Semantics as it is not about encoding or session issues. I will try to answer your questions but some of them depend on the breadth of functionality offered by your counterparty. A provider of a FIX interface will only offer a subset of all messages, fields and valid values. These are called “Rules of Engagement” and describe the capabilities of the application level of a specific interface.
- What mesage should I use to close a position?
You can enter an order (NewOrderSingle) or trade (TradeCaptureReport) with PositionEffect(77) = C (Close).
- How to set take profit and stop loss to an existed or a new order?
You can set OrdType(40) = 3 (Stop Loss) to sell at market price as soon as a trade occurs at StopPx(99). There is now also a new value OrdType(40) = R to trigger the stop on bid or offer (see EP166 for details).
- Where to get all the orders which are filled into a position?
Orders are just the means to obtain trades which are then aggregated into positions. OrderMassStatusRequest(MsgType=AF) allows you to ask for the status of all orders for a set of filter criteria, e.g. an instrument and/or an account. You then see which orders have actually traded. You can ask for position information with RequestForPositions(MsgType=AN) and receive multiple PositionReport(MsgType=AP)messages as an answer. These messages have a fairly new component called RelatedTradeGrp which allow to list all trades (not orders) that have added to the position. You can use the trade identifiers in a TradeCaptureReportRequest(MsgType=AD) to get order level information for each trade. This information is part of the component TradeReportOrderDetail and includes order identifiers such as OrderID(37) which allows you to link the trades back to orders.
- What kind of ID should I record for later closing position/ update , ExecID, OrderID, ClOrdID?
Not sure where your question is going. Positions have none of these IDs, they are only relevant to link orders to trades. Maybe you have a different notion of what a position is. Your business requirements will determine what information you need to keep track of regarding a “position”.
Hello,
Could you help me?
- What mesage should I use to close a position?
- How to set take profit and stop loss to an existed or a new order?
- Where to get all the orders which are filled into a position?
- What kind of ID should I record for later closing position/ update , ExecID, OrderID, ClOrdID?
Thank you in advance.
Regards,
Yan
1 Like