Capstone Fundamentals 2.3 (continuation)

Continuing from the discussion here: https://community.kx.com/t5/KX-Academy/Fundamentals-Cpastone-1-7/m-p/15117/emcs_t/S2h8ZW1haWx8dG9waWNfc3Vic2NyaXB0aW9ufExPR1JNS0FQUjlUWVpEfDE1MTE3fFNVQlNDUklQVElPTlN8aEs#M602

 

Hi @kdbguru  

(sorry the ‘b’ was a typo in the function). 

I have tried your code and it still has a mismatched types error. My table looks fine but does not pass the end-of-section test for 'messages in the correct format. Let me put all my code regarding messages:

1.  Load from csv. 

messages: (“*S”; enlist csv) 0: hsym `$csvPath;

which looks like

trade_id exch_message ---------------------------------- ,“1” CME-KO20200720C55-706 ,“2” CME-TSLA20201120C1800-709 ,“3” CME-TSLA20210120P1500-709 ,“4” ISE-700-TSLA20210120C1800 ,“5” ISE-701-TSLA20201120C1700 ,“6” ISE-705-TSLA20201120P1600

 

  1. Define function: 

extractBrokerId :{partstr:"-"vs x;$[“CME” like first partstr;“J”$last partstr;“J”$partstr 1]}

3.  

show messages: update broker_id:extractBrokerId each exch_message from messages

which returns a mismatched error type.  This goes away if I put ‘each string exch_message’

which returns the correct table but with ‘broker_id’ in short datatype. I have then proceeded to convert the column into a long using 

messages: update trade_id: “J”$trade_id from messages

 Now the table looks perfect, but it still doesn’t pass the test. 

Any help is appreciated! Thanks! 

-C

Hi ,

I believe your error lies when loading in the messages csv. As I mentioned in the previous post, if you check the trade table (screenshot below) you’ll see that trade_id is a string and the question states exch_id needs to also be read in as a string. Do this we use this character - *.

So to adjust your code you will need:

 

messages: (“**”; enlist csv) 0: hsym `$csvPath;

 

This should resolve your issues but if it doesn’t let me know,

Megan