Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position array is not returned #37

Open
amolc opened this issue Aug 2, 2024 · 3 comments
Open

Position array is not returned #37

amolc opened this issue Aug 2, 2024 · 3 comments

Comments

@amolc
Copy link

amolc commented Aug 2, 2024

The position list is not returned, only 1 position is returned back.

DEBUG:root:SEND >>> 8=FIX.4.4|9=96|35=AN|49=pepperstone.3965339|50=TRADE|56=CSERVER|57=TRADE|34=3|52=20240802-17:06:08|710=3965339|10=098|
DEBUG:root:SEND >>> 8=FIX.4.4|9=102|35=AF|49=pepperstone.3965339|50=TRADE|56=CSERVER|57=TRADE|34=4|52=20240802-17:06:08|584=3965339|585=7|10=159|
DEBUG:root:SEND >>> 8=FIX.4.4|9=96|35=AN|49=pepperstone.3965339|50=TRADE|56=CSERVER|57=TRADE|34=5|52=20240802-17:06:08|710=3965339|10=100|
DEBUG:root:RECV <<< 8=FIX.4.4|9=166|35=AP|34=2|49=CSERVER|50=TRADE|52=20240802-17:06:08.972|56=pepperstone.3965339|57=TRADE|55=10004|710=3965339|721=133438135|727=12|728=0|730=16949.3|702=1|704=7|705=0|10=093|
8=FIX.4.4|9=140|35=V|49=pepperstone.3965339|50=QUOTE|56=CSERVER|57=QUOTE|34=4|52=20240802-17:06:08|262=3965339|263=1|264=1|267=2|269=0|269=1|146=1|55=10004|10=120|
DEBUG:root:SEND >>> 8=FIX.4.4|9=140|35=V|49=pepperstone.3965339|50=QUOTE|56=CSERVER|57=QUOTE|34=4|52=20240802-17:06:08|262=3965339|263=1|264=1|267=2|269=0|269=1|146=1|55=10004|10=120|
INFO:root:Market is Close or Logged out 'USDK50'
DEBUG:root:RECV <<< 8=FIX.4.4|9=138|35=W|34=3|49=CSERVER|50=QUOTE|52=20240802-17:06:09.165|56=pepperstone.3965339|57=QUOTE|55=10004|268=2|269=0|270=16885.3|269=1|270=16890.3|10=098|
Updated position list for client 3965339:
Position ID: 133438135, Details: {'pos_id': '133438135', 'name': 'HK50', 'long': 7.0, 'short': 0.0, 'price': 16949.3, 'digits': 1, 'clid': None, 'convert': 'USDK50', 'convert_dir': 1}

Copy link

github-actions bot commented Aug 2, 2024

We're glad you've opened your first issue. Please provide all the necessary details and any relevant code or screenshots to help us understand the problem better. Our team will review your issue and provide assistance as soon as possible. Thank you for contributing!

@amolc
Copy link
Author

amolc commented Aug 4, 2024

If we use the ctrader function -

def positions(self):
    return json.loads(json.dumps(self.client["positions"]))
    
  The position which is returned is just 1 assets whereas there are 7 positions open.
@traderpedroso
Copy link
Member

If we use the ctrader function -

def positions(self):
    return json.loads(json.dumps(self.client["positions"]))
    
  The position which is returned is just 1 assets whereas there are 7 positions open.

Sorry for the delay, but you need to loop through the positions the same way you do for closing.

for position in positions:
    api.positionCloseById(position['pos_id'], position['amount'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants