Jump to content

BUG - API ClosePositionRequest returns OK/200 but does nothing (on demo)


Recommended Posts

Hi, 
I have been integrating your API and I want to close a position (using your example client). For that list the currently open positions [1] and based on received data create a CloseOTCPositionV1Request [2]. After sending the above mentioned request [2], I receive HttpStatus OK/200 along with a CloseOTCPositionV1Response containing a dealReference [3].. Therefore I would expect this position to be closed, but I can repeate this multiple times!!! Also I can see the open position in the UI.

From my perspective this is a bug..

Thanks for clarification

Jaroslav

 

[1] PositionsItem{position=Position{contractSize=10000.0, createdDate='2022/03/07 08:09:11:000', createdDateUTC='2022-03-07T08:09:11', dealId='DIAAAAHUBFF4UAN', size=1.0, direction=BUY, limitLevel=null, level=151.958, currency='JPY', controlledRisk=false, stopLevel=null, trailingStep=null, trailingStopDistance=null}, market=Market{instrumentName='GBP/JPY Mini', epic='CS.D.GBPJPY.MINI.IP', marketStatus=TRADEABLE}}

[2] CloseOTCPositionV1Request{dealId='DIAAAAHUBFF4UAN', epic='null', expiry='null', direction=BUY, size=1.0, level=null, orderType=MARKET, timeInForce=null, quoteId='null'}

[3] RefID = 2EQC69M1FXHPRD0N1

 

INFO  [2022 03 08 - 18:36:40,524] [ForexApp] [main]: IgRestApi Client: re-connecting as sa_demo_forex2
INFO  [2022 03 08 - 18:36:40,833] [ForexApp] [main]: Listing positions..
INFO  [2022 03 08 - 18:36:40,834] [ForexApp] [main]: PositionsItem{position=Position{contractSize=10000.0, createdDate='2022/03/07 08:09:11:000', createdDateUTC='2022-03-07T08:09:11', dealId='DIAAAAHUBFF4UAN', size=2.0, direction=BUY, limitLevel=null, level=151.958, currency='JPY', controlledRisk=false, stopLevel=null, trailingStep=null, trailingStopDistance=null}, market=Market{instrumentName='GBP/JPY Mini', epic='CS.D.GBPJPY.MINI.IP', marketStatus=TRADEABLE}}
TRACE [2022 03 08 - 18:36:40,834] [ForexApp] [main]: Executing close position request for deal = DIAAAAHUBFF4UAN
DEBUG [2022 03 08 - 18:36:40,839] [ForexApp] [main]: json body: {"dealId":"DIAAAAHUBFF4UAN","epic":null,"expiry":null,"direction":"BUY","size":2.0,"level":null,"orderType":"MARKET","timeInForce":null,"quoteId":null}
DEBUG [2022 03 08 - 18:36:40,840] [ForexApp] [main]: conversation context was provided
TRACE [2022 03 08 - 18:36:41,041] [ForexApp] [main]: Executing close position request for deal = DIAAAAHUBFF4UAN ... OK - RefID = 2EQC69M1FXHPRD0N1
Link to comment

 I hope this helps someone - my problem was, that the Direction needs to be oposite from what it is in the Position.. So if Position is in the SELL direction, the ClosePosition needs to be in the BUY Direction.. 
From my perspective, this is a redundant variable which should not be mandatory - If I want to close position, i want the oposite of the open position implicitly..

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      22,098
    • Total Posts
      92,955
    • Total Members
      42,476
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    calwall77
    Joined 01/06/23 20:51
  • Posts

    • Look ahead to 2/6/23: US jobs; Baker Hughes rig count After the stronger than expected private payrolls number from ADP, risks would seem to be on the upside for the US non-farm jobs number on Friday.  Jeremy Naylor | Analyst, London | Publication date: Thursday 01 June 2023  IGTV’s Jeremy Naylor looks at USD/JPY as a potential trade. Outside of this watch Brent around the Baker Hughes rig count.            
    • What's the next move following the bank run that led to a rally in US stocks? The markets have been giving us hints on its coming trend, which markets are they? Deploying market psychology not only helps us to connect the dots in today’s complexity, it also gives us the simplicity to chart into the future. In this session, we have invited market veteran, Wong Kon How, to help you improve your trading literacy and successfully navigate the financial markets. Kon How will demonstrate how he understands today’s market complexity and seizes the coming opportunity with behavioral science.  
    • Charting the Markets: 1 June Dow and CAC40 stabilise while Nasdaq 100 edges down. EUR/USD, EUR/GBP and USD/CAD stabilise as US debt ceiling bill goes to Senate. And Brent, orange juice stabilise while copper advances as US debt ceiling bill gets signed. Shaun Murison | Senior Market Analyst, Johannesburg | Publication date: Thursday 01 June 2023               This is here for you to catch up but if you have any ideas on markets or events you want us to relay to the TV team we’re more than happy to.
×
×
  • Create New...