Spotware: No price feed for demo accounts?

Created at 20 Feb 2017, 11:37
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
HF

hf783z4ihsdhfui7r

Joined 20.02.2017

Spotware: No price feed for demo accounts?
20 Feb 2017, 11:37


Tested FIX on demo account (tested fxpro, pepperstone) but server always quits market data request with logout. Here a typical conversation:

>> 8=FIX.4.49=12135=A49=pepperstone.318567356=CSERVER57=QUOTE50=ANY34=152=20170220-09:35:0198=0108=0141=Y553=3185673554=sqR0de10=222

 

<< 8=FIX.4.49=10235=A34=149=CSERVER50=QUOTE52=20170220-09:35:00.05756=pepperstone.318567357=ANY98=0108=0141=Y10=079

 

 

>> 8=FIX.4.49=13435=V49=pepperstone.318567356=CSERVER57=QUOTE50=ANY34=252=20170220-09:35:04262=1263=1264=1265=1267=2146=155=1269=0269=110=204

 

<< 8=FIX.4.49=8535=534=249=CSERVER50=QUOTE52=20170220-09:35:02.43956=pepperstone.318567357=ANY10=017


@hf783z4ihsdhfui7r
Replies

hf783z4ihsdhfui7r
20 Feb 2017, 11:59

This is a very "low profile" forum software. For better readability:

out: 8=FIX.4.4 9=121 35=A 49=pepperstone.3185673 56=CSERVER 57=QUOTE 50=ANY 34=1 52=20170220-09:35:01 98=0 108=0 141=Y 553=3185673 554=sqR0de 10=222
in: 8=FIX.4.4 9=102 35=A 34=1 49=CSERVER 50=QUOTE 52=20170220-09:35:00.057 56=pepperstone.3185673 57=ANY 98=0 108=0 141=Y 10=079


out: 8=FIX.4.4 9=134 35=V 49=pepperstone.3185673 56=CSERVER 57=QUOTE 50=ANY 34=2 52=20170220-09:35:04 262=1 263=1 264=1 265=1 267=2 146=1 55=1 269=0 269=1 10=204
in: 8=FIX.4.4 9=85 35=5 34=2 49=CSERVER 50=QUOTE 52=20170220-09:35:02.439 56=pepperstone.3185673 57=ANY 10=017


@hf783z4ihsdhfui7r

#EOL
20 Feb 2017, 13:59

Hi there. 

Take a look on this log that works for me: https://goo.gl/oOrnpT

I think the problem with yours one is tag misordering.

I bet MDEntryType (tag 269) records shold be strictly after NoMDEntryTypes (tag 267)


@#EOL

#EOL
20 Feb 2017, 14:02

RE:

#EOL said:

Hi there. 

Take a look on this log that works for me: https://goo.gl/oOrnpT

I think the problem with yours one is tag misordering.

I bet MDEntryType (tag 269) records shold be strictly after NoMDEntryTypes (tag 267)

http://www.onixs.biz/fix-dictionary/4.4/msgType_V_86.html#Strucutre


@#EOL

hf783z4ihsdhfui7r
20 Feb 2017, 15:51

RE:

#EOL said:

I think the problem with yours one is tag misordering.

Yes, that was it! Thank you very much! I know not why I have put the fields in that particular order, oh my.. :D

 

 


@hf783z4ihsdhfui7r

taskman9
27 Mar 2017, 02:54

RE:

#EOL said:

Hi there. 

Take a look on this log that works for me: https://goo.gl/oOrnpT

I think the problem with yours one is tag misordering.

I bet MDEntryType (tag 269) records shold be strictly after NoMDEntryTypes (tag 267)

Hi EOL, I follwed your example but I'm not getting any quote reply. And CSERVER sending me HEARTBEAT & TESTID.
Can you you take a look at my messages to see if they matches with yours?
shared FIX logs with you at: 
http://fixparser.targetcompid.com?sharedlink=-KgBuGVR7E7YHHHj_KEd

key to unlock:

G#YtmrE3XlnCvSCR3DtpEMNoBTDJUM9cfCrmk6c3(8p:xvyKCI8

 

 


@taskman9

#EOL
27 Mar 2017, 10:00

Hey taskman9

According to Spotware FIX specification you can't subscribe to only bid or only ask spot events, so the part |267=2|269=0|269=1| is compulsory for spot subscription request, while your requests are not correct from protocol point of view: field NoMDEntryTypes (tag 267) [that means "number of market data entry types"] is set to 2, but it is followed by only one MDEntryType (tag 269) field


@#EOL

taskman9
27 Mar 2017, 11:24

RE:

#EOL said:

Hey taskman9

According to Spotware FIX specification you can't subscribe to only bid or only ask spot events, so the part |267=2|269=0|269=1| is compulsory for spot subscription request, while your requests are not correct from protocol point of view: field NoMDEntryTypes (tag 267) [that means "number of market data entry types"] is set to 2, but it is followed by only one MDEntryType (tag 269) field

Hello EOL, please help me man.I sent |267=2|269=0|269=1| but still no replies. After 30seconds,i'm simply seeing a hearbeat & TESTID

Here's my test-code :

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace FixNoSSL
{
    public class FixSocketClient
    {
        // cserver ip fix
        public static string host = "94.75.214.147";
        // fix server id
        public static string FixID = "pepperstone.3190557";
        // ctrader account
        public static string Account = "3190557";
        // ctrader password
        public static string Password = "2276";
        public static int total;
        public static string m = "";
        public static int msgSeqenceNum = 1;

        public static void StartClient(string host)
        {

            string time = DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss.fff");

            string body = "35=A|34="+ msgSeqenceNum+"|49=" + FixID + "|50=" + Account + "|52=" + time + "|56=CSERVER|57=QUOTE|98=0|108=30|553=" + Account + "|554=" + Password + "|";

            // body length
            int bodylen = body.Length;
            string fix = "8=FIX.4.4|9=" + bodylen + "|";

            // message
            string message = fix + body;

            message = message.Replace('|', '\u0001');
            byte[] messageBytes = Encoding.ASCII.GetBytes(message);
            for (int i = 0; i < message.Length; i++)
                total += messageBytes[i];

            int checksum = total % 256;
            string checksumStr = checksum.ToString().PadLeft(3, '0');

            string sum = "10=" + checksumStr + "|";
            string m = fix + body + sum;
            m = m.Replace('|', '\u0001');

            Console.WriteLine(">>>>\nSend to server (hit any key) {0}", m);
            Console.ReadKey();

            // Data buffer for incoming data.
            byte[] bytes = new byte[1024];

            // Connect to a remote device.
            try
            {
                // Establish the remote endpoint for the socket.
                // This example uses port 11000 on the local computer.

                IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(host), 5201);

                // Create a TCP/IP  socket.
                Socket sender = new Socket(AddressFamily.InterNetwork,
                    SocketType.Stream, ProtocolType.Tcp);

                // Connect the socket to the remote endpoint. Catch any errors.
                try
                {
                    sender.Connect(remoteEP);

                    Console.WriteLine("SOCKET CONECTED {0}", sender.RemoteEndPoint.ToString());

                    // Encode the data string into a byte array.
                    byte[] msg = Encoding.ASCII.GetBytes(m);

                    // Send the data through the socket.
                    int bytesSent = sender.Send(msg);

                    // Receive the response from the remote device.
                    int bytesRec = sender.Receive(bytes);
                    Console.WriteLine("INCOMING SERVER Reply >>\n"+ Encoding.ASCII.GetString(bytes, 0, bytesRec));
                    Console.WriteLine("Want to send data request? Type 'y' for yes");
                    string str = Console.ReadLine();
                    if (str == "y")
                    {
                        try
                        {
                            while (true)
                            {
                                msgSeqenceNum++;
                                
                                time = DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss.fff");

                                body = "35=V|49=" + FixID + "|56=CSERVER|34="+msgSeqenceNum+"|52=" + time + "|50=QUOTE|57=ANY|262=131129531|263=1|264=1|265=1|146=1|55=1|267=2|269=0|269=1|";

                                // body length
                                bodylen = body.Length;
                                fix = "8=FIX.4.4|9=" + bodylen + "|";

                                // message
                                message = fix + body;

                                message = message.Replace('|', '\u0001');
                                messageBytes = Encoding.ASCII.GetBytes(message);//converted to 0's &1s
                                for (int i = 0; i < message.Length; i++)
                                    total += messageBytes[i];

                                checksum = total % 256;
                                checksumStr = checksum.ToString().PadLeft(3, '0');

                                sum = "10=" + checksumStr + "|";
                                m = fix + body + sum;
                                m = m.Replace('|', '\u0001');
                                msg = Encoding.ASCII.GetBytes(m);//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                                // Send the data through the socket.
                                Console.WriteLine("Sent This meggase to get quote:\n"+ Encoding.ASCII.GetString(msg));
                                bytesSent = sender.Send(msg);

                                // Receive the response from the remote device.
                                bytesRec = sender.Receive(bytes);
                                if (bytes.Length!=0)
                                {
                                    Console.WriteLine("SERVER Reply >>\n {0}", Encoding.ASCII.GetString(bytes, 0, bytesRec));
                                }
                                
                            }
                        }
                        catch (Exception ex2)
                        {
                            Console.WriteLine(ex2.Message);
                        }
                    }

                    // Release the socket.
                    sender.Shutdown(SocketShutdown.Both);
                    sender.Close();

                }
                catch (ArgumentNullException ane)
                {
                    Console.WriteLine("ArgumentNullException : {0}", ane.ToString());
                }
                catch (SocketException se)
                {
                    Console.WriteLine("SocketException : {0}", se.ToString());
                }
                catch (Exception e)
                {
                    Console.WriteLine("Unexpected exception : {0}", e.ToString());
                }

            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }

        public static int Main(String[] args)
        {
            while (true)
            {
                StartClient(host);
                Thread.Sleep(5000);
            }
        }
       
    }
}

 


@taskman9

hans177
27 Mar 2017, 13:52

Why do you keep sending messages to get new quotes after sending 263=1


@hans177

#EOL
27 Mar 2017, 16:42

that's a...

OK, I don't understand why everybody is trying to maintain the protocol by themselves instead of taking some ready FIX engine framework like QuickFIX.

you do realise, that you will have to process all the heartbeats and test requests by your own code, don't you?

particulary your code uses different set of SenderCompID, SenderSubID, TargetCompID and TargetSubID parameters in logon message and spot subscription.

And it seems, that it calculates incorrect checksums that could be a reason why server ignores them: https://goo.gl/y5KAkn


@#EOL

mindbreaker
29 Mar 2017, 16:23

RE:

#EOL said:

that's a...

OK, I don't understand why everybody is trying to maintain the protocol by themselves instead of taking some ready FIX engine framework like QuickFIX.

 We like it :D

And we don't like use code from other people :D

And for pleasure :D :D :D


 

@mindbreaker