KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy Capstone Project Issue | 3. Data Analytics and Reporting

  • Capstone Project Issue | 3. Data Analytics and Reporting

    Posted by venu on May 5, 2022 at 12:00 am

    Hi,

    I have created the new table “tradeContext” as part of Capstone Project. I can see its successfully created and holds expected data. However,  the test 3.1 is keep failing with the below error.  How can we check what is exactly causing this error and resolve?

    3.1 Looking only at the last date in our database, create a new table tradeContext which has all the trade table information. This should have two extra columns – bid and ask – which contain the nbbo information for that particular trade option_id as at that trade time.

    –> Error

    >> exercise3.1 Fail “abort” “abort in before block due to error “date””

    venu replied 9 months, 3 weeks ago 2 Members · 5 Replies
  • 5 Replies
  • Laura

    Administrator
    May 5, 2022 at 12:00 am

    The database at /dbs is a date partitioned one meaning the partition domain (date in this case) is a virtual column and only visible when the database it loaded into memory. The method you have used is loading each partition separately.

    To load/map the entire database in correctly you can use l , for more resources for beginners to kdb+ databases and quick tips on working with them check out Q4Mortals

    l /dbs/

  • Laura

    Administrator
    May 5, 2022 at 12:00 am

    Hi Venu,

    The error is on the date column – check does it exist in your tradeContext table and is called date?

    >> exercise3.1 Fail “abort” “abort in before block due to error “date“”

     

    Thanks,

    Michaela

  • venu

    Member
    May 5, 2022 at 12:00 am

    Hi Michaela,

    Thanks for the quick reply. I just double checked. As per the following console output, the column name “date” of type “d” exist in tradeContext table and seems right.

     

    Venu

  • Laura

    Administrator
    May 5, 2022 at 12:00 am

    The structure does seem ok at a glance.

    One thing it might be is this 3.1 test does have a dependency on the trade table remaining unchanged :

    q)meta trade 
    c        | t f a 
    ---------| ----- 
    date     | d 
    option_id| s   p 
    trade_id | C 
    time     | t 
    price    | f 
    qty      | j 
    side     | s 
    edge     | f 
    exch_id  | j 
    broker_id| j

     

    If that also looks correct on your side can you please share your definition of tradeContext so I can further assist?

    Thanks

  • venu

    Member
    May 5, 2022 at 12:00 am

    The trade table does not have column called “date”.  I have loaded trade table using the below command.  Please advise if I am missing something.

    `:/dbs/2020.08.03/trade`:/dbs/2020.08.03/trade`:/dbs/2020.08.04/trade`:/dbs/2020.08.05/trade`:/dbs/2020.08.06/trade

     

     

    I have added date field to tradeContext separately using the following code.

    tradeContext:select date:date:2020.08.06+500?1,option_id,trade_id,time ,price,qty,side,edge,exch_id,broker_id,bid,ask from aj[`option_id`time;trade;nbbo]

     

    thanks

Log in to reply.