FIX API Sample Engine Crashes
FIX API Sample Engine Crashes
19 Nov 2018, 14:48
I am trying to use FIX API Sample Engine to use to implement my Robot for trading with FIX server. To understand how it works I am running it in MS Visual Studio and sending FIX messages by using button on GUI. I have several questions on this.
Here is what I do to place Stop Order using Quote Prices:
1) Press "Logon" under Price stream. I get following messages:
sent message -- 8=FIX.4.49=12835=A49=circlemarkets.400002256=cServer57=QUOTE50=TRADE34=152=20181119-12:20:4698=0108=30141=Y553=4000022554=qwerty1210=200
Receved message --
8=FIX.4.49=10735=A34=149=cServer50=QUOTE52=20181119-12:20:49.46456=circlemarkets.400002257=TRADE98=0108=30141=Y10=118
Looks like valid messages.
2) Press "Spot Market Data Request" I get following messages:
Sent -- 8=FIX.4.49=15035=V49=circlemarkets.400002256=cServer57=QUOTE50=TRADE34=252=20181119-12:22:47262=EURUSD:WDqsoT263=1264=1265=1267=2269=0269=1146=155=110=214
Received -- 8=FIX.4.49=8935=034=249=cServer50=QUOTE52=20181119-12:21:20.01256=circlemarkets.400002257=TRADE10=228
Not sure why there is 35=0 in response to 35=V???
3)I press "Logon" button under "Trade Stream" and I get following messages:
Sent -- 8=FIX.4.49=12235=A49=circlemarkets.400002256=cServer57=TRADE50=TRADE34=352=20181119-12:24:5298=0108=30553=4000022554=qwerty1210=122
Received -- 8=FIX.4.49=10135=A34=149=cServer50=TRADE52=20181119-12:24:54.71556=circlemarkets.400002257=TRADE98=0108=3010=036
Looks like valid messages
4) I press "New Stop Order Single" button and the response is as follows:
Sent -- 8=FIX.4.49=14835=D49=circlemarkets.400002256=cServer57=TRADE50=TRADE34=452=20181119-12:26:3811=1055=154=160=20181119-12:26:3838=100040=399=1.1559=310=172
Received -- 8=FIX.4.49=8935=034=249=cServer50=TRADE52=20181119-12:25:25.06256=circlemarkets.400002257=TRADE10=212
I sent 35=D (new single Order message and in response I received 35=0 Heart beat message. Why is this? I was expecting 35=8 that is execution report. Not sure why. Could you please explain?
5)Next I once again send by pressing "New Stop Order Single" and MS Visual Studio crashed with following detailed messages:
---message starts-------------
System.IO.IOException
HResult=0x80131620
Message=Unable to write data to the transport connection: An established connection was aborted by the software in your host machine.
Source=System
StackTrace:
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at FIX_API_Sample.frmFIXAPISample.SendMessage(String message, SslStream stream, Boolean readResponse) in C:\Users\net_r\Downloads\latestDownLoads\FIX-API-Sample-master1\FIX-API-Sample-master\FIX API Sample.cs:line 102
at FIX_API_Sample.frmFIXAPISample.SendTradeMessage(String message, Boolean readResponse) in C:\Users\net_r\Downloads\latestDownLoads\FIX-API-Sample-master1\FIX-API-Sample-master\FIX API Sample.cs:line 95
at FIX_API_Sample.frmFIXAPISample.btnStopOrder_Click(Object sender, EventArgs e) in C:\Users\net_r\Downloads\latestDownLoads\FIX-API-Sample-master1\FIX-API-Sample-master\FIX API Sample.cs:line 272
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at FIX_API_Sample.Program.Main() in C:\Users\net_r\Downloads\latestDownLoads\FIX-API-Sample-master1\FIX-API-Sample-master\Program.cs:line 20
Inner Exception 1:
SocketException: An established connection was aborted by the software in your host machine
---End messages--------------
I see this crash quite often and not sure how to fix this. I am using your FIX API Sample code without any modification.
Is it wrong to press two consecutive "New Stop Order Singles" buttons?
For every Order placed using "New Stop Order Single" button I should look for receiving 35=8 message to decode and figure out the status of Stop order placed. However, this 35=8 message I receive very randomly, sometime I get 35=2 that ResendMessage and I Press "Resend Request" Button and after pressing this button few more times I get 35=8 message similarly I press sometime "Order Status Request" button and I receive 35=8 messate after a while.
Could you please help me in giving more insight on this so that I can build my cTrader based FIX engine using your sample code. By the way you are providing great service by giving this Sample code to jump start FIX engine development process.
I comlpeted coding of my Robot built around this sample code but decoding received FIX messages is a BIG issue.
Please give me insight into this code that will help me greatly in developing my FIX Engine based Robot.
Thanks
PanagiotisCharalampous
19 Nov 2018, 15:02
Hi netread2004,
The FIX sample is just for demonstrating how to send and receive FIX messages. If you want to create a proper FIX engine there is a lot you need to do. Connections are usually dropped when heartbeats are not send on frequent intervals e.g. every 10 seconds. So try sending heartbeats and let me know if it resolves the problem.
Best Regards,
Panagiotis
@PanagiotisCharalampous