0

I have a ticker plant that has the schema:

quote:([]time:(); sym:();expiration:();mtype:();price:();cond:();exchange:();volume:())
trade:([]time:(); sym:();expiration:();mtype:();price:();cond:();exchange:();volume:())
rfills:([]time:();sym:();expiration:();tag:();price:();volume:())

I then double check the schema by doing

meta trade

table schema

I subscribe to the tickerplant as such getting the trade table

h(`.u.sub;`trade;`)

But when I try to specify a symbol from sym by doing

h(`.u.sub;`trade;`ZB)

No records are being pushed, This is odd because when I subscribe to all syms you can see that `ZB is definitely sym being pushed as shown below after setting upd to show enter image description here

Figured out the above question, as a single record was being pushed not a table or key-value pair.This is what is going on. So I was publishing a single record not a table from qSharp:

string giantstring2 = ".u.upd[" + "`trade;" + qdatetime + "," + rsymbol + "," + rexp + "," + qtype + "," + qprice + "," + qcondition + "," + qexchange + "," + qvolume + "  ]";
 q.Async(giantstring2);

I then set .u.upd to be .u.pub . So clients are recieve the single record but since its not a table nor a key value pair it doesn't grab the sym. So then I decided to change .u.upd to be

.u.upd:{[tabname;tabdata]
            tabname insert tabdata;
            tabd1::tabdata;
             r2:: last (eval tabname);
            .u.pub[tabname; r2];
                };

So now subscribing by sym works however there is another issue, now it keeps publishes the entire table not just the record. Thinking of how to make this do what I want however I'm not sure how to go about it. Upon investigation of the .u.pub function

{[t;x]{[t;x;w]if[count x:sel[x]w 1;(neg first w)(`upd;t;x)]}[t;x]each w t}

It looks like it goes through the table and publishes each record. I assume I can edit this to just submit the last record and everything should work how I expect it to. Although I am unsure how to that. Any ideas? I assume I need to change the each w t part to only grab the last record and not the entire table

Rtrader
  • 917
  • 4
  • 11
  • 26
  • Are you using the default/untouched tickerplant code from Kx? Has the code been modified in any way? Can you see your subscription for `ZB in the ".u.w" dictionary in the tickerplant? – terrylynch Aug 08 '16 at 15:17
  • @terrylynch I believe so, when I evaluate .u.w from the tickerplant I get this prntscr.com/c34gle – Rtrader Aug 08 '16 at 15:36
  • 1
    Hmmm, looks right. Are your .u.pub and .u.sel functions the same as in http://code.kx.com/wsvn/code/kx/kdb%2Btick/tick/u.q ? Are you certain that a `ZB message came in since you've been subscribed?? It could be very illiquid for example – terrylynch Aug 08 '16 at 15:58
  • @terrylynch yep my u.pub and u.sel are the same as in u.q . I'm positive I see updates coming through when I subscribe to all syms just not when I try to subscribe to one – Rtrader Aug 08 '16 at 16:00
  • what you have *should* work. Things to check - the schema (in the TP) has a `sym column? Are you dynamically getting your schema from the return value of the .u.sub call? Did you set your upd back to "insert" ? – terrylynch Aug 09 '16 at 12:10
  • is your .z.ps doing anything funny with incoming messages? – terrylynch Aug 09 '16 at 12:15
  • @terrylynch this is very mind boggling, in the TP the schema has a `sym column, I dynamically get the schema by doing the .u.sub call. upd is not set to insert for testing purposes I set upd to show. However whats odd is sometimes when I evaluate .z.w I dont see any of the syms shown here: http://prntscr.com/c3ibyr and sometimes I only see one or two syms any idea? – Rtrader Aug 09 '16 at 12:48
  • are you re-opening connections again from the same process? In other words, you should only "hopen" once. It looks like your TP is losing one subscriber but gaining another – terrylynch Aug 09 '16 at 13:21
  • @terrylynch figured out what was happening however now I have another issue lol. Any idea how to solve it? – Rtrader Aug 17 '16 at 16:38
  • To be honest, I don't understand why you're making ANY changes to the tickerplant. The standard Kx-provided tickerplant has been tested and refined over years and years and you should really not be changing a single thing about it!! It's also making it too hard for people to help you because you're not working with a standard tickerplant. With regards to your second issue - are you using "batched mode" in the tickerplant? i.e. Did you set a timer from the command line? If not, I don't see how it can publish the whole table since the TP doesn't store tables in memory in non-batched mode – terrylynch Aug 18 '16 at 11:05

0 Answers0