Fundamental Capstone 2.3

Hi,

For fundamental capstone, I keep failing the exercise 2 testing on exercise 2.3. But my extractBrokerId function pass the test and the updated messages table also looks fine in console. 

I am wondering is there anything I missed or there is a bug in the test function?

I’d appreciate any help. Thanks in advance.

FYI. my code for 2.3 is 

 

update broker_id:{extractBrokerId string x}each exch_message from `messages

and the updated table looks like

trade_id exch_message broker_id -------------------------------------------- 1 CME-KO20200720C55-706 706 2 CME-TSLA20201120C1800-709 709 3 CME-TSLA20210120P1500-709 709 4 ISE-700-TSLA20210120C1800 700 5 ISE-701-TSLA20201120C1700 701 6 ISE-705-TSLA20201120P1600 705 7 CME-TSLA20201120P1400-706 706 8 ISE-703-TSLA20201120C1600 703 9 ISE-707-KO20201120P45 707 10 CME-FB20200920C250-703 703 11 ISE-702-TSLA20201120C1500 702 12 CME-FB20200920P260-709 709 13 ISE-707-TSLA20200720P1500 707 14 CME-KO20201120C55-702 702

 

Does the previous quke test for extractBrokerId Pass?

 

*Note: A template has been created in FP.Functions if desired. Once defined, run the
corresponding test file (functionName.quke) to test if working correctly*.

 

When I ran your code above at this same stage with my version of  extractBrokerId I got a type error so expect the definitions of  extractBrokerId differ - can you share your version so I can better assist? Feel free to send in DM if you prefer

 

Thanks,

Michaela

 

 

 

Hi Michaela,

Thanks for the reply.

Yes, I have passed the quke test for extractBrokerId and that’s where makes me confused

 

Sure, I can share my version of extractBrokerId.

extractBrokerId:{ prefix:3#x; $[prefix~“CME”;:“J”$-3#x;“J”$3#(4_x)] }

Again, thanks for the help.

 

I don’t know how far this gets you, but your extractBrokerId can be rewritten as

q){“J”$-3#$[“CME”~3#x;x;7#x]}each(“CME foo 123”;“XYZ 456 blah”) 123 456

I also wonder if you need to apply string to the exch_message column? If you do – for example, if exch_message is symbols – then it can be applied without the each.

q)string abcdef “abc” “def”

 

Thanks for the reply.

I think yes string & each is needed since we are using it in qSQL, it won’t take it as what we usually do in function. Also, because of each , it will convert column value into symbol type.