diff --git a/src/propeller/problems/stocks/data/dailyret_GLD.csv b/src/propeller/problems/stocks/data/dailyret_GLD.csv new file mode 100644 index 0000000..3db4586 --- /dev/null +++ b/src/propeller/problems/stocks/data/dailyret_GLD.csv @@ -0,0 +1,763 @@ +44.38,0.009013068949977434 +44.78,0.003796337650736974 +44.95,-0.004449388209121309 +44.75,0.006703910614525076 +45.05,0.005327413984461754 +45.29,0.0024287922278648584 +45.4,-0.006167400881057294 +45.12,0.005762411347517845 +45.38,-0.009475539885412068 +44.95,0.014460511679644017 +45.6,-0.009429824561403502 +45.17,-0.0013283152534868778 +45.11,-0.02438483706495237 +44.01,-0.005226084980686137 +43.78,-0.007766103243490256 +43.44,0.010819521178637175 +43.91,-0.008198588020951934 +43.55,0.010103329506314693 +43.99,-0.0070470561491248526 +43.68,0.011675824175824131 +44.19,0.0033944331296674743 +44.34,-0.0027063599458729036 +44.22,-0.00452284034373577 +44.02,0.005679236710586097 +44.27,0.004743618703410746 +44.48,-0.0024730215827338 +44.37,-0.01600180302005862 +43.66,0.003893724232707323 +43.83,-0.0006844626967830513 +43.8,-0.017808219178082056 +43.02,-0.006508600650860091 +42.74,-0.001637810014038378 +42.67,-0.01218654792594336 +42.15,-0.007354685646500479 +41.84,0.0026290630975143265 +41.95,0.006197854588796138 +42.21,0.009239516702203283 +42.6,0.0 +42.6,-0.00657276995305167 +42.32,0.0 +42.32,-0.0014177693761815281 +42.26,-0.00023663038334117395 +42.25,0.011597633136094722 +42.74,0.0007019185774450429 +42.77,-0.012391863455693269 +42.24,0.01065340909090899 +42.69,-0.0016397282736003815 +42.62,0.0016424213984045117 +42.69,-0.011009604122745348 +42.22,-0.002842254855518651 +42.1,0.0014251781472682937 +42.16,-0.011385199240986644 +41.68,-0.005038387715930922 +41.47,-0.0048227634434529956 +41.27,-0.00024230676035873796 +41.26,0.0012118274357732493 +41.31,0.010651174049866804 +41.75,0.007904191616766426 +42.08,0.011169201520912522 +42.55,0.0007050528789659492 +42.58,-0.0014091122592765422 +42.52,0.004938852304797595 +42.73,0.0004680552305172742 +42.75,0.019181286549707608 +43.57,-0.0034427358274041445 +43.42,-0.002072777521879397 +43.33,0.003923378721440151 +43.5,0.0004597701149426006 +43.52,-0.006893382352941274 +43.22,0.0006941230911615256 +43.25,-0.006473988439306385 +42.97,0.009541540609727804 +43.38,0.0020746887966804125 +43.47,0.012882447665056413 +44.03,-0.00022711787417665252 +44.02,0.004089050431621983 +44.2,0.005203619909502191 +44.43,-0.009002925950934021 +44.03,0.0006813536225301189 +44.06,0.005674080798910576 +44.31,-0.0110584518167457 +43.82,0.0015974440894568754 +43.89,-0.018227386648439214 +43.09,-0.01021118588999779 +42.65,-0.005392731535756081 +42.42,-0.000707213578500734 +42.39,0.0035385704175512757 +42.54,0.0004701457451810796 +42.56,0.0011748120300751211 +42.61,0.00492842055855435 +42.82,-0.004670714619336825 +42.62,-0.005161895823556989 +42.4,0.0011792452830189685 +42.45,0.00424028268551236 +42.63,-0.0014074595355384066 +42.57,0.002818886539816712 +42.69,0.0021082220660577048 +42.78,0.0014025245441795762 +42.84,0.001400560224089523 +42.9,-0.013752913752913667 +42.31,0.0021271567005435193 +42.4,0.006839622641509414 +42.69,0.013820566877488954 +43.28,0.0027726432532346914 +43.4,-0.004838709677419375 +43.19,0.004630701551285085 +43.39,0.0011523392486747443 +43.44,0.004604051565377598 +43.64,-0.010082493125572817 +43.2,-0.004629629629629695 +43.0,0.008139534883720963 +43.35,-0.01084198385236445 +42.88,-0.0027985074626866733 +42.76,0.0032740879326473475 +42.9,0.00023310023310018672 +42.91,-0.009088790491726718 +42.52,0.0007055503292566799 +42.55,0.0021151586368978476 +42.64,0.0011726078799248864 +42.69,-0.01241508550011715 +42.16,-0.0049810246679315405 +41.95,-0.0016686531585220568 +41.88,-0.00047755491881573843 +41.86,0.004538939321547963 +42.05,-0.0016646848989298523 +41.98,-0.00786088613625532 +41.65,-0.0007202881152461257 +41.62,0.0026429601153291553 +41.73,0.0033549005511622474 +41.87,-0.0042990207786004235 +41.69,0.004557447829215755 +41.88,-0.005491881566380228 +41.65,-0.0028811524609843324 +41.53,0.013725018059234295 +42.1,0.0016627078384798166 +42.17,0.00735119753379168 +42.48,-0.002354048964218322 +42.38,-0.0009438414346389605 +42.34,-0.0016532829475673187 +42.27,0.008280104092737032 +42.62,0.0037541060534960983 +42.78,-0.004207573632538562 +42.6,0.003286384976525835 +42.74,0.016846045858680367 +43.46,0.003911642890013845 +43.63,0.0006876002750399731 +43.66,0.0034356390288594984 +43.81,-0.002054325496462073 +43.72,0.006861848124428277 +44.02,-0.00272603362108143 +43.9,0.00022779043280177701 +43.91,-0.010475973582327346 +43.45,0.00414269275028768 +43.63,-0.004354801741920807 +43.44,-0.017034990791896753 +42.7,-0.00983606557377053 +42.28,-0.0007095553453169616 +42.25,0.002603550295857975 +42.36,-0.002360717658168117 +42.26,0.006625650733554216 +42.54,0.002350728725905064 +42.64,-0.006801125703564708 +42.35,-0.010625737898465238 +41.9,0.003579952267303069 +42.05,-0.0009512485136741772 +42.01,-0.0028564627469649475 +41.89,0.007400334208641735 +42.2,0.006161137440758246 +42.46,-0.00023551577955718348 +42.45,0.001413427561837342 +42.51,-0.00611620795107029 +42.25,0.004497041420118289 +42.44,0.007304429783223428 +42.75,0.001637426900584802 +42.82,0.007239607659972029 +43.13,0.00023185717597955043 +43.14,0.009040333796940208 +43.53,0.0034458993797380788 +43.68,-0.0018315018315017925 +43.6,-0.00573394495412844 +43.35,-0.00023068050749707058 +43.34,0.007152745731425822 +43.65,0.018327605956472034 +44.45,0.0008998875140607232 +44.49,-0.008091706001348604 +44.13,0.009517335146158953 +44.55,-0.014365881032547713 +43.91,-0.001821908449100394 +43.83,-0.005247547342003123 +43.6,0.002293577981651409 +43.7,0.00137299771167037 +43.76,-0.0038848263254112115 +43.59,0.003211745813259772 +43.73,-0.0027441115938714256 +43.61,-0.0009172208209126152 +43.57,-0.01285288042230898 +43.01,0.009067658684026984 +43.4,0.018894009216589867 +44.22,0.0006784260515604057 +44.25,0.00045197740113001413 +44.27,0.0013553196295458586 +44.33,0.00609068351003842 +44.6,0.005381165919282556 +44.84,0.001115075825156047 +44.89,-0.007351303185564676 +44.56,0.00897666068222618 +44.96,0.010231316725978667 +45.42,0.008806693086745896 +45.82,0.009384548232213002 +46.25,-0.00043243243243250003 +46.23,0.017953709712308145 +47.06,-0.014874628134296703 +46.36,-0.0017256255392579442 +46.28,0.006266205704407933 +46.57,-0.006871376422589656 +46.25,0.011891891891891831 +46.8,0.006410256410256502 +47.1,-0.008492569002123113 +46.7,-0.005995717344753771 +46.42,0.0006462731581215238 +46.45,-0.0019375672766416233 +46.36,0.01833477135461608 +47.21,0.003177292946409629 +47.36,0.00021114864864860665 +47.37,0.00042220814861733435 +47.39,-0.011394809031441215 +46.85,0.0036286019210245825 +47.02,-0.004678860059549254 +46.8,0.009829059829059848 +47.26,-0.005501481168006729 +47.0,-0.014042553191489289 +46.34,-0.007768666378938423 +45.98,0.011744236624619537 +46.52,-0.002794496990541757 +46.39,0.014442767837896135 +47.06,-0.0027624309392265734 +46.93,0.005327082889409759 +47.18,0.0008478168715557259 +47.22,-0.01736552308343923 +46.4,-0.01443965517241383 +45.73,0.008746993221080378 +46.13,-0.0036852373726425688 +45.96,-0.00979112271540476 +45.51,0.0057130301032741184 +45.77,0.003058772121476807 +45.91,0.014158135482465818 +46.56,-0.00171821305841936 +46.48,0.0068846815834767705 +46.8,-0.0038461538461538403 +46.62,0.0008580008580008398 +46.66,0.02400342906129457 +47.78,0.014650481372959307 +48.48,-0.00041254125412533047 +48.46,0.010936855138258381 +48.99,0.006736068585425562 +49.32,-0.00344687753446881 +49.15,0.005493387589013288 +49.42,0.006475111290975319 +49.74,0.001206272617611483 +49.8,-0.014056224899598308 +49.1,0.021792260692464364 +50.17,0.002989834562487514 +50.32,0.0091414944356121 +50.78,0.002166207168176436 +50.89,0.008449597170367454 +51.32,0.011301636788776272 +51.9,0.009633911368015415 +52.4,0.0030534351145038875 +52.56,-0.017313546423135533 +51.65,-0.025169409486931214 +50.35,-0.00218470705064547 +50.24,-0.0029856687898088888 +50.09,0.0025953284088639536 +50.22,-0.023496614894464352 +49.04,0.006729200652528513 +49.37,0.01559651610289656 +50.14,-0.00039888312724377996 +50.12,0.010375099760574684 +50.64,0.016390205371247992 +51.47,0.0 +51.47,0.0021371672819117823 +51.58,0.02985653354013182 +53.12,0.0033885542168674647 +53.3,-0.01801125703564716 +52.34,0.026366068016813057 +53.72,0.016381236038719334 +54.6,-0.009890109890109874 +54.06,0.008694043655197907 +54.53,-0.0018338529249954413 +54.43,0.01855594341355866 +55.44,-0.0032467532467532418 +55.26,-0.021534563879840714 +54.07,0.028111707046421363 +55.59,-0.007015650296815984 +55.2,0.010326086956521744 +55.77,-0.0007172314864623678 +55.73,0.007356899336084761 +56.14,-0.004631278945493374 +55.88,-0.004473872584108804 +55.63,0.018874707891425438 +56.68,0.0003528581510233438 +56.7,0.0 +56.7,0.004938271604938166 +56.98,-0.00842400842400837 +56.5,0.003893805309734493 +56.72,-0.03737658674188994 +54.6,0.004212454212454155 +54.83,0.02462155754149191 +56.18,-0.02474190103239588 +54.79,-0.01952911115167002 +53.72,0.014333581533879433 +54.49,-0.013396953569462359 +53.76,0.014136904761904857 +54.52,0.008070432868672005 +54.96,0.0029112081513827616 +55.12,0.003991291727140892 +55.34,-0.01264907842428628 +54.64,0.018301610541727673 +55.64,-0.007548526240115056 +55.22,0.015392973560304264 +56.07,0.0005350454788657238 +56.1,0.011408199643493771 +56.74,-0.008107155445893565 +56.28,-0.018656716417910522 +55.23,-0.005069708491761616 +54.95,-0.01783439490445867 +53.97,0.005002779321845527 +54.24,-0.00755899705014756 +53.83,0.008916960802526547 +54.31,0.010311176578898825 +54.87,0.00455622380171314 +55.12,0.003991291727140892 +55.34,-0.003975424647632923 +55.12,0.0009071117561684374 +55.17,-0.006162769621170988 +54.83,-0.0014590552617180065 +54.75,-0.0009132420091323681 +54.7,0.018464351005484422 +55.71,0.012206067133369228 +56.39,-0.005852101436424868 +56.06,0.018016410988226865 +57.07,0.02680918170667603 +58.6,-0.008532423208191127 +58.1,0.006368330464715963 +58.47,-0.0023943902856165653 +58.33,0.005657466140922309 +58.66,0.010569382884418763 +59.28,-0.011639676113360285 +58.59,0.01723843659327527 +59.6,-0.009899328859060459 +59.01,0.007117437722419958 +59.43,0.0011778563015312179 +59.5,0.02672268907563031 +61.09,0.012440661319364839 +61.85,0.030719482619240072 +63.75,-0.04376470588235293 +60.96,0.036745406824147016 +63.2,-0.024525316455696267 +61.65,0.018329278183292823 +62.78,0.013857916533927962 +63.65,-0.010840534171248983 +62.96,0.03383100381194413 +65.09,0.0010754340144414375 +65.16,0.021332105586249244 +66.55,-0.0013523666416228913 +66.46,0.015347577490219836 +67.48,0.007557794902193107 +67.99,-0.006324459479335088 +67.56,0.0313795145056247 +69.68,0.010045924225028539 +70.38,0.009235578289286811 +71.03,0.0012670702520062426 +71.12,-0.05216535433070877 +67.41,0.017801513128615977 +68.61,-0.006704562017198568 +68.15,-0.010124724871606924 +67.46,-0.027868366439371413 +65.58,-0.0042695943885331065 +65.3,0.016539050535987723 +66.38,-0.034950286230792306 +64.06,0.00999063378083048 +64.7,0.006182380216383176 +65.1,0.00015360983102926447 +65.11,-0.013515589003225241 +64.23,-0.026000311380974646 +62.56,0.015025575447570296 +63.5,-0.0033070866141732417 +63.29,-0.011692210459788308 +62.55,-0.004316546762589865 +62.28,-0.021997430956968603 +60.91,-0.0075521260876702315 +60.45,-0.0069478908188585885 +60.03,-0.06846576711644177 +55.92,-0.005364806866952866 +55.62,0.030564545127651978 +57.32,0.00628053035589671 +57.68,-0.022884882108183083 +56.36,0.016678495386799108 +57.3,0.017975567190226898 +58.33,-0.010286302074404277 +57.73,0.0045037242335008686 +57.99,0.005000862217623713 +58.28,-0.010295126973232694 +57.68,-0.0024271844660194272 +57.54,0.0344108446298228 +59.52,0.028729838709677314 +61.23,0.015515270292340403 +62.18,0.005146349308459316 +62.5,0.00832000000000005 +63.02,-0.006188511583624255 +62.63,-0.009739741338016914 +62.02,0.028861657529829072 +63.81,0.017395392571697216 +64.92,0.009704251386321557 +65.55,0.0045766590389015585 +65.85,-0.028853454821564033 +63.95,-0.016419077404222115 +62.9,0.01796502384737683 +64.03,-0.023270342027174793 +62.54,-0.013271506236008927 +61.71,-0.009236752552260578 +61.14,0.006705920837422254 +61.55,0.007311129163281931 +62.0,0.014516129032258041 +62.9,0.00333863275039747 +63.11,0.0007922674694976574 +63.16,0.01836605446485112 +64.32,0.006685323383084684 +64.75,-0.00972972972972966 +64.12,0.0024953212726137957 +64.28,0.003422526446795253 +64.5,-0.008217054263565908 +63.97,0.010317336251367775 +64.63,-0.021352313167259718 +63.25,-0.008537549407114611 +62.71,-0.007335353213203649 +62.25,-0.00385542168674702 +62.01,0.00774068698597007 +62.49,-0.02336373819811171 +61.03,0.00016385384237257105 +61.04,0.02293577981651374 +62.44,-0.006245996156310067 +62.05,-0.0035455278001611423 +61.83,-0.0012938702895034498 +61.75,0.000323886639676164 +61.77,-0.012465598186822132 +61.0,-0.0009836065573770865 +60.94,0.007876599934361734 +61.42,0.014164767176815328 +62.29,-0.0024080911863862352 +62.14,0.019633086578693254 +63.36,-0.007891414141414142 +62.86,-0.02561247216035634 +61.25,-0.00995918367346938 +60.64,-0.03529023746701848 +58.5,-0.003076923076923072 +58.32,0.005144032921810651 +58.62,-0.024394404640054584 +57.19,0.003671970624235021 +57.4,0.014459930313588821 +58.23,-0.022496994676283622 +56.92,0.005973295853829871 +57.26,0.012050296891372771 +57.95,0.009490940465918847 +58.5,0.0 +58.5,0.004102564102564136 +58.74,0.018215866530473277 +59.81,-0.00033439224210003553 +59.79,-0.005352065562803149 +59.47,-0.005380864301328406 +59.15,-0.034488588334742165 +57.11,-0.012957450534057119 +56.37,0.009756962923540967 +56.92,0.001229796205200286 +56.99,0.0036848569924548317 +57.2,-0.003496503496503546 +57.0,-0.002105263157894692 +56.88,0.010724331926863562 +57.49,0.018785875804487706 +58.57,0.010244152296397498 +59.17,-0.008788237282406677 +58.65,-0.001023017902813217 +58.59,0.01399556238265904 +59.41,-0.010604275374516 +58.78,-0.01735284110241584 +57.76,0.007098337950138568 +58.17,0.010142685232937878 +58.76,0.009019741320626296 +59.29,0.0018552875695732743 +59.4,0.008417508417508417 +59.9,0.005676126878130274 +60.24,0.018592297476759584 +61.36,0.009126466753585435 +61.92,0.006136950904392691 +62.3,-0.0065810593900481 +61.89,0.0024236548715462687 +62.04,-0.01499032882011605 +61.11,0.030109638357061094 +62.95,-0.007307386814932499 +62.49,-0.004800768122899732 +62.19,-0.00900466312912036 +61.63,0.0034074314457244984 +61.84,-0.008570504527813732 +61.31,0.007665959876039779 +61.78,-0.000161864681126546 +61.77,0.008094544277157195 +62.27,0.0036935924201059395 +62.5,0.016 +63.5,0.003149606299212643 +63.7,-0.0020408163265306523 +63.57,-0.006449583136699759 +63.16,0.019474350854971564 +64.39,-0.0041931977015063834 +64.12,0.0 +64.12,-0.0048346849656893676 +63.81,-0.017552107820090965 +62.69,0.0006380602966980244 +62.73,-0.010840108401084007 +62.05,0.008380338436744612 +62.57,-0.0007991050023972696 +62.52,-0.0006397952655151351 +62.48,-0.005761843790012796 +62.12,-0.01802962009014806 +61.0,0.0006557377049180188 +61.04,0.012450851900393153 +61.8,-0.0029126213592232963 +61.62,-0.00389483933787723 +61.38,0.004398826979472076 +61.65,0.005352798053527953 +61.98,0.0038722168441433042 +62.22,0.010928961748633875 +62.9,0.0049284578696343765 +63.21,-0.014712861888941619 +62.28,-0.010115606936416225 +61.65,-0.024006488240064832 +60.17,0.0051520691374438285 +60.48,0.006117724867724943 +60.85,-0.0042728019720624155 +60.59,0.0006601749463607715 +60.63,0.025399967013029837 +62.17,-0.00321698568441375 +61.97,0.01081168307245444 +62.64,-0.006066411238825072 +62.26,0.01188564086090591 +63.0,-0.004444444444444463 +62.72,0.024075255102040897 +64.23,0.0015569048731121642 +64.33,-0.0041971086584796525 +64.06,0.0017171401810802283 +64.17,-0.0062334424185756365 +63.77,0.007056609691077242 +64.22,0.009498598567424469 +64.83,0.006015733456733003 +65.22,-0.014412756823060376 +64.28,0.0004667081518357364 +64.31,0.0074638469911367435 +64.79,-0.002469516900756456 +64.63,0.01377069472381248 +65.52,0.009157509157509288 +66.12,-0.00680580762250458 +65.67,0.0025887010811634185 +65.84,0.008049817739975715 +66.37,0.0006026819346088902 +66.41,-0.0007528986598403427 +66.36,-0.015822784810126538 +65.31,0.03123564538355523 +67.35,-0.0029695619896063646 +67.15,0.008488458674608982 +67.72,0.0056113408151210195 +68.1,-0.03950073421439057 +65.41,0.016358354991591613 +66.48,-0.00992779783393518 +65.82,-0.03205712549377078 +63.71,-0.01224297598493174 +62.93,0.01938662005402838 +64.15,0.002338269680436344 +64.3,0.0027993779160187687 +64.48,-0.0035669975186104833 +64.25,0.0018677042801557128 +64.37,-0.010097871679353825 +63.72,0.003452605147520384 +63.94,0.0006255864873318603 +63.98,0.010003125976867892 +64.62,0.001857010213556025 +64.74,0.00818659252394194 +65.27,0.008426535927684957 +65.82,-0.0009115770282587066 +65.76,-0.009276155717761548 +65.15,0.010590943975441254 +65.84,-0.0021263669501822686 +65.7,0.0053272450532723635 +66.05,-0.006056018168054375 +65.65,0.0013709063214012063 +65.74,0.0016732582902342476 +65.85,-0.00030372057706903606 +65.83,0.014886829712896916 +66.81,0.0007483909594371674 +66.86,-0.004935686509123517 +66.53,0.009469412295205102 +67.16,-0.0011911852293031314 +67.08,-0.0013416815742397646 +66.99,0.012688460964323162 +67.84,0.008254716981132108 +68.4,-0.005847953216374352 +68.0,0.0055882352941175805 +68.38,-0.012430535244223375 +67.53,0.017325633051976923 +68.7,-0.006404657933042179 +68.26,-0.007764430120128935 +67.73,0.0023623209803631563 +67.89,-0.015024304021210723 +66.87,0.010318528488111225 +67.56,-0.006956779159265821 +67.09,-0.005962140408406702 +66.69,-0.00044984255510573004 +66.66,0.012451245124512426 +67.49,0.010371906949177698 +68.19,0.0008798944126705129 +68.25,-0.005421245421245488 +67.88,-0.006334708308780092 +67.45,-0.02149740548554489 +66.0,0.006818181818181861 +66.45,-0.002558314522197166 +66.28,0.003922751961376058 +66.54,-0.01412684099789618 +65.6,-0.00823170731707305 +65.06,0.0070703965570241886 +65.52,0.0022893772893773762 +65.67,-0.007156997106745833 +65.2,0.00521472392638042 +65.54,-0.012053707659444707 +64.75,0.0029343629343628994 +64.94,0.002001847859562603 +65.07,-0.005378822806208611 +64.72,0.01266996291718182 +65.54,0.013732072017088669 +66.44,0.0015051173991572626 +66.54,-0.0025548542230237705 +66.37,0.0006026819346088902 +66.41,-0.01731666917632874 +65.26,-0.015936254980079775 +64.22,0.007474307069448832 +64.7,-0.009273570324575093 +64.1,0.006708268330733336 +64.53,0.0010847667751432385 +64.6,0.0038699690402476785 +64.85,0.001542020046260733 +64.95,0.008160123171670534 +65.48,-0.01175931582162508 +64.71,-0.0023180343069076105 +64.56,0.0034076827757124977 +64.78,-0.0054029021302870375 +64.43,-0.01257178333074669 +63.62,0.0007859163784973949 +63.67,0.009266530548138894 +64.26,0.00015561780267648467 +64.27,0.01166951921580831 +65.02,-0.004306367271608754 +64.74,-0.004942848316342187 +64.42,0.008382489909965726 +64.96,0.006465517241379337 +65.38,0.003517895380850474 +65.61,-0.00259106843468986 +65.44,0.008863080684596552 +66.02,0.0001514692517419739 +66.03,-0.003180372557928335 +65.82,-0.001063506532968599 +65.75,0.013231939163498168 +66.62,0.005854097868507963 +67.01,0.008506193105506538 +67.58,-0.0016277005031074198 +67.47,0.0 +67.47,-0.008448199199644185 +66.9,-0.018684603886397606 +65.65,-0.003655750190403794 +65.41,0.005503745604647599 +65.77,0.000304090010643306 +65.79,0.0021279829761361993 +65.93,-0.0006067040800850333 +65.89,0.012141447867658176 +66.69,-0.0025491078122657326 +66.52,-0.0006013229104027668 +66.48,0.004362214199759206 +66.77,-0.019619589636064135 +65.46,0.01695692025664527 +66.57,-0.004656752290821513 +66.26,0.000452761847268354 +66.29,-0.0024136370493288697 +66.13,-0.021926508392559937 +64.68,0.005102040816326503 +65.01,0.0016920473773265562 +65.12,-0.0007678132678134423 +65.07,0.0050714615029969655 +65.4,-0.0013761467889908778 +65.31,0.012249272699433426 +66.11,-0.0019664196036907494 +65.98,-0.005910882085480457 +65.59,0.007318188748284643 +66.07,-0.004086574844861451 +65.8,0.010942249240121564 +66.52,0.013830426939266413 +67.44,0.0017793594306050498 +67.56,0.01924215512137355 +68.86,0.007696776067383113 +69.39,0.0033145986453380024 +69.62,0.012927319735708006 +70.52,-0.0008508224617130215 +70.46,-0.005393130854385403 +70.08,-0.0012842465753425145 +69.99,0.014002000285755167 +70.97,0.010286036353388811 +71.7,-0.003765690376568982 +71.43,0.018059638807223742 +72.72,-0.005225522552255163 +72.34,-0.0008294166436273469 +72.28,0.0006917542888765517 +72.33,-0.004562422231439213 +72.0,0.009722222222222262 +72.7,0.011141678129298518 +73.51,0.00530540062576521 +73.9,-0.02097428958051436 +72.35,-0.006219765031098668 +71.9,0.013490959666203043 +72.87,0.007273226293399219 +73.4,-0.011852861035422404 +72.53,0.007720943058044978 +73.09,0.0036940757969625942 +73.36,0.007497273718647726 +73.91,0.009200378839128763 +74.59,0.007373642579434202 +75.14,-0.0002661698163427738 +75.12,-0.008253461128860549 +74.5,0.020134228187919462 +76.0,-0.003947368421052594 +75.7,-0.014531043593130892 +74.6,0.008445040214477341 +75.23,0.0038548451415657587 +75.52,0.006753177966101763 +76.03,0.02183348678153356 +77.69,0.005534817865877293 +78.12,-0.009856630824372891 +77.35,0.016418875242404787 +78.62,-0.008776392775375194 +77.93,0.024380854613114223 +79.83,-0.001002129525241116 +79.75,0.02106583072100322 +81.43,0.009947193908878644 +82.24,-0.00012159533073918902 +82.23,-0.0006080505898090375 +82.18,-0.04721343392552944 +78.3,0.01047254150702436 +79.12,0.014661274014155668 +80.28,-0.02902341803687093 +77.95,-0.0025657472738935577 +77.75,-0.006559485530546689 +77.24,0.02887105126877271 +79.47,-0.0013841701270919772 +79.36,0.023815524193548394 +81.25,0.0006153846153845804 +81.3,-0.01476014760147605 +80.1,-0.006616729088639216 +79.57,-0.016212140253864422 +78.28,-0.012263668880940316 diff --git a/src/propeller/problems/stocks/stock_regression.cljc b/src/propeller/problems/stocks/stock_regression.cljc index af0e045..beb8c15 100644 --- a/src/propeller/problems/stocks/stock_regression.cljc +++ b/src/propeller/problems/stocks/stock_regression.cljc @@ -6,81 +6,91 @@ [propeller.gp :as gp] [propeller.push.interpreter :as interpreter] [propeller.push.state :as state] - [propeller.tools.loading :as loading])) + [propeller.tools.loading :as loading] + [propeller.push.instructions :as instructions] + [propeller.utils :as utils])) (def train-and-test-data - "Training data: Inputs and outputs with -10 <= x < 11 - Test data: Inputs and outputs of -20 <= x < -10 and 11 <= x < 21" - (let [data (loading/basic-load-data-csv "src/propeller/problems/stocks/data/GLD.csv") + "Train and test data split for GLD. Might change this in a bit." + (let [data (loading/basic-load-data-csv "src/propeller/problems/stocks/data/dailyret_GLD.csv") train-len (math/round (* (count data) 0.8)) test-len (- (count data) train-len) ] - {:train (map (fn [x] {:input1 (first (map read-string x)) :output1 (fnext (map read-string x))}) (doall (take train-len data))) - :test (map (fn [x] {:input1 (first (map read-string x)) :output1 (fnext (map read-string x))}) (doall (take-last test-len data)))})) + {:train (map (fn [x] {:input1 (vector (first (map read-string x))) :output1 (vector (fnext (map read-string x)))}) (doall (take train-len data))) + :test (map (fn [x] {:input1 (vector (first (map read-string x))) :output1 (vector (fnext (map read-string x)))}) (doall (take-last test-len data)))})) + +;; Random float between -100.0 and 100.0 +(defn random-float "Random float between -100.0 and 100.0" [] (- (* (rand) 200) 100.0)) + +; Random integer between -100 and 100 +(defn random-int "Random integer between -100 and 100" [] (- (rand-int 201) 100)) (def instructions "stack-specific instructions, input instructions, close, and constants" - (list :in1 - :integer_add - :integer_subtract - :integer_mult - :integer_quot - :integer_eq - :exec_dup - :exec_if - 'close - 0 - 1 - :buy - :sell - :hold - )) - -(comment + (utils/not-lazy + (concat + (instructions/get-stack-instructions #{:float :integer :boolean :signal :exec :code}) + (list :in1) + (list random-float random-int)))) + (defn error-function - "Finds the behaviors and errors of an individual. The error is the absolute - deviation between the target output value and the program's selected behavior, - or 1000000 if no behavior is produced. The behavior is here defined as the - final top item on the INTEGER stack." + "Finds the sharpe ratio for a given individual. Heavy penalty if the stack is empty." ([argmap data individual] (let [program (genome/plushy->push (:plushy individual) argmap) - inputs (map (fn [x] (first (:input1 x))) data) - correct-outputs (map (fn [x] (first (:output1 x))) data) - outputs (map (fn [input] - (state/peek-stack - (interpreter/interpret-program - program - (assoc state/empty-state :input {:in1 input}) - (:step-limit argmap)) - :integer)) - inputs) - errors (map (fn [correct-output output] - (if (= output :no-stack-item) - 1000000 - (math/abs (- correct-output output)))) - correct-outputs - outputs)] - (assoc individual - :behaviors outputs - :errors errors - :total-error #?(:clj (apply +' errors) - :cljs (apply + errors)))))) -) + all-inputs (map (fn [x] (first (:input1 x))) data) + daily-returns (map (fn [x] (first (:output1 x))) data) + ;outputs (map (fn [input] + ; (state/peek-stack + ; (interpreter/interpret-program + ; program + ; (assoc state/empty-state :input {:in1 input}) + ; (:step-limit argmap)) + ; :integer)) + ; inputs) + ;errors (map (fn [correct-output output] + ; (if (= output :no-stack-item) + ; 1000000 + ; (math/abs (- correct-output output)))) + ; correct-outputs + ; outputs)] + ] + (loop [sharpes [] + returns [] + inputs all-inputs + holding-position? false ; true when :buy passes, false when :sell passes + trade-signal (if (empty? inputs) + :end-loop + (state/peek-stack + (interpreter/interpret-program + program + (assoc state/empty-state :input {:in1 (first inputs)}) + (:step-limit argmap)) + :signal))] + ; TODO: I'm not confident on calculating the sharpe ratio yet. + ; I need time to learn. I'll come back to this when I'm ready. + ;(assoc individual + ; :behaviors outputs + ; :errors errors + ; :total-error #?(:clj (apply +' errors) + ; :cljs (apply + errors))) + )))) -(def integer-argmap +(def stock-argmap {:instructions instructions - ;:error-function error-function + :error-function error-function :training-data (:train train-and-test-data) :testing-data (:test train-and-test-data) :max-generations 300 :population-size 1000 :max-initial-plushy-size 5 - :step-limit 200 + :step-limit 1000 :parent-selection :lexicase :tournament-size 5 :umad-rate 0.1 :variation {:umad 1.0 :crossover 0.0} - :elitism false}) + :elitism false + :closes :balanced + :transaction-cost 0.0005}) (defn -main "Runs the top-level genetic programming function, giving it a map of @@ -89,5 +99,5 @@ [& args] (gp/gp (merge - integer-argmap + stock-argmap (apply hash-map (map #(if (string? %) (read-string %) %) args)))))