Hi, I have a question about the streaming prices and the TRD_VOL1 . As it is my understanding the TRD_VOL1 is the volume of the last trade.
I was checking if I get all updates for a security and so the total volume of all updates should be the same as the volume bar in my Eikon terminal. But here it doesnt add up, could you help me out what im doing wrong here?
When I run a streaming prices with the following code:
import eikon as ek
import datetime
ek.set_app_key(xxx)
totalvol=0
def display_updated_fields(streaming_price, instrument_name, fields):
global totalvol
current_time = datetime.datetime.now().time()
totalvol=totalvol+fields['TRDVOL_1']
print(current_time, "- Update received for", instrument_name, ":", fields)
print(f' totalvol @ {datetime.datetime.now()} was {totalvol}' )
streaming_prices = ek.StreamingPrices(
instruments = ['RDSa.AS'],
fields = ['TRDVOL_1'],
on_update = lambda streaming_price, instrument_name, fields :
display_updated_fields(streaming_price, instrument_name, fields),
)
while True:
streaming_prices.open()
I get as output:
11:23:56.157812 - Update received for RDSa.AS : {'TRDVOL_1': 169}
totalvol @ 2020-07-03 11:23:56.157812 was 303
11:23:57.800421 - Update received for RDSa.AS : {'TRDVOL_1': 299}
totalvol @ 2020-07-03 11:23:57.800421 was 602
11:24:04.215283 - Update received for RDSa.AS : {'TRDVOL_1': 100}
totalvol @ 2020-07-03 11:24:04.215283 was 702
11:24:30.747384 - Update received for RDSa.AS : {'TRDVOL_1': 63}
totalvol @ 2020-07-03 11:24:30.747384 was 765
11:24:33.958766 - Update received for RDSa.AS : {'TRDVOL_1': 145}
totalvol @ 2020-07-03 11:24:33.958766 was 910
11:24:35.233361 - Update received for RDSa.AS : {'TRDVOL_1': 250}
totalvol @ 2020-07-03 11:24:35.233361 was 1160
11:24:57.402145 - Update received for RDSa.AS : {'TRDVOL_1': 275}
totalvol @ 2020-07-03 11:24:57.402145 was 1435
11:25:02.335930 - Update received for RDSa.AS : {'TRDVOL_1': 92}
totalvol @ 2020-07-03 11:25:02.336927 was 1527
So the volume according to the streaming_prices addition is: 1435-602=833 shares
But looking at the Eikon graph it shows 5752 shares for this 11:24 minute.(11:23 was 5719 shares and 11:25 was 6902 shares according to the terminal chart)
So im not getting all updates processed with streaming prices i think. Any idea why im doing this wrong?
thanks!