While working on part 3 of the fundamental capstone, I run into an issue where the test for Q 3.3 fails (see result.png). The rest of the subsequent tests are passed, despite them utilising the results from the failed 3.3 code.
I have attached the code for 3.1 to 3.3 (see Q3 code.png) for reference. I have also attached the metadata for the badTrades table (see meta.png), in the case that the error lies with the datatypes.
Any ideas where the error may be coming from would be incredibly helpful.
asize and bsize are the last two columns in the nbbo (new_nbbo) table (see asize_bsize.png). I remove them to create the tradeContext table, as the table shown in the markdown as a sample does not have these two columns.
Int_table is the resultant table after running the asof join on the trade and nbbo tables. It still has the asize and bsize columns (see int_table.png). I have included the metadata for the int_table (see int_table metadata.png).
Ah yes, apologies my bad. First of all, the question states that we need all of the trade data but only the two extra columns from the nbbo table (bid and ask).
If you take a look at the sample data, the only two matching columns between the two tables are option_id and time. So we can rule date out of the equation when joining.
Secondly, it states we need to the last date in the database. We can achieve this by using:
where date = last date
In our select queries. Using these tips, try and recreate the tradeContext table and send me the results either on this thread or by private message :)
While the sample data schema for nbbo has no date column, the nbbo table that is provided for the exercise has one, with four distinct dates (see nbbo_table.png). If I then exclude the `date column while running aj[], the test for exercise 3.1 (whether tradeContext Has Correct Format) is failed.
After using the "where date = last date" clause, the table is as seen in the image tradeContext.png. However, the code for exercise 3.3 (creating badTrades table) still fails with the error "abort in before block due to error \"type\"". Despite the fail at 3.3, the rest of the tests are passed.
Failing code snippet:
badTrades:select from classifyTrade[tradeContext] where exQuality=0b