cancel
Showing results for 
Search instead for 
Did you mean: 

Question on streaming

MSHK
New Contributor

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.

2 ACCEPTED SOLUTIONS

lkerr
Moderator Moderator
Moderator

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

8 REPLIES 8

lkerr
Moderator Moderator
Moderator

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

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

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

 

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

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?