Topics
Replies
wwweeeeee
30 Jan 2023, 23:40
( Updated at: 30 Jan 2023, 23:44 )
RE: PanagiotisChar, ctid1980098
Thank you both for a reply, seems like there are a lot I have to fix in my code.
1) How to respond to a heartbeat message every 30 seconds to keep session alive? I have to send some kind of FIX-message right? Can you show a fix message example please? I looked here but couldn't find (https://help.ctrader.com/fix/specs/cTraderFixApi_v2.18.1.pdf#logon-example)
2) To respond to a test request I have to send a fix message send that contains |112=Y|?
something similar to this?
b'8=FIX.4.4\x019=97\x0135=1\x0134=4\x0149=CSERVER\x0150=QUOTE\x0152=20230128-21:46:14.917\x0156=demo.roboforex.6183532\x0157=any\x01112=Y\x0110=119\x01'
Also note, I see you selected 4096 bytes to be received. What happens when you have read 4096 bytes. does your software have a loop to continiously read from socket or are you handling this async?
yes, a loop
@wwweeeeee
wwweeeeee
08 Jul 2022, 23:52
RE:
PanagiotisCharalampous said:
Hi there,
You need to read the specification. Field 55 is for the symbol. There is no timeframe field, since you are subscribing to spot prices and DoM, not to historical candles.
Best Regards,
Panagiotis
Alright, sorry for the many questions here. Now I have a problem with correct submitting fix messages (I can't find an easy python example).
I use a python and send logon message, then market data message and get every time the following error: "58=Tag appears more than once, field="
When I deleting all repeated messages, I receive another error: 58=Tag not defined for this message type, field=98.
How to fix that?
To send fix messages I use this construction:
s.sendall(logon(msg)) print(s.recv(4096)) s.sendall(market_data(msg)) print(s.recv(4096))
@wwweeeeee
wwweeeeee
05 Jul 2022, 17:26
RE:
PanagiotisCharalampous said:
Hi there,
1. MDReqID is set by you, you don't find it somewhere.
2. You need to send heartbeats every 10 seconds else you might get disconnected
Check our samples on GitHub, they will help you
https://github.com/spotware?q=fix&type=all&language=&sort=
Best Regards,
Panagiotis
okk, got about login and heartbeats. Thank you
But still not quite understand how to subscribe to, for example USD/EUR pair, 5 minute timeframe. Can someone show me an example of fix message I have to send? I've seen this as an example but I don't see a part, where I have to write to what trading pair and timeframe I want to subscribe to:
For spots
Request 8=FIX.4.4|9=131|35=V|49=live.theBroker.12345|56=CSERVER|34=3|52=20170117- 10:26:54|50=QUOTE|262=876316403|263=1|264=1|265=1|146=1|55=1|267=2|269=0|269=1|10=094|
)
@wwweeeeee
wwweeeeee
02 Feb 2023, 01:59
RE: RE: RE: PanagiotisChar, ctid1980098
It works!! thank you, it works with heartbeat now.
One more thing I want to ask. I have read in the documentation that if HeartBtInt is set to 0, no heartbeat message is required.
So maybe it's was the better idea? Just to set 108=0 and remove the heartbeat. How important is that heartbeat in general?
@wwweeeeee