It keeps saying that badTrades.csv does not have the correct values
Should I remove the rows which nulls for bid and ask
It keeps saying that badTrades.csv does not have the correct values
Should I remove the rows which nulls for bid and ask
Can you share which error you are getting?
If its 3.3. that is failing - check in exercise 3.2 you should have added a way to identify good trades from bad (exQuality) - you should use this identifier to create your badTrades tables.
I did the following to classify:
somefunction:{[bit] $[((get bitside)=
B);[((bitask)\>=(bit
price))];[((bitprice)\>=(bit
bid))]]}
somefunction each tradeContext
classifyTrades:{[tc] tc:update exQuality:(somefunction each tc) from tc }
tradeContext:classifyTrades[tradeContext]
I then made badTrades by doing this:
badTrades:select from somethingelse where exQuality=0b
There was some rows included in badTrades because bsize/asize has a null, should I have removed them by doing:
delete from `badTrades where bid=0Nj
Can you share which error you are getting? It would be useful if you paste output of testSection[`exercise3] please
exercise3.1 Pass “tradeContext Is Defined In Process” “”
exercise3.1 Pass “tradeContext Has Correct Format” “”
exercise3.3 Pass “badTrades Is Defined In Process” “”
exercise3.3 Pass “bad Trades Has Correct Format” “”
exercise3.4 Pass “badTrades Is Saved In Correct Dir” “”
exercise3.4 Fail “Contents Of CSV File Is Correct” “”
Thanks for sharing the error - i can tell from this the issue is not badTrades table - its just an issue with the csv file itself.
Can you try saving file to csv using save command and let me know if that works? I think it might be an issue if you are using Table Exporter to save the file.
I tried that but still no luck here is what is in the csv file
“date,option_id,trade_id,time,price,qty,side,edge,exch_id,broker_id,bid,ask,exQuality”
“2020.08.06,FB20200920C260,"6",09:30:14.159,37.09572,41,B,15.20924,4,703,0”
“2020.08.06,FB20200920P230,"40",09:37:15.300,28.21593,84,S,174.4279,3,701,28.22,29.25,0”
“2020.08.06,FB20200920P230,"304",13:42:07.309,4.032175,96,B,-110.9011,3,700,3.98,4.03,0”
“2020.08.06,FB20201120C230,"88",10:12:47.120,33.95892,76,S,-37.94042,3,707,33.98,34.64,0”
“2020.08.06,FB20201120P250,"251",12:53:24.261,33.08877,22,B,58.23336,4,706,32.82,33.08,0”
“2020.08.06,FB20201120P260,"87",10:11:53.322,43.35913,13,S,6.692775,4,706,43.4,44.56,0”
“2020.08.06,FB20201120P270,"71",09:56:21.871,61.85682,35,B,42.93956,4,707,60.93,61.83,0”
“2020.08.06,KO20200920C40,"2",09:30:03.699,38.03381,99,B,-94.13367,4,700,0”
“2020.08.06,KO20200920C40,"73",09:56:40.800,74.93418,85,S,255.5233,3,706,74.94,75.06,0”
“2020.08.06,KO20200920C50,"283",13:24:11.628,18.36614,3,B,-2.702428,4,701,17.78,18.34,0”
“2020.08.06,KO20200920P40,"313",13:50:13.733,28.12304,12,B,-14.89324,3,700,27.99,28.12,0”
“2020.08.06,KO20200920P45,"10",09:30:21.146,86.25692,67,B,115.5843,4,708,0”
“2020.08.06,KO20200920P50,"20",09:31:11.529,21.65767,67,B,-14.51064,3,701,0”
“2020.08.06,KO20200920P50,"190",11:49:04.301,96.34223,42,B,28.91396,4,708,95.79,96.34,0”
“2020.08.06,KO20201120C45,"262",13:04:57.594,57.4039,27,B,42.99669,4,705,56.74,57.4,0”
“2020.08.06,KO20201120C45,"390",14:59:31.581,23.71258,97,B,-66.82182,4,700,22.39,23.69,0”
“2020.08.06,KO20201120P55,"142",10:52:10.106,55.65839,68,B,172.7843,3,703,54.89,55.64,0”
“2020.08.06,TSLA20200720C1800,"265",13:06:28.251,48.96278,33,S,15.76616,4,702,48.97,49.12,0”
“2020.08.06,TSLA20200720P1400,"14",09:30:45.796,74.33824,90,B,27.00197,4,706,73.6,74.33,0”
“2020.08.06,TSLA20200720P1400,"297",13:39:13.625,91.11654,80,B,30.67067,3,705,90.21,91.11,0”
“2020.08.06,TSLA20200720P1600,"471",15:54:39.919,54.24869,58,B,50.87546,4,709,53.85,54.23,0”
“2020.08.06,TSLA20200920C1400,"201",11:59:52.897,38.8397,100,S,50.64982,3,706,38.84,39.24,0”
“2020.08.06,TSLA20200920P1800,"218",12:14:02.878,0.5626608,62,S,16.71552,4,701,0.57,1.25,0”
“2020.08.06,TSLA20201120C1700,"174",11:25:51.053,77.57951,24,S,0.9601812,3,707,77.58,78.67,0”
“2020.08.06,TSLA20201120P1500,"387",14:55:43.492,72.35265,26,B,0.8976449,4,705,71.84,72.34,0”
“2020.08.06,TSLA20201120P1600,"147",11:00:24.997,77.83385,52,B,195.715,4,703,76.93,77.81,0”
“2020.08.06,TSLA20201120P1800,"13",09:30:28.705,24.96841,66,B,49.43746,4,706,0”
“2020.08.06,TSLA20210120C1800,"4",09:30:06.940,51.09677,97,B,-99.12774,4,701,0”
“2020.08.06,TSLA20210120P1600,"125",10:44:08.619,50.01014,54,B,-10.50624,4,702,49.99,50.01,0”
looks like you are almost there. Here is badTrades as kdb table in memory and what I get after running save and reading back in. One thing I spot that looks different is trade_id
Yes, the only difference seems to be in my CSV the “string quotes” (") are escaped?