Topics
30 Aug 2017, 11:07
 0
 3234
 3
28 Apr 2017, 14:00
 2161
 2
31 Mar 2017, 09:27
 2697
 3
30 Mar 2017, 11:50
 3434
 7
29 Mar 2017, 16:02
 2674
 7
29 Mar 2017, 10:48
 2115
 3
12 Mar 2017, 13:53
 2243
 2
01 Mar 2017, 22:40
 1789
 4
22 Feb 2017, 21:02
 2126
 1
22 Feb 2017, 19:48
 2526
 5
08 Feb 2017, 13:58
 6020
 14
03 Feb 2017, 10:03
 0
 2092
 1
Replies

mindbreaker
30 Mar 2017, 15:49

Now you can use FIX with SSL


@mindbreaker

mindbreaker
30 Mar 2017, 15:39

RE:

Spotware said:

Hi mindbreaker,

FIX API works for all cTrader accounts. Can you please check again the host name through your cTrader FIX API credentials?

Now show h23.p. but it works :) Thanks

 


@mindbreaker

mindbreaker
30 Mar 2017, 13:02 ( Updated at: 21 Dec 2023, 09:20 )


@mindbreaker

mindbreaker
30 Mar 2017, 13:01 ( Updated at: 21 Dec 2023, 09:20 )

But does not work on fxpro accounts. Why?

For wath is it if works only on spotware demo :D:D:D


@mindbreaker

mindbreaker
30 Mar 2017, 12:28

RE:

Spotware said:

Hi mindbreaker,

Get the latest code from GitHub. Heartbeat issue is solved

And why there no queue for message ? When i hit cople buttons in short time application will crash.

The example's purpose is to demonstrate how to construct, send and receive a FIX message therefore it was kept as simple as possible. It does not have any practical use therefore there is no need to implement queueing or other mechanisms that would complicate the sample. 

It works but if i hit logon message after login system crashing.


@mindbreaker

mindbreaker
30 Mar 2017, 11:55

RE: RE:

Spotware said:

ycomp said:

how should I handle the situation where my program:

1. sends a market order request

2. connection drops

3. market order filled

4. response message missed (because not connected)

5. reconnected

so now on the server will be an open trade, that my program doesn't know was opened

 

You can get an account's history at any time, including orders, positions and deals through Accounts API.

https://connect.spotware.com/docs/api-reference/accounts-api

But in ConnectApi 2s refresh request interval exist (2 secomds in forex reality is eternity) !!!


@mindbreaker

mindbreaker
29 Mar 2017, 17:29

RE:

Spotware said:

Hi mindbreaker,

The forum exists mostly for community members to help each other. Therefore if you want to get speedy answers from the community, you need to be as clear as possible, else noone will be able to help you. Spotware staff usually intervenes only when some questions are very specific and cannot be answered by the community. Our specialists are currently occupied building and maintaining wonderful software therefore it might take some time to take an answer from them, especially when they don't have enough information to understand the problem.

Regarding the sample using SSL it will come soon but we can not provide a date.

Thanks for your explanation.

Bye.


@mindbreaker

mindbreaker
29 Mar 2017, 16:44

RE:

Spotware said:

Hi mindbreaker,

It would be easier for someone to help you if you could share the code or at least if the exception message was in English.

Dear Spotware ,

Your specialists should and without it be able to answer in a few minutes for this simple question :P and with closed eyes.

Or where is example with FIX SSL (working)?

If you do not see such an example this week I'm not coming in here anymore.

Thanks and bye.


@mindbreaker

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

mindbreaker
29 Mar 2017, 13:33

Second video ho get tokens from clients accounts and how refresh token: https://www.youtube.com/watch?v=wHxURyh7PS0


@mindbreaker

mindbreaker
29 Mar 2017, 13:30

RE:

Spotware said:

Hi mindbreaker,

We would like to thank you for your effort and the time you spent to prepare the video. It is going to be a useful addition to the material available to Spotware Connect community.

We look forward to your next video!

Now it's done.

You can see here (Sorry for my English):

Connect Api Spotware - Connect client accounts and refresh token

https://www.youtube.com/watch?v=wHxURyh7PS0

 

Ps. maybe is it possibility to add iframe with youtube movie to this posts or replace url to youtube video in js ( it simple )

 


@mindbreaker

mindbreaker
29 Mar 2017, 13:22

RE:

Spotware said:

Hi mindbreaker,

You cannot check the type of the token but you should know what type of token it is since you are the one requesting it. You can keep this information and associate it with the token.

Hi Spotware,

I know that and i do but it is not convenient and not practical.

Thanks.


@mindbreaker

mindbreaker
29 Mar 2017, 09:11

RE: RE: RE:

here page with all actions:

https://connect.spotware.com/docs/api-reference/accounts-api


@mindbreaker

mindbreaker
29 Mar 2017, 09:09

RE: RE:

ycomp said:

mindbreaker said:

My youtube video:

Spotware Connect Api how to get access token and get data from cTrader server from url (connect api, cTID, link accounts to cTID).

https://youtu.be/SRoKIpp-Gog

thanks, the video was useful 

I have a problem now that I have Trading and Accounts API access via the sandbox test account (connect@spotware.com), however I can't get a list of symbols (empty) nor trade "EURUSD" with a market order ("CH_SYMBOL_NOT_FOUND")

Do you know how I can get a demo account to try that has symbols available?

I tried to make my own Application and cTraderID but I have even less success, I think maybe because the Application says "submitted" next to it - so maybe it is not active yet ?So with those tokens I can't connect and authorize

Do you know when I authorize the trading API, how often is that required? 

Don't test on sandbox (create new email on google, create new cTID connect new demo account from fxpro.co.uk or fro other broker and test whitout sandbox).

I dont know but when i try on sandbox it does not work, i try many times on sandbox but same results (does not work)

get all account symbols

https://api.spotware.com/connect/tradingaccounts/{id}/symbols?access_token=XXXXXXXXXX

 


@mindbreaker

mindbreaker
28 Mar 2017, 19:42

My youtube video:

Spotware Connect Api how to get access token and get data from cTrader server from url (connect api, cTID, link accounts to cTID).

https://youtu.be/SRoKIpp-Gog


@mindbreaker

mindbreaker
28 Mar 2017, 17:04

Here how start with connect https://connect.spotware.com/docs/available-resources/playground


@mindbreaker

mindbreaker
27 Mar 2017, 19:56

RE:

ycomp said:

how does one connect to the sandbox? I get errors when clicking the link 403 Forbidden

Don't use sandbox :) delete all sandbox- from urls and test on your demo account from fxpro for example (works cool sandbox is poor and does not works).

 

1) Create CTID

2) Open new demo account cTrader

3) login to cTrader with CTID (then your accont connect to your CTID)

4) Create connect application and get playground data

5) use this urls don't use sandbox:

  • https://api.spotware.com
  • https://connect.spotware.com

6) And test on your demo account


@mindbreaker

mindbreaker
27 Mar 2017, 19:42

You need catch $_GET['code'] from redirect url script and change the code to token:

if your redirect url is: https://domain.com/app-redirect-uri.php

 

<?php
error_reporting('E_ALL');
// App client id
$cID = 'xxx_xxxxxxxxx';
// App secret 
$cSecret = 'xxxxxxxxxxxx';
// App redirect uri
$cUri = 'https://domain.com/connect/redirect.php';

if (isset($_GET['code'])) {

	// Secure input data
	$cReceive = htmlentities($_GET['code'], ENT_QUOTES, 'utf-8');
	//$cReceive = preg_replace("/[^a-zA-Z0-9_-]/", "", $_GET['code']);

	$cGetUserAccessToken = 'https://connect.spotware.com/apps/token?grant_type=authorization_code&code='.$cReceive.'&redirect_uri='.$cUri.'&client_id='.$cID.'&client_secret='.$cSecret;
	// get response
	$res = file_get_contents($cGetUserAccessToken);	

	if ($res != false) {
		// save to file
		file_put_contents('token-'.time().'.secret', $res);		
		$tokens = json_decode($res, true);
		print_r($tokens);
	}

}else{
	echo '<h1 style="color: #000; width: 100%; text-align: center">[ERROR_INPUT_DATA]</h1>';
}

 


@mindbreaker

mindbreaker
24 Mar 2017, 18:56

        protected override void OnTick()
        {
            // Put your core logic here

            // Put your initialization logic here
            foreach (var position in Positions)
            {
                // for buy
                if (position.TradeType == TradeType.Buy)
                {
                    if (((Symbol.Bid + Symbol.Ask) / 2) <= (5 - 0.02))
                    {
                        if (position.SymbolCode == Symbol.Code)
                        {

                            ClosePosition(position);
                        }


                    }
                }
                // for sell
                if (position.TradeType == TradeType.Sell)
                {
                    if (((Symbol.Ask + Symbol.Bid) / 2) >= (5 + 0.02))
                    {
                        if (position.SymbolCode == Symbol.Code)
                        {

                            ClosePosition(position);
                        }
                    }
                }

            }
            // end foreach
        }

 


@mindbreaker

mindbreaker
06 Mar 2017, 19:26

RE:

pcharalampous said:

Symbol name is the same but in such cases you will need to encode your url https://www.w3schools.com/tags/ref_urlencode.asp

In this case # should become %23

Thats correct :) Thanks.


@mindbreaker