Topics
09 Sep 2016, 16:02
 4825
 8
Replies

tetra
13 Nov 2018, 20:49

RE:

Hi,

I can't really follow the answer, what is new in openapi 2.0? What is the difference or new? Why openapi 2.0 created?

Tetra

Panagiotis Charalampous said:

Hi tetra,

As I said above, Open API v2.0 has not been officially released yet. Documentation has not been completed. For the sample, you will need to send me your application credentials and the token you use at connect@spotware.com to check.

Best Regards,

Panagiotis

 


@tetra

tetra
11 Nov 2018, 17:59

RE:

Hi,

 

What is new with the openapi 2.0? Is there a documentation for that?

The Open_API_2._0_Sample 'Get Account List' hang permanently, does the sample or the openapi 2.0 in alpha/beta status?

 

Tetra

Panagiotis Charalampous said:

Hi hsbcstor,

Thanks for posting in our forum. Regarding your questions.

1) Open API v2.0 has not been officially released yet, however it has been deployed on production servers and being tested and used by some major partners. The message you receive indicates that you are not using the correct proxy. Can you please advise which proxy do you use?

2) Yes you can use FIX API with demo accounts.

Best Regards,

Panagiotis

 


@tetra

tetra
08 Mar 2017, 13:27

RE:

This won't happen until the disclaimer on the spotware site is:

The services provided by Spotware Systems Ltd. are not available to citizens or residents of the USA. Neither is the information on our websites directed toward soliciting citizens or residents of the USA.

 

kricka said:

Futures are specific to the USA market. CFDs are more common to the European markets. To trade futures, the brokers has to have their main office in the USA with affiliates in Europa. So far not many brokers in the USA has picked up on cAlgo or cTrader. We would love to have futures as well presented by the liquid providers in the platform. This will surely happen as the Spotware Team has already included futures as a possibility for brokers. It's up to the broker's to introduce futures within the platform.

 


@tetra

tetra
08 Feb 2017, 13:59 ( Updated at: 10 Feb 2017, 17:38 )

There is no staff here, I never received answer from the forum.

Try to reach them on linkedin: https://www.linkedin.com/company/ctrader

You need to reach a level higher then the support staff, so somebody take responsibility.


@tetra

tetra
07 Feb 2017, 08:14

There is no service here.

Try to call them : http://www.spotware.com/contact-us/details


@tetra

tetra
31 Jan 2017, 17:26

Stop loss, and take profit orders are still not supported, is that correct? Can you add those?

For consistency reason you could make historical data available for FIX users, so there would be no need to code in multiple api.


@tetra

tetra
03 Oct 2016, 20:07

Why don't you check the c# example?


@tetra

tetra
30 Sep 2016, 17:27

RE: where is error n this example

The  / Order Status Request (MsgType(35)=H) /  is for query an existing order, so obviously your code will not work since the ClOrdID does not exists.

 

mindbreaker said:

 

@tetra

tetra
30 Sep 2016, 04:35

RE:

When was that exactly?

Was the cTrader platform also down at that time?

 

rmssf said:

ProtoMessage{ErrorResponse{errorCode:UNKNOWN_ERROR, description:Server error}}

 

 


@tetra

tetra
28 Sep 2016, 22:40

RE: where is error n this example

Tag 34 is sequence number, every time you send a message, the sequence number should be increased by 1.

 

mindbreaker said:

 

 


@tetra

tetra
28 Sep 2016, 22:38

RE: where is error n this example

Tag 34 is sequence number, every time you send a message, the sequence number should be increased by 1.

 

mindbreaker said:

 

 


@tetra

tetra
22 Sep 2016, 13:56

RE: RE: RE: RE: RE: RE:

Here is a full book request example:

8=FIX.4.4|9={bodylength}|35=V|34=2|49={accountid}|52={time}|50=QUOTE|56=CSERVER|262={messageGuid}|263=1|264=0|267=1|269=0|146=1|55={symbolid}|10={checksum}|

 

mindbreaker said:

 

But whats after login how send message (some example)?

 


@tetra

tetra
11 Sep 2016, 11:14

RE: RE: RE: RE: RE:

I agree, FIX without SSL is a joke.

Try to reach someone competent if you can:

https://www.linkedin.com/in/andrey-pavlov-38ba746

https://www.linkedin.com/in/vladimir-galaiko-6689087b

https://www.linkedin.com/in/james-glyde-2b507164

their regular support give only canned answers, and might not even understand what the problem is.

mindbreaker said:

Hi

Thank you for your explanation. If however this fix works without SSL it does not interest me such a flawed system.

Thanks for the help

Ps.

I think it display certs info (but maybe on 443 port I see in monday.)

 

        static void DisplayCertificateInformation(SslStream stream)
        {
            Console.WriteLine("Certificate revocation list checked: {0}", stream.CheckCertRevocationStatus);

            X509Certificate localCertificate = stream.LocalCertificate;
            if (stream.LocalCertificate != null)
            {
                Console.WriteLine("Local cert was issued to {0} and is valid from {1} until {2}.",
                    localCertificate.Subject,
                    localCertificate.GetEffectiveDateString(),
                    localCertificate.GetExpirationDateString());
            }
            else
            {
                Console.WriteLine("Local certificate is null.");
            }
            // Display the properties of the client's certificate.
            X509Certificate remoteCertificate = stream.RemoteCertificate;
            if (stream.RemoteCertificate != null)
            {
                Console.WriteLine("Remote cert was issued to {0} and is valid from {1} until {2}.",
                    remoteCertificate.Subject,
                    remoteCertificate.GetEffectiveDateString(),
                    remoteCertificate.GetExpirationDateString());
            }
            else
            {
                Console.WriteLine("Remote certificate is null.");
            }
        }

Nice day

 


@tetra

tetra
10 Sep 2016, 20:13

RE: RE: RE:

Body is after the 9 section, without checksum part:

8=FIX.4.4|9=102| 35=A|34=1|49=fxpro.9910892|50=Quote|52=20131129-15:40:10.276|56=cServer|98=0|108=30|141=Y|553=1047|554=PASSWORD|

ssl: there is no ssl on port 5201 -> https://www.htbridge.com/ssl/?id=a65c629cbd93adf53071f4be8d1fe92e31fbeedc5bfc9cc93796139487b117c1

mindbreaker said:

Hi tetra I know but:

1) I dont know how check message body length (Which part)

-The fix message body length is wrong in the example

 

2) Checksum this example:

https://github.com/fxstar/Chash/blob/master/FIX4.4/Checksum.cs

string message = "8=FIX.4.1|9=61|35=A|34=1|49=EXEC|52=20121105-23:24:06|"
    + "56=BANZAI|98=0|108=30|";
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');

 

3) if I check ssl there was on server(multicard ssl)  why i can't use SSL?

 

Thanks for the help

 

tetra said:

Hi mindbreaker,

Few notes about your code:

-The fix message body length is wrong in the example

-The fix message checksum number is also wrong

-Use proper time: /52=/ DateTime.Now.ToUniversalTime().ToString("yyyyMMdd-hh:mm:ss.fff")

-Since there is no ssl, use client.GetStream() directly

-Do not forget to change the separator / .Replace('|', '\u0001') /

if you fix these, your code will work.

 

mindbreaker said:

Hi how connect and get data from server ???

It is my code:

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.9910892|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;
        }
    }
}

Thanks for the help

 

 

 


@tetra

tetra
10 Sep 2016, 13:45

RE:

Hi mindbreaker,

Few notes about your code:

-The fix message body length is wrong in the example

-The fix message checksum number is also wrong

-Use proper time: /52=/ DateTime.Now.ToUniversalTime().ToString("yyyyMMdd-hh:mm:ss.fff")

-Since there is no ssl, use client.GetStream() directly

-Do not forget to change the separator / .Replace('|', '\u0001') /

if you fix these, your code will work.

 

mindbreaker said:

Hi how connect and get data from server ???

It is my code:

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.9910892|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;
        }
    }
}

Thanks for the help

 


@tetra

tetra
10 Sep 2016, 00:27

RE:

This might be a little help but the fix separator is 0x01.

Use Replace('|', (char)1) on the strings that you want to send.

With the example below:

"8=FIX.4.4|9=102|35=A|34=1|49=fxpro.9910892|50=Quote|52=20131129-15:40:10.276|56=cServer|98=0|108=30|141=Y|553=1047|554=PASSWORD|10=140|".Replace('|', (char)1)

mindbreaker said:

Hi how connect and get data from server ???

It is my code:

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.9910892|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;
        }
    }
}

Thanks for the help

 


@tetra

tetra
10 Sep 2016, 00:23

RE: RE: Fix SSL

No SSL certificate provided, without that it is not possible to use secure SSL connection.

 

Without SSL the price can be intercepted and twisted. This gives the possibility for the broker to use a virtual dealer plugin type software.

 

ianj said:

You got a good point there about SSL - the only time i have ever seen a non SSL connection is within a data centre where the endpoints are physically known and the routing is dedicated or at least private 

Am sure you can find a FIX engine in C#

Try looking here https://en.wikipedia.org/wiki/QuickFIX

 

mindbreaker said:

Thanks

I need example with C# and SSL (Financial app whitout ssl its stupid).

I don't like Java and Android but:

You can show example.

Nice day

 

 


@tetra

tetra
09 Sep 2016, 19:33

RE: RE: RE: RE:

Tell me more, why can't I just read the socket and parse the messages? It is never too late to learn.

I see somebody already give it a try: /forum/fix-api/10251

 

ianj said:

Haha - If you don't THINK an external library is necessary, then it is 

The synchchronisation issues alone ensure that 

Any of the quickfix* implementations should work without a problem once you work out the spotware specifics and limitations

tetra said:

I am looking for an example like this: https://github.com/spotware/connect-csharp-samples

I don't think external library is necessary, but if you have an example with that, could you copy paste a kick-start snippet? Login and subscribe quote/depth?

Thanks,

 

 


@tetra

tetra
09 Sep 2016, 18:28

RE: RE: RE: RE:

Are you using that library? Do you have a snippet to share?

rmssf said:

You need a FIX library, and that site implements one with source code and working examples.

 

tetra said:

I am looking for an example like this: https://github.com/spotware/connect-csharp-samples

I don't think external library is necessary, but if you have an example with that, could you copy paste a kick-start snippet? Login and subscribe quote/depth?

Thanks,

 

rmssf said:

tetra said:

Is there a simple FIX example is available somewhere in C#?

Hi,

Yes, there is: http://quickfixn.org

Rui

 

 

 


@tetra

tetra
09 Sep 2016, 17:04

RE: RE:

I am looking for an example like this: https://github.com/spotware/connect-csharp-samples

I don't think external library is necessary, but if you have an example with that, could you copy paste a kick-start snippet? Login and subscribe quote/depth?

Thanks,

 

rmssf said:

tetra said:

Is there a simple FIX example is available somewhere in C#?

Hi,

Yes, there is: http://quickfixn.org

Rui

 


@tetra