Replies

jayteasuk
08 Apr 2021, 11:51

RE:

i managed to resolve this by rebooting my server

 

PanagiotisCharalampous said:

Hi jayteasuk,

There is no issue on the API and the message is clear. Maybe the broker disabled trading for your application on the API in general. They need to check.

Best Regards,

Panagiotis 

Join us on Telegram 

 


@jayteasuk

jayteasuk
31 Mar 2021, 09:28

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

This means that either the account or the application has been disabled by the broker. You need to go back to your broker to investigate further.

Best Regards,

Panagiotis 

Join us on Telegram 

 

I've logged a ticket with pepperstone but not joy in getting it working again yet

I'm able to make trades through the front end trading application so the accounts are not disabled. 

Is there anything it could be in the spot ware side, it's not worked since 19th March? 


@jayteasuk

jayteasuk
20 Feb 2021, 16:35

RE:

jayteasuk said:

Is the tick data that is delivered on the API 2.0 connection the same data as the API 1.0

 

reason i ask is that there doesnt seem to be as much information returned, somtimes gaps of minutes and i used to see many ticks a second on the old feed

Thank you

 

Would a tick occcur when any transaction is made at that price or when the price changes? 


@jayteasuk

jayteasuk
27 Jan 2021, 14:01

resolved

resolved - needed to generate new key with permission to account


@jayteasuk

jayteasuk
12 Jan 2021, 08:37

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

Please note that the timestamp delta (and all deltas in general) is the distance from the previous tick and not from the first one. So to get the time for the last tick, you need to add all the deltas from the first one. Can you please confirm that this is how you do it?

Best Regards,

Panagiotis 

Join us on Telegram

I have that working now thank you

 


@jayteasuk

jayteasuk
11 Jan 2021, 19:01

RE:

PanagiotisCharalampous said:

Hi jayteasuk

Your ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means that not all data have been sent and you need to request them again using the last timestamp as the new TO value. Execute this recursively until you receive all the data.

Best Regards,

Panagiotis 

Join us on Telegram

ok i have pulled data from 11/16/2020 @ 11:32am to 11/16/2020 @ 12:32pm (UTC)

1605526364000 to 1605529964000

This returns 2,3290 rows containing 820 tickData entries

The expectation is this returns 1 hours worth of tick data for USDTRY

I have a hasMore: false at the end of the data which is what i would expect as its less then 100,000 rows and under 1 week of data, also confirms i received all the data

The minimum tick timestamp is -49997

This gives me a time range of 2020-11-16 12:31:50.000  to  2020-11-16 12:32:39.000

This gives me around 49 seconds of data, not the 1 hour i was expecting

 

I have tried another test pulling 11/15/2020 @ 12:32pm (UTC) to 11/16/2020 @ 12:32pm (UTC)

1605443520000 to 1605529964000

Expecting 24 hours of data

End of the file has hasMore: false

35,622 rows returned, containing 8,903 tickData entries

The minimum tick timestamp is -917027

This gives me a time range of 2020-11-16 12:17:23.000  to  2020-11-16 12:32:39.000

This gives me approx 15 minutes not the 24 hours i was expecting

 

Am i missing something from my calculations?


@jayteasuk

jayteasuk
11 Jan 2021, 09:42

RE:

PanagiotisCharalampous said:

Hi jayteasuk

Your ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means that not all data have been sent and you need to request them again using the last timestamp as the new TO value. Execute this recursively until you receive all the data.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you

 

Roughly what is the max rows/time period for requesting tick data


@jayteasuk

jayteasuk
17 Nov 2020, 11:14

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

I don't think you can trade 100000 on these symbols. Try with lower volulmes. In any case, you need to receive ProtoOAExecutionType.ORDER_FILLED event in order for your order to be filled and see the position in cTrader. It doesn't seem you received such a message.

Best Regards,

Panagiotis 

Join us on Telegram

thank you, reducing the volume worked.

when it was too low i got the message

ProtoMessage{OrderErrorResponse{errorCode:TRADING_BAD_VOLUME, description:Order volume 0.10 is smaller than group minVolume=1.00.}}

having looked at the symbol i see there is a category id, 2 in this case. Can i asume that these categories have the minVolume and some other useful information

Where can i get these details from the API 


@jayteasuk

jayteasuk
17 Nov 2020, 09:58 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

I do not see an ProtoOAExecutionType.ORDER_FILLED event indicating that the order was filled. Also from what I see the volume is 0. How do you expect an order with volume 0 to be filled?

Best Regards,

Panagiotis 

Join us on Telegram

That's interesting that the executed volume is 0 however the volume in the order is 100,000 (0.01) which im using for all my test trades at the moment and they are working, apart from these symbols XPTUSD,XAUUSD,XPDUSD

 

here is an example of AUDUSD 100000 which has shown in the cTrader platform but also has an executed volume of 0

 

 

ctidTraderAccountId: 19137822
executionType: ORDER_ACCEPTED
position {
  positionId: 55789145
  tradeData {
    symbolId: 5
    volume: 0
    tradeSide: BUY
    guaranteedStopLoss: false
    7: "TradingApiTest.CreateMarketOrderRequest"
  }
  positionStatus: POSITION_STATUS_CREATED
  swap: 0
  price: 0
  commission: 0
  marginRate: 0
  mirroringCommission: 0
  guaranteedStopLoss: false
  usedMargin: 0
  15: 2
}
order {
  orderId: 95487816
  tradeData {
    symbolId: 5
    volume: 100000
    tradeSide: BUY
    openTimestamp: 1605599626204
    guaranteedStopLoss: false
    7: "TradingApiTest.CreateMarketOrderRequest"
  }
  orderType: MARKET
  orderStatus: ORDER_STATUS_ACCEPTED
  executedVolume: 0
  utcLastUpdateTimestamp: 1605599626204
  closingOrder: false
  timeInForce: IMMEDIATE_OR_CANCEL
  positionId: 55789145
  relativeStopLoss: 8
  relativeTakeProfit: 12
  trailingStopLoss: false
}
isServerEvent: false
 


@jayteasuk

jayteasuk
16 Nov 2020, 19:05

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

We need more information to check this further.

  1. Please confirm that you are using the same account in both cases. Please provide ctidTraderAccountId and trading account number.
  2. Please provide us the complete sequence of exchanged messages from ProtoOANewOrderReq until the ProtoOAExecutionEvent with ProtoOAExecutionType.ORDER_FILLED type indicating that the order was filled and the position opened.
  3. Some screenshots showing the account number and the fact that the position is missing

Best Regards,

Panagiotis 

Join us on Telegram

 

 

I have just run another test to provide the details you need

hopefully this gives you what you need, i think its just this symbol thats the problem, all others appear in the ctrader windows frontend and in the ProtoOADealListReq

 

ctidTraderAccountId: 19137822
executionType: ORDER_ACCEPTED
position {
  positionId: 55759886
  tradeData {
    symbolId: 73
    volume: 0
    tradeSide: BUY
    guaranteedStopLoss: false
    7: "TradingApiTest.CreateMarketOrderRequest"
  }
  positionStatus: POSITION_STATUS_CREATED
  swap: 0
  price: 0
  commission: 0
  marginRate: 0
  mirroringCommission: 0
  guaranteedStopLoss: false
  usedMargin: 0
  15: 2
}
order {
  orderId: 95441003
  tradeData {
    symbolId: 73
    volume: 100000
    tradeSide: BUY
    openTimestamp: 1605546038638
    guaranteedStopLoss: false
    7: "TradingApiTest.CreateMarketOrderRequest"
  }
  orderType: MARKET
  orderStatus: ORDER_STATUS_ACCEPTED
  executedVolume: 0
  utcLastUpdateTimestamp: 1605546038638
  closingOrder: false
  timeInForce: IMMEDIATE_OR_CANCEL
  positionId: 55759886
  relativeStopLoss: 80000
  relativeTakeProfit: 120000
  trailingStopLoss: false
}
isServerEvent: false
 


@jayteasuk

jayteasuk
13 Nov 2020, 12:19

RE:

jayteasuk said:

i have an example of a trade being placed against symbol XPDUSD (on my demo account)

the response confirms the trade was successfully placed but it does not appear in the cTrader platform and is not returned by the ProtoOADealListReq

I only have one example at the moment but it doesnt matter how many times i place it, it never shows

executionType: ORDER_ACCEPTED
position {
  positionId: 55644962
  tradeData {
    symbolId: 73
    volume: 0
    tradeSide: BUY
    guaranteedStopLoss: false
    7: "TradingApiTest.CreateMarketOrderRequest"
  }

  positionStatus: POSITION_STATUS_CREATED

...

  orderType: MARKET
  orderStatus: ORDER_STATUS_ACCEPTED

please can i get some help with this query


@jayteasuk

jayteasuk
11 Nov 2020, 22:46 ( Updated at: 21 Dec 2023, 09:22 )

Resolved

jayteasuk said:

i have been setting up API calls to lay trades and im testing this against my demo account

 

i started looking at new symbols outside of the top 5 common ones and i noticed when i set a test trade against  XNGUSD the stop loss didnt set correctly on the cTrader platform but in the response i did get back confirmation of the relative stop loss amount

 

* copied and pasted from the output windowSL_Missing 

  relativeStopLoss: 100
  relativeTakeProfit: 150
  trailingStopLoss: false
}

 

 

when i create a trade i dont set the market type it defaults to 'Market' i see there is a 'STOP_LOSS_TAKE_PROFIT' option

does this make a difference

why would this happen?

 

I have identified that the SL is relative to the pip position and have resolved this issue


@jayteasuk

jayteasuk
11 Nov 2020, 18:58

resolved

Please discount this query


@jayteasuk

jayteasuk
31 Oct 2020, 22:48

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

The port is 5035, the same as for demo.ctraderapi.com. I am not sure which code are you referring to, if you are looking for open authentication instructions, check here.

Best Regards,

Panagiotis 

Join us on Telegram

I got this sorted I hadn't realised my auth code needed renewing so had defaulted back to the demo auth code

Thanks for assisting


@jayteasuk

jayteasuk
30 Oct 2020, 13:52

RE:

jayteasuk said:

I have managed to get oauth 2.0 working by using the .net winforms example

 

with my ctrader details (secret, client, token) it still returns the example account number 

i believe this is because im calling URL and Port 

tradeapi.spotware.com 5035

 

what should this be to go live and see my account details?

 

is that live.ctraderapi.com without a port number?

in relation to the auth code would this be the auth code from the playground area?

if not how would i get the correct auth code?

 


@jayteasuk

jayteasuk
29 Oct 2020, 17:15

RE:

jayteasuk said:

I have managed to get oauth 2.0 working by using the .net winforms example

 

with my ctrader details (secret, client, token) it still returns the example account number 

i believe this is because im calling URL and Port 

tradeapi.spotware.com 5035

 

what should this be to go live and see my account details?

I connect by creating a TcpClient and set up a SslStream for remote certificate validation, connecting to demo.ctraderapi.com:5035. I then call to CreateAppAuthorizationRequest, passing in my ClientId and my ClientSecret. 
I then make a request for an account list by calling the CreateAccountListRequest passing in my token. The resulting message I receive contains one account id, with a status of demo.

...When I try tradeapi.spotware.com I receive the folloeing message:

Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 19137822 Status: Demo 
}}
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}

This is what the documentation says:

CANT_ROUTE_REQUEST    Connection to Server is lost or not supported.
INVALID_REQUEST    Generic error. Usually used when the input value is incorrect.

When I comnnect using live.ctraderapi.com, I get the exact same output and error message.
 


@jayteasuk

jayteasuk
08 Oct 2020, 09:27

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

I am not sure what do you mean. Can you please elaborate?

Best Regards,

Panagiotis 

Join us on Telegram

 

I now have my api working to pull data on my accounts and pricing by using

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

for example

https://api.spotware.com/connect/tradingaccounts/123456/symbols/AUDUSD/trendbars/m5?from=20201006204500&to=20201007225900&access_token=xxxxxxxxxxxxxxxxxxxxx

Im now ready to set up the process for submitting trades but ive not found a similar link like the above to do this in the same way through a query string that i can use on my SQL server

 


@jayteasuk

jayteasuk
06 Oct 2020, 03:37

RE:

that worked thank you

now i have the profile information working through SQL server should it be possible to make use of the protocol buffers thrrugh the same method as well?

 

 

PanagiotisCharalampous said:

Hi jayteasuk,

The sandbox environment is not supported anymore. Please use the production environment i.e. https://api.spotware.com/

Best Regards,

Panagiotis 

Join us on Telegram

 


@jayteasuk

jayteasuk
03 Oct 2020, 07:19

im trying to make my first connection using the below URL

https://sandbox-api.spotware.com/connect/profile?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

where xxx is my access_token from the play area but im getting the below error

{"error":{"errorCode":"CH_ACCESS_TOKEN_INVALID","description":"Invalid access token"}}


@jayteasuk

jayteasuk
02 Oct 2020, 10:26

RE:

PanagiotisCharalampous said:

Hi jayteasuk,

If you just want to use the application for your own purposes, you can generate a token using your application's playground and use it in your application.

Best Regards,

Panagiotis 

Join us on Telegram

thanks im a little further now

so i have to refresh my access token

the token says expires_in => 2628000

what does this value represent?


@jayteasuk