How to get current Bid-Ask for the pair. spread?

Created at 04 Jul 2020, 08:42
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!
MZ

MZen

Joined 29.12.2014

How to get current Bid-Ask for the pair. spread?
04 Jul 2020, 08:42


I have read through Open API doc, yet could not see how I can get current Bid-Ask for the given pair. Without it we can not know spread. Do I miss something?

Also, it would be great to have Bid-Ask information in historical data, probably together with tick data. Is it possible?


@MZen
Replies

PanagiotisCharalampous
06 Jul 2020, 09:09

Hi MZen,

You need to subscribe to spot prices using ProtoOASubscribeSpotsReq. Then current bid and ask prices will be streamed to you.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

MZen
06 Jul 2020, 13:44

RE:

PanagiotisCharalampous said:

Hi MZen,

You need to subscribe to spot prices using ProtoOASubscribeSpotsReq. Then current bid and ask prices will be streamed to you.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi,

the spot stream looks like:

Send: ProtoMessage{SubscribeForSpotsRequest{}}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:112961, askPrice:112966}}
Received: ProtoMessage{SubscribeForSpotsResponse{}}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:112962, askPrice:       }}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:       , askPrice:112967}}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:112961, askPrice:       }}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:112962, askPrice:       }}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:       , askPrice:112968}}
Received: ProtoMessage{SpotEvent{symbolId:1, bidPrice:       , askPrice:112967}}
Send: ProtoMessage{UnsubscribeFromSpotsRequest{}}
Received: ProtoMessage{UnsubscribeFromSpotsResponse{}}

in every spot event message there is only one price: Bid or Ask. As I understand, those are spot prices, a.k.a ticks.

Let me clarify: Yes, transactions occur on bid or ask side, yet, current bid and ask - offers from buyers and sellers, can change, sometimes quickly, without  transactions and without spot event generated. So, spot price/tick in API spot event message is NOT current BID nor ASK.

So. the question is not how to get spot price, as you see I got it, but how to get current offers, sitting on bid and ask sides of the current spread.

Thank you


@MZen

PanagiotisCharalampous
06 Jul 2020, 14:05

Hi MZen,

Spot prices streamed through spot events represent exactly what you have described, the latest offers from buyers and sellers. So this is what you are looking for.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

MZen
06 Jul 2020, 14:22

RE:

PanagiotisCharalampous said:

Hi MZen,

Spot prices streamed through spot events represent exactly what you have described, the latest offers from buyers and sellers. So this is what you are looking for.

Best Regards,

Panagiotis 

Join us on Telegram

Sorry to bother you, but were are ticks? The prices at which transactions occurred?

Thank you


@MZen

PanagiotisCharalampous
06 Jul 2020, 14:26

Hi MZen,

You are misundestanding ticks. Ticks represent current offers to buy and sell. In OTC markets executed trades are not available since trading takes place over the counter between two counterparties rather than on a centralized exchange.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

MZen
06 Jul 2020, 14:39

RE:

PanagiotisCharalampous said:

Hi MZen,

You are misundestanding ticks. Ticks represent current offers to buy and sell. In OTC markets executed trades are not available since trading takes place over the counter between two counterparties rather than on a centralized exchange.

Best Regards,

Panagiotis 

Join us on Telegram

Got it.

In CTrader there is last price and volume in tick charts along with current bid-ask. That is why I got confused.

Thank you.


@MZen

csafx1
17 Oct 2024, 23:52 ( Updated at: 18 Oct 2024, 05:19 )

Historical Bid/Ask prices for pair are not synced by timestamp

I am using the Open API to get historical tick data (ProtoOAGetTickDataReq). It doesn't allow me to obtain the Bid / Ask prices together, and so I populate a Bid and Ask table with the respective returned data for each call. Some of the price points match on symbol and unix timestamp,  but many other do not. In reconciling the Bid and Ask prices, what is the process (outside of a actual match on symbol and timestamp), in resolving the other price data. Is there an approximate formula used or something else?


@csafx1

PanagiotisCharalampous
18 Oct 2024, 05:58

RE: Historical Bid/Ask prices for pair are not synced by timestamp

csafx1 said: 

I am using the Open API to get historical tick data (ProtoOAGetTickDataReq). It doesn't allow me to obtain the Bid / Ask prices together, and so I populate a Bid and Ask table with the respective returned data for each call. Some of the price points match on symbol and unix timestamp,  but many other do not. In reconciling the Bid and Ask prices, what is the process (outside of a actual match on symbol and timestamp), in resolving the other price data. Is there an approximate formula used or something else?

Hi there,

Bid and ask prices are independent from each other. Sometimes are updated together but most of the times they are updated separately.

Best regards,

Panagiotis


@PanagiotisCharalampous

csafx1
18 Oct 2024, 17:37

RE: RE: Historical Bid/Ask prices for pair are not synced by timestamp

PanagiotisCharalampous said: 

csafx1 said: 

I am using the Open API to get historical tick data (ProtoOAGetTickDataReq). It doesn't allow me to obtain the Bid / Ask prices together, and so I populate a Bid and Ask table with the respective returned data for each call. Some of the price points match on symbol and unix timestamp,  but many other do not. In reconciling the Bid and Ask prices, what is the process (outside of a actual match on symbol and timestamp), in resolving the other price data. Is there an approximate formula used or something else?

Hi there,

Bid and ask prices are independent from each other. Sometimes are updated together but most of the times they are updated separately.

Best regards,

Panagiotis

Thank you for the prompt response and clarification. So in an effort to facilitate back testing with the historical tick data in Open Api, similar to the OnTick event in cautomate, is it safe to say the cbot OnTick event simply raises the OnTick event with an SymbolTickEventArgs obj as soon as it has both an Ask and Bid price?


@csafx1

PanagiotisCharalampous
19 Oct 2024, 05:02

RE: RE: RE: Historical Bid/Ask prices for pair are not synced by timestamp

csafx1 said: 

PanagiotisCharalampous said: 

csafx1 said: 

I am using the Open API to get historical tick data (ProtoOAGetTickDataReq). It doesn't allow me to obtain the Bid / Ask prices together, and so I populate a Bid and Ask table with the respective returned data for each call. Some of the price points match on symbol and unix timestamp,  but many other do not. In reconciling the Bid and Ask prices, what is the process (outside of a actual match on symbol and timestamp), in resolving the other price data. Is there an approximate formula used or something else?

Hi there,

Bid and ask prices are independent from each other. Sometimes are updated together but most of the times they are updated separately.

Best regards,

Panagiotis

Thank you for the prompt response and clarification. So in an effort to facilitate back testing with the historical tick data in Open Api, similar to the OnTick event in cautomate, is it safe to say the cbot OnTick event simply raises the OnTick event with an SymbolTickEventArgs obj as soon as it has both an Ask and Bid price?

No, OnTick is raised whenever any of the two prices is updated.


@PanagiotisCharalampous

csafx1
03 Nov 2024, 23:48

RE: RE: RE: RE: Historical Bid/Ask prices for pair are not synced by timestamp

PanagiotisCharalampous said: 

csafx1 said: 

PanagiotisCharalampous said: 

csafx1 said: 

I am using the Open API to get historical tick data (ProtoOAGetTickDataReq). It doesn't allow me to obtain the Bid / Ask prices together, and so I populate a Bid and Ask table with the respective returned data for each call. Some of the price points match on symbol and unix timestamp,  but many other do not. In reconciling the Bid and Ask prices, what is the process (outside of a actual match on symbol and timestamp), in resolving the other price data. Is there an approximate formula used or something else?

Hi there,

Bid and ask prices are independent from each other. Sometimes are updated together but most of the times they are updated separately.

Best regards,

Panagiotis

Thank you for the prompt response and clarification. So in an effort to facilitate back testing with the historical tick data in Open Api, similar to the OnTick event in cautomate, is it safe to say the cbot OnTick event simply raises the OnTick event with an SymbolTickEventArgs obj as soon as it has both an Ask and Bid price?

No, OnTick is raised whenever any of the two prices is updated.

Ah! I see. Now that makes a lot of sense. Thanks again


@csafx1