Skip to content

question for hootnot 2 #200

Closed Answered by hootnot
traveller1011 asked this question in Q&A
Feb 1, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

personally I use PositionClose and close a pos. completely regardless how many trades it took to build the pos.

regarding your JSON response above: if a trade has the state OPEN that also says that it can be closed.

Using TradeClose() with the trade id, you should be able to close a specific trade.

There is also: positions.PositionDetails(accountID=accountID, instrument)
https://oanda-api-v20.readthedocs.io/en/latest/endpoints/positions/positiondetails.html

it gives the tradeids involved regarding a position. In this example 1. But in your case you should see 144, 146, 148

{
  "position": {
    "short": {
      "unrealizedPL": "-0.0738",
      "tradeIDs": [
        "2323"                 …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@traveller1011
Comment options

@hootnot
Comment options

@traveller1011
Comment options

Answer selected by traveller1011
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #199 on February 01, 2023 12:18.