cancel
Showing results for 
Search instead for 
Did you mean: 

Capstone Project Issue| 3. Data Analytics and Reporting (Fail "tradeContext Has Correct Format")

ziong
New Contributor

Hi all,

I fail in a test case on exercise 3.1 "tradeContext Has Correct Format", test report as below:

testSection[`exercise3]

 

quizItem    success description                          error                                                                                                                                                   
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
exercise3.1 Pass    "tradeContext Is Defined In Process" ""                                                                                                                                                      
exercise3.1 Fail    "tradeContext Has Correct Format"    ""                                                                                                                                                      
exercise3.3 Pass    "badTrades Is Defined In Process"    ""                                                                                                                                                      
exercise3.3 Fail    "bad Trades Has Correct Format"      ""   
exercise3.4 Fail    "abort"                              "abort in before block due to error \"/developer-1.5.0-linux/workspace/__nouser__/funds_capstone/badTrades.csv. OS reports: No such file or directory\""

 

i cross-checked with the project description, seems everything looks good.

(example from project description)

date option_id trade_id time price qty side edge exch_id broker_id bid ask
2020.08.06 FB20200720C230 "258" 13:01:30.268 22.82637 99 S -230.8243 4 705 44.55 45.9
2020.08.06 KO20201120P55 "142" 10:52:10.106 55.65839 68 B 172.7843 3 703 77.74 78.74

 

meta tradeContext (tradeContext's schema)

 

c        | t f a
---------| -----
date     | d    
option_id| s    
trade_id | C    
time     | t    
price    | f    
qty      | j    
side     | s    
edge     | f    
exch_id  | j    
broker_id| j    
bid      | f    
ask      | f  

 

5#tradeContext (sample data)

 

date       option_id      trade_id time         price    qty side edge      exch_id broker_id bid   ask  
---------------------------------------------------------------------------------------------------------
2020.08.03 FB20200720C230 "37"     09:40:54.492 22.89417 27  B    48.54252  3       708       22.66 23.04
2020.08.03 FB20200720C230 "74"     10:00:36.511 20.99512 94  B    363.9133  4       708       20.88 21.44
2020.08.03 FB20200720C230 "113"    10:25:05.502 5.925473 26  S    -18.60517 4       703       5.89  6.18 
2020.08.03 FB20200720C230 "185"    11:28:44.556 27.83063 94  B    104.0323  4       705       27.81 28.1 
2020.08.03 FB20200720C230 "275"    13:13:27.811 76.05747 38  B    -3.428841 3       705       75.96 76.2

 

I have no idea which columns go wrong, anyone can give me some hits?

Thanks.

Franky

 

 

8 REPLIES 8

ziong
New Contributor

Dear all,

I fixed it.

for those who encounter the same issue, there is the correct schema:

meta tradeContext 

 

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    
bid      | f    
ask      | f    

 

 good luck

ashish31
New Contributor III

 

t:select from trade
n:select date,option_id,time,bid,ask from nbbo
meta tradeContext:aj[`date`option_id`time;  t;n]
tradeContext:`option_id xkey tradeContext
5#tradeContext

option_id     | date       trade_id time         price    qty side edge      exch_id broker_id bid   ask  
--------------| ------------------------------------------------------------------------------------------
FB20200720C230| 2020.08.03 "37"     09:40:54.492 22.89417 27  B    48.54252  3       708       22.66 23.04
FB20200720C230| 2020.08.03 "74"     10:00:36.511 20.99512 94  B    363.9133  4       708       20.88 21.44
FB20200720C230| 2020.08.03 "113"    10:25:05.502 5.925473 26  S    -18.60517 4       703       5.89  6.18 
FB20200720C230| 2020.08.03 "185"    11:28:44.556 27.83063 94  B    104.0323  4       705       27.81 28.1 
FB20200720C230| 2020.08.03 "275"    13:13:27.811 76.05747 38  B    -3.428841 3       705       75.96 76.2 

meta tradeContext
c        | t f a
---------| -----
option_id| s    
date     | d    
trade_id | C    
time     | t    
price    | f    
qty      | j    
side     | s    
edge     | f    
exch_id  | j    
broker_id| j    
bid      | f    
ask      | f    
quizItem    success description                          error
--------------------------------------------------------------
exercise3.1 Pass    "tradeContext Is Defined In Process" ""   
exercise3.1 Fail    "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 Pass    "Contents Of CSV File Is Correct"    ""   

Please help me on this.

 

Michaela
Community Manager Community Manager
Community Manager

hi @ashish31 Your schema looks incorrect, see comment above for correct schema

Michaela_0-1689260455510.png

 

ashish31
New Contributor III

I tried to update the schema with below 

tradeContext:`option_id xkey tradeContext

but still the meta shows it with out key

 

meta tradeContext
c        | t f a
---------| -----
option_id| s    
date     | d    
trade_id | C    
time     | t    
price    | f    
qty      | j    
side     | s    
edge     | f    
exch_id  | j    
broker_id| j    
bid      | f    
ask      | f  

ashish31
New Contributor III

Thanks a ton, was making a silly mistake of duplicate records.
It's sorted now. 

Hi @ashish31 , It seems like exercise 3.3 is completed but all i get is a type error . can you share the perspective of how the exercise can be done.

Subhashchander_0-1692017239902.png

 

ashish31
New Contributor III

@Subhashchander Can you please share your definition of classifyTrades and meta of table?

Hi @ashish31 ,

classifyTrades:{[x] side:x`side;price:x`price;ask:x`ask;bid:x`bid;?[side=`B;?[price<=ask;1b;0b];?[price>=bid;1b;0b]]};

 

badTrades:select from (update exQuality:classifyTrades[tradeContext] from tradeContext) where exQuality=0b;

Subhashchander_0-1692018356897.png

this is the meta of TradeContext table i used in the function.


These are the query that i used for the exercise ..where did i go wrong is unknown .