Let’s quickly introduce a new topic tree before we go any further, which lends itself well to this use case. The Demo/Fx
topic tree is driven by this script: https://github.com/pushtechnology/topic-views-example. It pulls real market data from truefx.com to populate a tree of foreign exchange prices.
git clone https://github.com/pushtechnology/topic-views-example.git
npm install && npm start
Demos/Fx
Notice that the topics are named Demos/Fx/raw/0
, 1
, 2
, etc., and that each topic contains the field pairName
that holds a string giving a more understandable name for the particular currency trade, such as “EUR:USD”. In this example, we will use a topic view to create intuitively named reference topics using the pairName
values.
Discussion: It is not always possible to adjust the topic publishing habits of another Diffusion client: it may belong to a third party with different priorities. Using a topic view can quickly and pragmatically solve this problem.
Demos/Fx currency pairs
map ?Demos/Fx/raw/.* to Demos/Fx/<scalar(/pairName)>
Demos/Fx
to see the more intuitively named reference topics created by the topic view.Using the source value directive scalar()
we have built reference topics with more intelligible names, using values from within the source topic.