Topics
Replies
wiktor.kisielewski
29 Jan 2024, 08:25
RE: Request for Positions - not returning data for all open positions
ctid1980098 said:
Hi,
I don't see any code for how you may be reading from the server but are you sure you are reading all the responses from the server? Like reading in a loop or something? It could be that maybe you are just reading only the first message only? On my end I am able to receive all open positions back from server. tested on my app for up to 8 positions.
Hm, Im using socket connection (python - combined with simplefix library)
The code for sending and receiving is:
```
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((auth.SocketConnectHost, auth.T_SocketConnectPort))
parser = FixParser()
def request_for_positions():
message = FixMessage()
message.append_pair(8, "FIX.4.4")
message.append_pair(35, "AN")
message.append_pair(34, n)
message.append_pair(49, auth.SenderCompID)
message.append_utc_timestamp(52)
message.append_pair(56, auth.TargetCompID)
message.append_pair(57, "TRADE")
message.append_pair(50, "any_string")
message.append_pair(710, str(n))
message.remove(721)
parser.append_buffer(message.encode())
sent = parser.get_message()
s.send(message.encode())
response = s.recv(2048)
parser.append_buffer(response)
out = parser.get_message()
```
@wiktor.kisielewski
wiktor.kisielewski
24 Jan 2024, 07:49
( Updated at: 24 Jan 2024, 12:41 )
RE: RE: RE: RE: RE: RE: Request for Positions - not returning data for all open positions
wiktor.kisielewski said:
wiktor.kisielewski said:
PanagiotisCharalampous said:
wiktor.kisielewski said:
wiktor.kisielewski said:
PanagiotisCharalampous said:
Hi there,
Please share with us the following
- Complete requests and responses sent and received, accompanied with timestamps
- Screenshots from cTrader demonstrating that there are more positions open than the ones returned.
Best regards,
Panagiotis
│ POSITION REQUEST: 8=FIX.4.4|9=102|35=AN|34=2|49=demo.icmarkets.8857612|52=20240122-07:11:05.424|56=CSERVER|57=TRADE|50=any_string|710=2|10=170 │ REQUEST RESPONSE: 8=FIX.4.4|9=155|35=AP|34=2|49=CSERVER|50=TRADE|52=20240122-07:11:05.441|56=demo.icmarkets.8857612|55=1006|710=2|721=403537453|727=18|728=0|730=1.4606|702=1|704=0|705=1000|10=237
Thank you, can you also advise the host you are using for your FIX API connection?
sure, it is “h51.p.ctrader.com”
I've now also switched to a different (syggested in web ctrader) → “demo1.p.ctrader.com” . There is no difference
@PanagiotisCharalampous Should I expect some update here?
@wiktor.kisielewski
wiktor.kisielewski
22 Jan 2024, 12:43
RE: RE: RE: RE: RE: Request for Positions - not returning data for all open positions
wiktor.kisielewski said:
PanagiotisCharalampous said:
wiktor.kisielewski said:
wiktor.kisielewski said:
PanagiotisCharalampous said:
Hi there,
Please share with us the following
- Complete requests and responses sent and received, accompanied with timestamps
- Screenshots from cTrader demonstrating that there are more positions open than the ones returned.
Best regards,
Panagiotis
│ POSITION REQUEST: 8=FIX.4.4|9=102|35=AN|34=2|49=demo.icmarkets.8857612|52=20240122-07:11:05.424|56=CSERVER|57=TRADE|50=any_string|710=2|10=170 │ REQUEST RESPONSE: 8=FIX.4.4|9=155|35=AP|34=2|49=CSERVER|50=TRADE|52=20240122-07:11:05.441|56=demo.icmarkets.8857612|55=1006|710=2|721=403537453|727=18|728=0|730=1.4606|702=1|704=0|705=1000|10=237
Thank you, can you also advise the host you are using for your FIX API connection?
sure, it is “h51.p.ctrader.com”
I've now also switched to a different (syggested in web ctrader) → “demo1.p.ctrader.com” . There is no difference
@wiktor.kisielewski
wiktor.kisielewski
22 Jan 2024, 12:25
RE: RE: RE: RE: Request for Positions - not returning data for all open positions
PanagiotisCharalampous said:
wiktor.kisielewski said:
wiktor.kisielewski said:
PanagiotisCharalampous said:
Hi there,
Please share with us the following
- Complete requests and responses sent and received, accompanied with timestamps
- Screenshots from cTrader demonstrating that there are more positions open than the ones returned.
Best regards,
Panagiotis
│ POSITION REQUEST: 8=FIX.4.4|9=102|35=AN|34=2|49=demo.icmarkets.8857612|52=20240122-07:11:05.424|56=CSERVER|57=TRADE|50=any_string|710=2|10=170 │ REQUEST RESPONSE: 8=FIX.4.4|9=155|35=AP|34=2|49=CSERVER|50=TRADE|52=20240122-07:11:05.441|56=demo.icmarkets.8857612|55=1006|710=2|721=403537453|727=18|728=0|730=1.4606|702=1|704=0|705=1000|10=237
Thank you, can you also advise the host you are using for your FIX API connection?
sure, it is “h51.p.ctrader.com”
@wiktor.kisielewski
wiktor.kisielewski
22 Jan 2024, 07:13
RE: RE: Request for Positions - not returning data for all open positions
wiktor.kisielewski said:
PanagiotisCharalampous said:
Hi there,
Please share with us the following
- Complete requests and responses sent and received, accompanied with timestamps
- Screenshots from cTrader demonstrating that there are more positions open than the ones returned.
Best regards,
Panagiotis
│ POSITION REQUEST: 8=FIX.4.4|9=102|35=AN|34=2|49=demo.icmarkets.8857612|52=20240122-07:11:05.424|56=CSERVER|57=TRADE|50=any_string|710=2|10=170 │ REQUEST RESPONSE: 8=FIX.4.4|9=155|35=AP|34=2|49=CSERVER|50=TRADE|52=20240122-07:11:05.441|56=demo.icmarkets.8857612|55=1006|710=2|721=403537453|727=18|728=0|730=1.4606|702=1|704=0|705=1000|10=237
@wiktor.kisielewski
wiktor.kisielewski
22 Jan 2024, 07:13
RE: Request for Positions - not returning data for all open positions
PanagiotisCharalampous said:
Hi there,
Please share with us the following
- Complete requests and responses sent and received, accompanied with timestamps
- Screenshots from cTrader demonstrating that there are more positions open than the ones returned.
Best regards,
Panagiotis
│ POSITION REQUEST: 8=FIX.4.4|9=102|35=AN|34=2|49=demo.icmarkets.8857612|52=20240122-07:11:05.424|56=CSERVER|57=TRADE|50=any_string|710=2|10=170
│ REQUEST RESPONSE: 8=FIX.4.4|9=155|35=AP|34=2|49=CSERVER|50=TRADE|52=20240122-07:11:05.441|56=demo.icmarkets.8857612|55=1006|710=2|721=403537453|727=18|728=0|730=1.4606|702=1|704=0|705=1000|10=237
@wiktor.kisielewski
wiktor.kisielewski
04 Dec 2020, 20:16
( Updated at: 04 Dec 2020, 20:17 )
Hey,
I suggest using this to create messages:
this is my logon sample:
from simplefix import FixMessage, FixParser
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((auth.SocketConnectHost, auth.Q_SocketConnectPort)) parser = FixParser()
message = FixMessage() message.append_pair(8, "FIX.4.4") message.append_pair(35, "A") message.append_pair(34, #SEQ_NUMBER_HERE) message.append_pair(49, auth.SenderCompID) message.append_utc_timestamp(52) message.append_pair(56, auth.TargetCompID) message.append_pair(57, 'QUOTE') message.append_pair(98, "0") message.append_pair(141, "Y") message.append_pair(108, "30") message.append_pair(553, auth.Username) message.append_pair(554, auth.Password) parser.append_buffer(message.encode()) sent = parser.get_message() #print("logon request ", sent) s.sendall(message.encode()) response = s.recv(5201)
parser.append_buffer(response) out = parser.get_message() #print("logon response2", out) Uncomment the print statements to see what's coming out an in Best of luck, python rules!
@wiktor.kisielewski
wiktor.kisielewski
01 Oct 2019, 12:46
Try sending tags in diffrent order, like this:
8=FIX.4.4|9=100|35=AN|49=theBroker.12345|56=CSERVER|34=99|52=20170117- 10:09:54|50=any_string|57=TRADE|710=876316401|10=103|
This is a sample message from documentation and it is working for me.
@wiktor.kisielewski
wiktor.kisielewski
24 Sep 2019, 09:26
RE:
Update:
It works now, heartbeats solved the problem.
Thanks again!
@wiktor.kisielewski
wiktor.kisielewski
24 Sep 2019, 08:49
RE:
Panagiotis Charalampous said:
Hi Wiktor,
Do you send heartbeats to keep the connection alive?
Best Regards,
Panagiotis
Hi,
No i do not send them, thought heartbeats are only needed in TRADE connection and unnecessary in QUOTE.
I will add them and let you know if it helped.
Thanks for the answer, btw it seems like we are the only ones posting in this FIX subforum. I appreciate your help a lot!
Wiktor
@wiktor.kisielewski
wiktor.kisielewski
21 Sep 2019, 07:10
RE:
Panagiotis Charalampous said:
Hi Wiktor,
I do not see any problem in your message. I have forwarded this to the product team for further investigation.
Best Regards,
Panagiotis
Hi Panagiotis,
Thanks for that, if you need any more details please let me know. I hope this will be fixed.
Wiktor
@wiktor.kisielewski
wiktor.kisielewski
18 Sep 2019, 19:14
RE:
Panagiotis Charalampous said:
Hi wiktor,
Can you add tag 50 as well and let me know if it works?
Best Regards,
Panagiotis
Hello Panagiotis,
I've added tag 50 and it is working well now, thanks for help!
@wiktor.kisielewski
wiktor.kisielewski
16 Sep 2019, 11:05
Hi,
Thanks for a reply. Turns out it was just a problem with my account equity (not enought funds simply).
It is working now!
@wiktor.kisielewski
wiktor.kisielewski
29 Jan 2024, 08:45
RE: RE: RE: Request for Positions - not returning data for all open positions
ctid1980098 said:
could you share some code snippets of your code? That would be very usefull
@wiktor.kisielewski