Placeholder Image

Subtitles section Play video

  • what's going on?

  • Everybody.

  • And welcome to the second part of the Zip line local tutorial miniseries for back testing and doing finance with punny Thon In last tutorial, what we did was we just went through the arduous process of getting zip line running on our machine, running through a simple, just by apple strategy.

  • And we got to this point where we ran the strategy and we can see that it's making some output.

  • And no matter which way you run it, you got we at least said the output should go to Strat dot pickle.

  • So what do we do at this point?

  • So at least now, if you run it via the magic here, you do get the output saved to this apparent data frame creates this table that I'm telling you now is a data frame.

  • But but this pride isn't exactly what you were hoping for.

  • You probably want to see some sort of graph, and you also probably want to know what you're working with if we just use this scroll bar.

  • Um, at some point, I thought we would hit it.

  • Looks like we're actually seeing all the columns here, which is weird.

  • Usually it cuts.

  • No.

  • No.

  • Okay, here it is.

  • I just missed it.

  • Yeah, There's other columns here that we're just not seeing.

  • It's truncated it.

  • So anyway, what can we do?

  • What can we visualize?

  • What's here for us already?

  • So the first thing I'm gonna go ahead and Dio is, um basically, I've already run this, so I'm just filming from the last part.

  • So if you need to make sure you load the extension, run the algorithm again and all that, I'm just gonna continue one down here.

  • So what?

  • This did, at least in this the way that we ran it This time I still have one more way.

  • I'm gonna show you guys how to run things, but, uh, I just figure information over the overload.

  • Eso This saved our strategy.

  • Output to Strat, not pickles.

  • So what?

  • What could we do?

  • How could we read from this?

  • Well, one option we have, uh, first of all would be like, let's go ahead and import pandas as PG.

  • In fact, let me see about making this.

  • Don't make it too crazy, but I want to be eligible.

  • Uh, and then let me go ahead and make some more imports.

  • Put this up towards the middle, so we're gonna import.

  • Pan is as p D.

  • Let's import Matt plot lib dot pipeline as peel tea from Matt Plot Live.

  • Let's go ahead and import style, and then we'll do a style that use G plot because we all know in finance how beautiful your charts are Makes a huge difference in your performance.

  • So, uh, the next thing we're going to say is I'm just gonna say it back Testy f equals P d dot eyes It was it read pickle Freed pickle and then specify the name of the pickle.

  • In my case, we output to Strat dot pickle so Strat dot pickle So that reads in our data frame.

  • And then we could do something as simple as back test on her score.

  • D f dot uh, port folio underscore value dot plots guilty dot show boom.

  • You could also plot in line and then you don't have to call appeal t doubt show.

  • Ah, but I'm just always in the habit of doing it this way.

  • So that's what I'm gonna do it anyway.

  • Boom.

  • There's our performance.

  • Awesome.

  • Looks like we do.

  • Really?

  • Well.

  • Turns out you do really well, if you could just buy 10 shares of Apple every single day without any respect to really anything at all.

  • And you just have infinite money anyway, uh, cool.

  • That did good.

  • Now you might be like Well, Centex, slow down.

  • How did you know you could do portfolio value?

  • Well, one option was you could probably like, look up here and be like, um let's see if portfolio values even here.

  • I'm not seeing it, But a lot of times I'm just totally blind.

  • It might be there anyway, Uh, the way I knew about it is what you could say is, just now that we've loaded back in that, uh, this data frame and called it back testy f we could just dot columns this bad boy and boom.

  • So all of these things are things that we can graft right now they're automatically tracked, except for a p O.

  • We added that so, for example, if there's something else that you want to track in your strategy as it goes, besides all of these columns right here, if there is something else just like on quantum peon, you can use the record function and record it now.

  • In quantum peahen, there's a limit of five.

  • I think you could only record five things.

  • I'm not positive.

  • If Zip line locally is the same, I would have to imagine it's not, but maybe it is.

  • I don't know.

  • I would imagine you could probably record infinite values, though.

  • Um, but I really don't know the answer to that.

  • Someone feel free to comment below.

  • If you know the answer.

  • We could just record Apple a bunch.

  • I mean, let's just find it out.

  • Um, sorry for the live test, but I'm actually kind of curious because it's fairly useful if you can record a bunch of things at once.

  • Okay.

  • Cool.

  • That should run pretty quick.

  • Yeah.

  • Nice.

  • So you can actually record a lot more.

  • I'm pretty sure the limit on quant O P in is ah.

  • Is his five for record.

  • I kind of want it.

  • I just want to confirm that I'm sorry if you guys aren't really interested.

  • I assume if you're watching this, you probably are at least somewhat interested in this recording.

  • Implanting variables up to five.

  • Yes.

  • So quantum peon limits you to five.

  • Zip line doesn't.

  • Which is good.

  • That only makes sense.

  • I just wanted just curious That followed through.

  • Um Okay, cool.

  • So, anyone around those again before we're dealing with those?

  • So these are all the other columns that you have.

  • If you wanted to when you were going, you could do stuff you could.

  • Also, just after the fact that you could make, um you could make calculations on this data frame, like you can define a new column, and you could see that new columns equal the benchmark period return minus algorithm, period return or something like that.

  • You can always do stuff like that are really proud to algorithm, period minus benchmark period.

  • But anyway, um yeah.

  • So, like, that would be, um you could make those kind of like after the fact calculations, if you don't know anything about pandas.

  • Uh, I'm sure I mentioned this in the quant o P in Siri's.

  • But you can always just google pant or, uh well, you Google pandas if you want, or you got a python pregnant that just tight panties up here and boom, you'll find this serious.

  • So you just type hand is search for that.

  • Do the data analysis with Python Panoz boom!

  • All the only you could ever want to know about doing stuff with panties.

  • So anyway, um, yeah, so that's one way that we can we can graft things now.

  • The other thing is with doing so like, this is one way that we could do visualization, But there's another way that we can actually do it.

  • So the other way, I just want to show briefly, is I think I might even just copy and Paste IX.

  • This isn't really the way that I liked doing it, So I think I'll just copy and paste from the text based version.

  • So if you want to do it this way, you can do it.

  • I'll explain why I don't like it, but basically the only the only difference is there's an analyse function here.

  • So this is just kind of one those built in front functions that zip line looks for.

  • So you could run, analyze like that, and again, we're just gonna plot portfolio value.

  • And then again, we could run.

  • Uh, we could run zip line again, so I'll just come up.

  • Where is it?

  • Come up here copy paste.

  • Oh, did I run this other?

  • I didn't run the other one.

  • Okay, hold on.

  • Okay.

  • Run that one.

  • Run that one.

  • Okay.

  • Hopefully, this time, it'll work How we expect.

  • Right.

  • So this time, rather than having to go to a separate little bid and low back in the the, uh, the pickle this time, it just all runs at the same time.

  • And it outputs our data frame under here if we wanted to.

  • But in the analyzed function, anything you put in here, so if you wanted to print out some values, you want to make some graphs, you want to do whatever you wanted to do.

  • Uh, you can do that in the analyze function.

  • You could upload your results to some sort of Web server.

  • You could.

  • Anything you want to do in the analyze function you can D'oh.

  • It's just gonna run at the very end.

  • It also still is going to output to Strat dot pickle.

  • So the reason why I don't really like this is a lot of times when I'm done with a performance, I kind of tinker around with the visual ization of that performance.

  • And in this case every time you wanted to change every little thing, you'd have to run it again.

  • Um, so for me, at least so far I've actually just been doing it this way Where I just output.

  • Um, and actually, this is I'll show you the final way.

  • I typically run things.

  • Um, but yeah, I tend to handle the visualization that separate from the actual algorithm itself, but, um, everyone's gonna probably be a little different there, so I just wanted to show that So Anyways, um, that is interacting now with the output that's created by the performance of your algorithm.

  • So from this point, you should be pretty comfortable doing anything.

  • The zip line using the kind of the U.

  • S.

  • Markets, at least via the quanta ll bundle that you get from quantum peon.

  • But I think a lot of people are really more interested in using their own data sets.

  • So in the next tutorial, we're gonna talk about how you can basically bringing your own data, and then probably it will be one more tutorial.

  • After that, we'll talk about how you could bring in your own data for custom markets to So anyways, that's what we're gonna be doing in the coming to terms if you like the Content Python program and its last support questions, comments, concerns, suggestions, whatever feel free, leaving them below.

  • Otherwise, I will see you in the next tutorial.

what's going on?

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it