Topics
Replies
emahohaz
26 Jul 2023, 13:04
RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
PanagiotisChar said:
Hi there,
I am not sure what method you are looking for. You just need to send the relevant message. See the relevant examples on GitHub e.g. for C#
var spotRequest = new ProtoOASubscribeSpotsReq
{
CtidTraderAccountId = _accountID,
};spotRequest.SymbolId.Add(10003);
var message = new ProtoMessage
{
Payload = spotRequest.ToByteString(),
PayloadType = (int)ProtoOAPayloadType.ProtoOaSubscribeSpotsReq,
};Transmit(message);
I already know the example, but need a method in order to update a ProtoSpotevent variable so I can call its object and get the ask or bid price like this:
ProtoSpotevent objc =new ProtoSpotevent();
objc.ASK;
objc.BID;
@emahohaz
emahohaz
25 Jul 2023, 18:47
( Updated at: 26 Jul 2023, 10:45 )
RE: RE: RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
emahohaz said:
emahohaz said:
PanagiotisChar said:
Hi there,
Check ProtoOAReconcileReq. It returns all open positions and pending orders.
Need help? Join us on Telegram
and i have th efollowing question
To receive live bid/ask quotes for a symbol, perform the following actions.
- Initialise an object representing the
ProtoOASubscribeSpotsReq
message.- Fill the object properties with the
ctidTraderAccountId
, thesymbolId
, and, optionally, thesubscribeToSpotTimestamp
bool.- Send the newly created message and receive a response of the
ProtoOASubscribeSpotsRes
type. At this point, you are subscribed to live quotes data and you should receive messages of theProtoOASpotEvent
type.what type of method i need to call in order to receive the
ProtoOASubscribeSpotsRes
type
response ? maybe btnSubscribeForSpots_Click function ?
@emahohaz
emahohaz
25 Jul 2023, 14:51
RE: RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
emahohaz said:
PanagiotisChar said:
Hi there,
Check ProtoOAReconcileReq. It returns all open positions and pending orders.
Need help? Join us on Telegram
and i have th efollowing question
To receive live bid/ask quotes for a symbol, perform the following actions.
- Initialise an object representing the
ProtoOASubscribeSpotsReq
message.- Fill the object properties with the
ctidTraderAccountId
, thesymbolId
, and, optionally, thesubscribeToSpotTimestamp
bool.- Send the newly created message and receive a response of the
ProtoOASubscribeSpotsRes
type. At this point, you are subscribed to live quotes data and you should receive messages of theProtoOASpotEvent
type.what type of method i need to call in order to receive the
ProtoOASubscribeSpotsRes
type
response ? maybe btnSubscribeForSpots_Click function ?
thank you
@emahohaz
emahohaz
25 Jul 2023, 14:50
RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
PanagiotisChar said:
Hi there,
Check ProtoOAReconcileReq. It returns all open positions and pending orders.
Need help? Join us on Telegram
and i have th efollowing question
To receive live bid/ask quotes for a symbol, perform the following actions.
- Initialise an object representing the
ProtoOASubscribeSpotsReq
message.- Fill the object properties with the
ctidTraderAccountId
, thesymbolId
, and, optionally, thesubscribeToSpotTimestamp
bool.- Send the newly created message and receive a response of the
ProtoOASubscribeSpotsRes
type. At this point, you are subscribed to live quotes data and you should receive messages of theProtoOASpotEvent
type.
what type of method i need to call in order to receive the ProtoOASubscribeSpotsRes
type
response ? maybe btnSubscribeForSpots_Click function ?
@emahohaz
emahohaz
24 Jul 2023, 09:00
RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
PanagiotisChar said:
Hi there,
I would advice that you share some screenshots of what you are using and where do you get such an error from since you do not seem to use Open API.
Need help? Join us on Telegram
but now i'm wondering if there is any method that can allow me to get the positionID of the current open position/trade
@emahohaz
emahohaz
24 Jul 2023, 08:55
RE: How can i close a order buy or sell position in my ctrader account with OpenAPi?
PanagiotisChar said:
Hi there,
I would advice that you share some screenshots of what you are using and where do you get such an error from since you do not seem to use Open API.
Need help? Join us on Telegram
i fixed the problem , now i'm able to close postion correctly
@emahohaz
emahohaz
05 Nov 2022, 11:01
RE: RE:
ctid1980098 said:
emahohaz said:
hi, i was studying the Fix Api sample written in C# and i am wondering if anyobody can explain to me how Herbeatmessage and Testrequestmessage function works.I mean i understood what type of logic this function calls but not the real essence of them. How can i deploy them in order to get a continuos connection with my broker's server?
Hi emahohaz
I've just barely written my first FIX application so my answer may not be totally correct. Anyway this is what i use heartbeat messages for.
When logging into a price or trade stream I set my heartbeat to 30 seconds. This will send a heartbeat message every 30 seconds from server to me.
The reason i set this is to make sure I have a connection to the server. So on my client application i check to see if a heartbeat message has been received every 30 seconds.
If not, then i initiate a closing of the connection and attempt to reconnect to the server again. You can set the heartbeat time to even lower and continously check on your application if these messages are being received.
Note that you should respond to the heartbeat message when received as well.
Hope this helps
thank you for your help!!
much appreciated
@emahohaz
emahohaz
05 Nov 2022, 11:00
RE:
PanagiotisChar said:
Hi there,
Heartbeats are used to keep the connection alive when there is no other activity. If you fail to send a heartbeat, the server will eventually close the connection and you will need to connect and authenticate again.
Need help? Join us on Telegram
Need premium support? Trade with us
thank you!!
@emahohaz
emahohaz
28 Sep 2023, 17:36
RE: Request price multiple sysmbol
PanagiotisChar said:
thanks and how can i reach this task?
@emahohaz