Live monitoring for Close prices
Live monitoring for Close prices
08 Mar 2022, 06:49
Hi,
We are developing an app that needs to monitor live low/high/open/close prices for a given Symbol and Period size.
It is implemented by subscribing to LiveTrendbar and listening to ProtoOASpotEvent events.
Im testing the implementation using ETHUSD M1 in Demo account and I've noticed that ProtoOATrandBar doesn't have deltaClose set for live events.
It's important for me to get a close Price for each Period. So since there is no deltaClose I'm using deltaOpen. But this way the price of the last event of the period(based on low and deltaOpen) doesn't match close price I get for that period when I call ProtoOAGetTrendbarsReq.
Is it a limitation of Demo account that I don't get all events? What would be a more reliable way for me to get live close prices?
Cheers
Replies
kostya.bartchenkov
08 Mar 2022, 12:00
RE:
amusleh said:
Hi,
The delta close is not included because it's already there, the latest bid price that you get from spot event.
If you use the latest bid price as close price for current bar then it should match with the ProtoOAGetTrendbarsReq result.
Amusleh, thanks a lot for a prompt reply. I think something doesn't add up.
I just ran an this example. Below is historic tredbar:
volume: 150
low: 257175000
deltaOpen: 120000 = 2572.95000
deltaClose: 200000 = 2573.75000
deltaHigh: 290000 = 2574.65000
utcTimestampInMinutes: 27445532
And this is the last live ProtoOASpotEvent for the period:
symbolId: 10029
bid: 257295000
ask: 257995000
trendbar { volume: 2 period: M1 low: 257295000 deltaOpen: 0 deltaHigh: 0 utcTimestampInMinutes: 27445532 }
And this is what i get from CTrade Mobile App(which matches historical data):
low: 2571.75
high: 2574.65
open: 2572.95
close: 2573.75
So the bid from the last ProtoOASpotEvent doesn't seem to match the close price.
@kostya.bartchenkov
amusleh
09 Mar 2022, 10:16
( Updated at: 09 Mar 2022, 10:25 )
Hi,
I just tested on a Spotware beta demo account for EURUSD, and the results were matching.
M1 Bar data on cTrader:
Open: 1.09257
Low: 1.09244
High: 1.09263
Close: 1.09261
API Bar Data:
{ "ctidTraderAccountId": "19188459", "symbolId": "1", "bid": "109261", "ask": "109262", "trendbar": [ { "volume": "207", "period": "M1", "low": "109244", "deltaOpen": "13", "deltaHigh": "19", "utcTimestampInMinutes": 27446889 } ] }
And ETH/USD test:
M1 Bar data on cTrader:
Open: 2,729.796
Low: 2,729.675
High: 2,732.071
Close: 2,731.171
API Bar Data:
{ "ctidTraderAccountId": "19188459", "symbolId": "22397", "bid": "273117100", "ask": "273144500", "trendbar": [ { "volume": "172", "period": "M1", "low": "272967500", "deltaOpen": "12100", "deltaHigh": "239600", "utcTimestampInMinutes": 27446900 } ] }
The spot event message is the latest received event for that bar.
@amusleh
kostya.bartchenkov
09 Mar 2022, 14:55
RE:
Everything is working now. Thanks a lot for your help @amusleh
@kostya.bartchenkov
amusleh
08 Mar 2022, 09:21
Hi,
The delta close is not included because it's already there, the latest bid price that you get from spot event.
If you use the latest bid price as close price for current bar then it should match with the ProtoOAGetTrendbarsReq result.
@amusleh