# Programming performance/JN K

### From HaskellWiki

Submission in K. Start to finish time: 17 minutes.

RaymondH showed me his, so this might not be entirely originial.

I tried not to look at any of the K solutions.

/ parse quotes D:|1_*(" F ";" ")0:`:gspc.txt / Cash and Portfolio (price -> quantity) C:10000.00; P:(`u#0#0.)!0#0. / Trading strategy T:{if[~.97<x%y; P[x]+:(b:C%10)%x; C-:b]; C+:x*+/P p:p@&~1.06>x%p:!P; P[p]:0.} / run strategy on each pair (current and previous) of prices (*D)T':D; / Sell off remaining C+:+/.:[P]**|D