Spotware FIX 4.4

Created at 27 Apr 2016, 12:29
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!
mindbreaker's avatar

mindbreaker

Joined 19.07.2014

Spotware FIX 4.4
27 Apr 2016, 12:29


Hi Spotware :)

where is simple example how use this (https://help.spotware.com/FIX) and how send this line to the cServer:

8=FIX.4.4|9=102|35=A|34=1|49=broker.1047|50=Quote|52=20131129-15:40:10.276|56=QUOTIX|98=0|108=30|141=Y|553=1047|554=4|10=000|

What I need use to send this?

Socket ssl, Https POST, GET request or ... ???

Simple example without this stupid frameworks for example how set order on gbpjpy using clear c#,(java, or in another language) and FIX.

Thanks for help.


@mindbreaker
Replies

Spotware
27 Apr 2016, 14:13

Dear Trader,

Please have a look at the Code Samples given at the the Spotware Connect site.


@Spotware

mindbreaker
27 Apr 2016, 14:33

Spotware

Spotware said:

Dear Trader,

Please have a look at the Code Samples given at the the Spotware Connect site.

Dear Spotware

there no FIX examples.

Please send link with working example with FIX 4.4

Bye.

 


@mindbreaker

mindbreaker
27 Apr 2016, 17:06

RE: Spotware

Did any of cTrader/cAlgo broker allows use of FIX 4.4 Protocol ?


@mindbreaker

Waxy
27 Apr 2016, 19:22

I agree with mindbreaker I'm lost with this new feature, please provide some examples.


@Waxy

mindbreaker
27 Apr 2016, 20:17

FIX

I found this

http://quickfixn.org/tutorial/creating-an-application.html

http://www.quickfixengine.org/

and

http://quickfixn.org/tutorial/creating-an-application.html

https://ttfixadapter.codeplex.com/

 

and java

http://www.quickfixj.org/quickfixj/usermanual/1.6.1/usage/sending_messages.html

https://mprabhat.me/2012/07/02/creating-a-fix-initiator-using-quickfixj/

http://vvratha.blogspot.com/2012/06/writing-simple-fix-initiator-and.html

 

and php

http://stackoverflow.com/questions/7002774/getting-started-on-fix-protocol-with-php-sockets


@mindbreaker

mindbreaker
27 Apr 2016, 20:36

FIX4.4

Java example with quickfix

http://www.dailyfxforum.com/threads/64877-Quickfix-Java-Example


@mindbreaker

Waxy
28 Apr 2016, 04:25

I'll give a try to quickfixn!


@Waxy

mindbreaker
28 Apr 2016, 08:57

FIX4.4

This post has been removed by moderator due to a violation of the EULA. Broker discussions are prohibited in cTDN.

 


@mindbreaker

moneybiz
06 May 2016, 18:41

RE: FIX4.4

This post has been removed by moderator due to a violation of the EULA. Broker discussions are prohibited in cTDN.


@moneybiz

moneybiz
12 May 2016, 02:32

cTrader FIX Engine
Rules of Engagement
Version 2.1
May 201

This documentation is not well documented and needs examples for all of the requests/responses supported.

For example few unknowns;
1) How is the "BodyLength" calculated?
2) Is "
MsgSeqNum" increased on every request or it is fixed to 1 as indicated in the documentation?
3) Is "CheckSum" always 054 as it is documented on or always 000 as it is in the example?

 

 


@moneybiz

olddirtypipster
03 Aug 2016, 01:47

RE:

I suggest you read the official FIX Protocol documentation at www.fixprotocol.org/

It explains how bodylength, checksum, etc are to be calculated.

Your checksum is dependent on the data packet content. It must be recalculated for each msg sent or the server will return invalid.

MsgSewNum is always updated. If it is out of sequence, you have to reset it.

Read tor official FIX Protocol documentation. It will take some time to get it, but is well worth the extra effort.

moneybiz said:

cTrader FIX Engine
Rules of Engagement
Version 2.1
May 201

This documentation is not well documented and needs examples for all of the requests/responses supported.

For example few unknowns;
1) How is the "BodyLength" calculated?
2) Is "MsgSeqNum" increased on every request or it is fixed to 1 as indicated in the documentation?
3) Is "CheckSum" always 054 as it is documented on or always 000 as it is in the example?

 

 

 


@olddirtypipster

jaredthirsk
14 Aug 2016, 09:03

Here is the FIX help page with the most up to date message reference PDF (version 2.5 as of this writing):

https://help.spotware.com/FIX


@jaredthirsk

mindbreaker
01 Sep 2016, 17:54

FIX 4.4 C# SocketSSL

Hi, i try connect to ctrader server with fix but something went wrong.

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

namespace FIX
{
    class Program
    {

        public static string host = "h51.p.ctrader.com";

        static void Main(string[] args)
        {
            while (true)
            {
                StartClient(host);
                Thread.Sleep(5000);
            }
        }

        public static void StartClient(string host)
        {
            // Data buffer for incoming data.
            byte[] bytes = new byte[1024];

            // Connect to a remote device.
            try
            {
               
                IPHostEntry ipHostInfo = Dns.GetHostEntry(host);
                IPAddress ipAddress = ipHostInfo.AddressList[0];
                Console.WriteLine(ipAddress);

                 TcpClient client = new TcpClient(host, 5201);
                SslStream sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
                try
                {
                    sslStream.AuthenticateAsClient(host);
                    //sslStream.AuthenticateAsClientAsync(host);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    client.Close();
                    return;
                }
                // Connect the socket to the remote endpoint. Catch any errors.
                try
                {

                    byte[] messsage = Encoding.UTF8.GetBytes("8=FIX.4.4|9=102|35=A|34=1|49=fxpro.123456|50=Quote|52=20131129-15:40:10.276|56=cServer|98=0|108=30|141=Y|553=1047|554=PASSWORD|10=140|");
                    // Send hello message to the server. 
                    sslStream.Write(messsage);
                    sslStream.Flush();

                    // Read message from the server. 
                    string serverMessage = ReadMessage(sslStream);
                    Console.WriteLine("Server says: {0}", serverMessage);

                    //Console.WriteLine("SERVER SEND: {0}", Encoding.ASCII.GetString(bytes, 0, bytesRec));

    
                }
                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());
            }
        }
        static string ReadMessage(SslStream sslStream)
        {
            byte[] buffer = new byte[2048];
            StringBuilder messageData = new StringBuilder();
            int bytes = -1;
            do
            {
                bytes = sslStream.Read(buffer, 0, buffer.Length);
                Decoder decoder = Encoding.UTF8.GetDecoder();
                char[] chars = new char[decoder.GetCharCount(buffer, 0, bytes)];
                decoder.GetChars(buffer, 0, bytes, chars, 0);
                messageData.Append(chars);
                Console.WriteLine(chars);
                // Check for EOF. 
                if (messageData.ToString().IndexOf(" ") != -1)
                {
                    break;
                }
            } while (bytes != 0);

            return messageData.ToString();
        }

        // The following method is invoked by the RemoteCertificateValidationDelegate.
        public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors == SslPolicyErrors.None)
                return true;

            Console.WriteLine("Certificate error: {0}", sslPolicyErrors);

            // Do not allow this client to communicate with unauthenticated servers.
            //return false;
            //Force ssl certyfikates as correct
           return true;
        }
    }
}

And the question: How fix my example ?

Thanks


@mindbreaker