cancel
Showing results for 
Search instead for 
Did you mean: 

Question on streaming

MSHK
New Contributor II

I have a question. Having a data source publishing real time quotes(bid price and ask price), I want to subscribe it and plot the mid price(0.5*bid+0.5*ask) using the streaming mode.  How to do it please? As shown in the picture, it seems only one filter can be applied to the streaming data source and no calculation can be done.

3 ACCEPTED SOLUTIONS

lkerr
New Contributor III
New Contributor III

Hi MSHK, thanks for your question!

Have you seen the documentation on streaming queries at: https://code.kx.com/dashboards/datasources/ ?

Further down the page there is more information on Subscriptions using the streaming or auto-execute functionality. 

Hope this helps!

Laura

View solution in original post

dfallon
New Contributor III
New Contributor III

Hi MSHK,

If you haven’t already, take a look at the example we have for setting up a streaming process.

The screenshot you show for quote.bond has an input parameter exposed to Kx Dashboards, which is defined in your kdb streaming query.  More than one filter can be made available if required, but usually it’s a time series pull for a single asset – so only one such query parameter is exposed.  

Your streaming query should have the necessary bid and ask calculations, results of which are then pushed to the Dashboards.  The query handles the calculations returned in the Results pane when you Execute it.  There is a Key by dropdown as part of the streaming options for Dashboards (drawn from the data columns in your query), one of which should be time or date.

Dashboards only handles the filters from the query and the data key by, it doesn’t do the underlying bid, ask calculation.

Take a look at our latest 1.4. release, which you download from here.   We have an upgraded version of Document Graph to help manage your queries and view states, this makes it easier for Dashboard users to work with large numbers of queries and/or view states without having to go through the component UI.

Thanks,

Declan

View solution in original post

MSHK
New Contributor II

Hi Dfallon,

I would like to follow up on my question. I am not using query mode but streaming mode.

As in the screenshot shows, there is no place to place query. How can I filter the streaming source and keeps cgb10y data only?

Appreciate your help pls.

 

View solution in original post

11 REPLIES 11

lkerr
New Contributor III
New Contributor III

Hi MSHK, thanks for your question!

Have you seen the documentation on streaming queries at: https://code.kx.com/dashboards/datasources/ ?

Further down the page there is more information on Subscriptions using the streaming or auto-execute functionality. 

Hope this helps!

Laura

View solution in original post

dfallon
New Contributor III
New Contributor III

Hi MSHK,

If you haven’t already, take a look at the example we have for setting up a streaming process.

The screenshot you show for quote.bond has an input parameter exposed to Kx Dashboards, which is defined in your kdb streaming query.  More than one filter can be made available if required, but usually it’s a time series pull for a single asset – so only one such query parameter is exposed.  

Your streaming query should have the necessary bid and ask calculations, results of which are then pushed to the Dashboards.  The query handles the calculations returned in the Results pane when you Execute it.  There is a Key by dropdown as part of the streaming options for Dashboards (drawn from the data columns in your query), one of which should be time or date.

Dashboards only handles the filters from the query and the data key by, it doesn’t do the underlying bid, ask calculation.

Take a look at our latest 1.4. release, which you download from here.   We have an upgraded version of Document Graph to help manage your queries and view states, this makes it easier for Dashboard users to work with large numbers of queries and/or view states without having to go through the component UI.

Thanks,

Declan

View solution in original post

MSHK
New Contributor II

Thanks. So should I do the calculation on bid and ask in some file like stream.q (in your demo)? And publish the result to dashboard?

dfallon
New Contributor III
New Contributor III

Yes, you want to run the calculation in q before pushing it to Dashboards. 

MSHK
New Contributor II

Thanks for your answer. I have developed q scripts and published my own data, and my streaming data look like this (please see screenshot attached).

My “Product” column contains cgb5y, cgb10y and etc.  How do I filter the streaming data only for cgb10y in the following screen? I just enter “cgb10y” in box after symbol??

MSHK
New Contributor II

 

My “Product” column contains cgb5y, cgb10y and etc.  How do I filter the streaming data only for cgb10y in the following screen? I just enter “cgb10y” in box after symbol??

Please see File 1 and File 2. Thanks

dfallon
New Contributor III
New Contributor III

Yes, assuming you have in your streaming kdb query {[x] ... ... where Product in x}.  Then x as your Dashboard input is the value from the Product, "cgb10y" etc.  Your value for "x" should then be assigned to a view state parameter in Dashboards, so it can be used as part of a dropdown. 

MSHK
New Contributor II

Thanks, but I am not using query. I am using the streaming mode instead, so there is no place to enter query. How should I do then?

MSHK
New Contributor II

Thanks, but I am not using query. I am using the streaming mode instead, so there is no place to enter query. How should I do then?

MSHK
New Contributor II

Hi Dfallon,

I would like to follow up on my question. I am not using query mode but streaming mode.

As in the screenshot shows, there is no place to place query. How can I filter the streaming source and keeps cgb10y data only?

Appreciate your help pls.

 

View solution in original post

dfallon
New Contributor III
New Contributor III

Apologies,

In your stream setup you need to define [x].  

The easiest guide for you is to perhaps look at the demo.q file inside the /sample/ directory which hosts the streaming examples which come with dashboards.  There are four streaming data sets which use [x]: book, book1Agg, book2Agg and stream.  If you use them as a template to your streaming example you should be able to set [x] as a filter. 

You can test these four examples in the dashboard by using an FX symbol like EUR/USD.

Hope this helps,
Declan