Placeholder Image

字幕表 動画を再生する

  • What's going on, everybody.

  • And welcome to a miniseries of the ends an ounce of getting zip line to run locally on your own machine.

  • If you don't know a zip line is, it's just arguably the best back tester in any programming language.

  • A T East that's open source and available to you.

  • Eso zip line is the back end that runs on Quantum Pian, for example.

  • And that's why I'm just gonna put this at the end of that Siri's, at least for now.

  • So the idea of running zip line locally is you can do a lot of more custom things with it, So maybe you want to do different markets.

  • Maybe you want to the Australian market or you want to dio the Japanese markets or whatever.

  • You might also want to do Bitcoin or who knows what, you want it back test.

  • You could do that on zip line if you run it locally, but getting it running all that is kind of a pain in the butt.

  • So that's what I'm here for.

  • So, uh, I'm gonna be doing this tutorial on zip line 1.2 and I'm gonna be using python 3.5 zip line on Lee supports 27 and 3.5.

  • Right now, I believe the main hindrance for 3.5 is because zipline also requires pandas 0.18 which doesn't have a build that I can't tell for 36 and 37 So I think that's the only requirement of the only constraint to why we need 3.5.

  • But keep that in mind.

  • If you're not on 3.5 or 2.7, you'll have to download that That too.

  • But anyways, so I'm gonna be using 3.5, um, in all that.

  • So if on Lee it was this simple, it is not a pip install.

  • If you have Kanda, it might be that simple with just a condom.

  • Install quantum peon, zip line.

  • Haven't tried it.

  • What I have done is I've installed it on both windows and Lennox, and I'm gonna share that process with you.

  • So you don't need conduct if you want.

  • By all means, go ahead and try to use the condo way if you already have conduct.

  • Great.

  • Go for it.

  • Um, I just don't use condoms.

  • So what we're gonna do to start is talk about what you need to do.

  • So I've basically broken it down both in Boone, too, and Windows on a boon to it's actually pretty darn simple.

  • Get your sea libraries mainly numb pie.

  • Seitan gets up tools and then you can boom get zip line from They're pretty simple.

  • If you'd just spun up the server is a few more extra commands.

  • Like if you haven't actually installed thes air just your typical You know, any time you install python you wanted to do the python Dev get pivotal that otherwise it's all the same on Windows.

  • You have entered hard mode.

  • Um, but still not not really the hardest thing once you got the idea.

  • So in order to do it, basically, I'll put the link to this in the description I highly recommend.

  • Just come here.

  • These are links.

  • You can just click on them on it, takes you exactly to the package, and then download the python 3.5 version.

  • Right?

  • So right here.

  • This would be what I'm looking for.

  • 64 bit python 35 download seitan, then do that for all of these.

  • See libraries.

  • The only two that I didn't put links to is empirical and context lib.

  • That's just because they don't have, like, a quick, um, quick link to them.

  • You just type it and just do a control F or whatever and download does.

  • They're not really organized by specific version.

  • Just download it.

  • Used the wheel.

  • I can't matter if you can Pip install these, you might be able to even just regular pip install.

  • But anything that used to see basically, you're not gonna get away with it.

  • Um, so beyond that, once you get these, these air those see libraries, the next step I would suggest you do is, um go ahead and do it.

  • Pip installed dash dash, upgrade pandas.

  • Exactly.

  • Version 0.18 point zero.

  • I think 00.1 will also work.

  • But just do this.

  • This is the one that I've used next.

  • Uh, what you're gonna want to do is just do a pip in stall for zip line.

  • I didn't really pull that out, but I would definitely just do just a regular Piven stole zip line.

  • So you want to do this to get all the other dependencies besides these, see dependencies.

  • Eventually when you do that pip install zip line, it is gonna fail.

  • Um, and that's totally okay.

  • That's part of the plan.

  • You just wanted to do it so you could get all the other dependencies that you needed that were non si dependencies.

  • But it's gonna start failing on like, b calls.

  • And l are you dicked and all that, and that's totally fine.

  • It's what you wanted.

  • Once you've installed.

  • Basically, once you've installed the sea libraries once you've just run a regular Pippen stole zip line.

  • Once you've done that, go ahead and download zip line from here.

  • So I just typed Zippel line.

  • Go ahead and download the you know again.

  • Python 3.5 on 64 bit download zip line.

  • And then you're gonna want to run a Pippen stole.

  • No dependencies.

  • Zip line because you already downloaded the other ones.

  • And you're just gonna fail when you try to tell those?

  • So anyway, yeah, I just run a python and pip install zip line 1.2, and I just wanted to refresh my installation.

  • Make sure we're all on the same page.

  • Hopefully this doesn't fail.

  • Fails for B calls, pies.

  • It failing for B calls, actually, did I?

  • Oh, because this one, my copy didn't have no depths.

  • Anyway, let me go back and Pippen Stall, dash, dash, No depths.

  • Hope they didn't download anything.

  • It's gonna conflict.

  • It's annoying anyway.

  • Okay, so boom, That's what you need to do.

  • Installed zip line.

  • Did something go wrong for you?

  • Let me know.

  • Down below did my best to help you out, but pretty much you're just going to be probably either missing packages or something like that.

  • But yeah, you should be able to actually no depths installed.

  • Zip line instantly.

  • The real test is if you can open up Python.

  • So I'm just going to see python 35 Python Python If I get tight today and then just do a quick import zip line and make sure you don't hit any errors if you hidden air, I mean is almost certain that it's like a module not found error going.

  • Install that module.

  • Okay, The only one that you need to install a specific version of is gonna be pandas.

  • Make sure it's pandas 0.18 point zero, and you just You do that by just doing a eat double equals and then the version number that you want.

  • If you already have pandas, do a dash dash upgrade.

  • Okay, once you've done that, once you've tested your install, you're ready to get going to use it line.

  • For now, we're just gonna use the quanta peon bundle because that just makes it easy to get up and running immediately.

  • But we will be using our own data soon enough, so don't worry about that.

  • But actually what?

  • I'm gonna go ahead and do real quick.

  • Let's make this text a bit bigger so everybody can see it clearly on video.

  • If we not run over my face, There we go.

  • Okay.

  • So, actually, I kind of want to steal these commands to, um I'd highly recommend you just go to the text based version for running all these commands, but yeah.

  • So the first thing that we're gonna do is we want to ingest that quant o P in bundles.

  • Someone it quit out of here, and then I'm going to just type into here zip line ingest dash B for bundle wantto Kwan topi in dash qanda ll and this should grab you the Quanta ll bundle cannot.

  • Okay, so that means Oh, I'm on pipe shoot because I've done OK.

  • Um, that's fine.

  • So zip line should be installed into your scripts.

  • So what I need to do, actually, because I have put zip line into Python 36 because I wanted really badly either put it on 36 or seven, but I failed.

  • So on 37 also, there's like, No l are you dicked And I think something else anyway, so I'm gonna specify the full path to zip line.

  • So when you install zip line's gonna put a zip line die T X c and your scripts, just like with Pip.

  • If sometimes pip is not pointing where you want it to go, just use the full path to whichever pip you want.

  • It's not the end of the world, um, or you could do Python dash and Pip anyway.

  • But in this case, I want to specify the full path, too.

  • Our zip line, which is see Python 35 uh, be in scripts.

  • And then it's just zip line dot e x c and your scripts, So zip line should be fine in Just want Opie in Quantum if that was your first installation.

  • A zip line, though you probably have the right point or there.

  • You probably don't need the full path.

  • So what we're gonna do here is in just this data looks beautiful on this gigantic screen that that really helped.

  • Anyway, while we're waiting on that, uh, pull this over and just take note that I'll give the full path again by another five scripts.

  • So zip line, um, and go ahead and just run.

  • Zip line, dash dash health.

  • So the zip line command here basically has a whole bunch of options that you have.

  • Ah, but basically, you can load in bundles you can clean, you can ingest some data and you can run.

  • So the other thing that I would say is do zip line.

  • We'll leave the help there, and then we'll just run.

  • So this is when you actually want to go running out rhythm.

  • You can Also, there's a whole bunch of commands there.

  • I don't personally find myself using the command line interface here, but just know it exists.

  • And sometimes if you look up for help on tutorials or whatever, um, there's, like, three major ways that you can run your algorithms so and they all have the same parameters.

  • It's just sometimes the dash will be replaced with an underscore or whatever.

  • Just take note that there's this is one of the ways that you might see people showing you how you could do something.

  • And this might not be the way that you learned from me.

  • So now I'm just gonna show you that it exists.

  • Okay, so the next thing that we're gonna do is I personally find that using notebooks makes the most sense with Gwen Topi in our zip line because of Quinto peon.

  • Um, so I'm gonna use much a Jupiter notebook.

  • You, by all means, you don't have to.

  • When we run algorithms, you could run in this way.

  • You can use data, which is what we're gonna use later.

  • I don't really see it, but it's probably in here somewhere.

  • If it's not.

  • Mmm.

  • Interesting.

  • It may not even be here, right?

  • I'm sure.

  • Can you run an algorithm with custom?

  • Oh, you know, data freak.

  • Interesting.

  • You might actually be forced to do it this way.

  • Anyway.

  • That's okay, because everyone's gonna do exactly what I do So if you don't have it, go ahead and pip install Jupiter because we're gonna be using Jupiter notebooks.

  • Once you've got Jupiter notebooks, go ahead and just type Jupiter notebook.

  • If you couldn't see that's j u p Y t e r So pip install that otherwise run Jupiter space notebook and that will open up a new window for you into here.

  • So once you've got that, uh, the next step that we're gonna go ahead and do is just Ah, go New Python three and looks good.

  • Actually, it's I'm just gonna pull this up so I know what I'm going off my screen.

  • So any time you're in a Jupiter notebook, you just kind of wanna let, um, let it know that you're using zip line and you want to use the zip line module.

  • So sublime videos, Uh, and you use this kind of the magic So load extension, zip line.

  • And that's just gonna load in zip line for us.

  • Now, um, we're going to do the simple apple by strategy.

  • This is the one that you see all the time.

  • So, basically, in quantum peon, you usually have, like, you know, you had your initialize of function here.

  • Context was being passed to it in for knowledge, is passed on initialized and then define handle data.

  • This one took both context and data for every day as iterated through.

  • Then what we could do is we could do something like order and we could say Order the whatever, you know, symbol for Apple.

  • A apple.

  • There we go.

  • Order Apple.

  • Let's order 10 shares of Apple.

  • Let's say and then we could also record things we could say a pl equals and we could use data dot current to get the current price, for example.

  • So we could against a symbol a p l um, let's see, Did a current symbol.

  • Yeah, and then we're looking for the specific field that his price So you could do that on Quantum pian, right?

  • And by the way, I'm just gonna keep referencing quant o p in.

  • Because I'm kind of assuming anybody following along here has followed the quant O P in Siri's.

  • So if you want to learn howto build strategies and stuff like that, go to the quant o p in serious because that's using zip line.

  • This Siri's right here this will.

  • Miniseries is purely for installing and running zip line locally.

  • From there, you're kind of expected to just follow the quinto peon Siri's cause It's identical syntax, Theo.

  • Only difference is when I'm about to show you is you're not gonna get away with undefined functions in variables, right?

  • So before other than context and data, right.

  • So so with, ah, with this one of the functions that were using his order.

  • Well, we haven't imported order, so we have to import these things.

  • So from zip lined a p, I wanna import border.

  • What's another one?

  • Well, record record.

  • We never imported that, um also symbol.

  • So order, record and symbol all need to be specially imported again.

  • Context and data.

  • Those air getting past kind of in the back end via this extension.

  • So you don't need to define those.

  • But like everything else, you have to define just like a regular python program.

  • So keep that in mind.

  • Do pep.

  • Eight, huh?

  • Nice.

  • Okay, so that's your, uh, your our strategy for today.

  • So now there are three ways.

  • Like I said, I'm gonna show you two real quick ways for you to run the strategy one way is if you saved this.

  • Let's say you saved this file as apple back test Stop.

  • I'm gonna copy and paste the sin.

  • You could open up a command prompt and you could run the following zip line As long as that points to the right bird run.

  • You would specify the bundle of data that you want to use, which, in this case, we're gonna use quinto peon quantities.

  • We just pulled it, uh, the file dash F that we want to run apple back, test out pie.

  • So this right here would be what contains apple isn't in the file named back to Stop Pie Apple back to stop, or I'm sorry.

  • Is it apple?

  • Yeah.

  • Ever backed up by Okay, start date, simple date format, their end date, and then the output is like this performance output that you're going to see in a moment on.

  • We just say that to a pickle by apple out topical.

  • Okay, that's one way you could run it.

  • But again, I'm not going to be using this way.

  • And I'm going to be using, um, the Jupiter notebooks.

  • So actually, the way that I'm gonna run it is again with some magic here, we're just going to say zip line.

  • It's gonna be pretty much the same.

  • So bundle I's gonna be the quant o P in, uh, Cuando bundle were going to say Start is 2000 and eight 11 So Jan 1st 2008 and will be 2012 11 And then we're gonna say the output is, um, I don't know, Strat dot pickle or something.

  • Whatever you put here issues to pickle that you can load in, it's a panda's data frame.

  • Pickled.

  • Okay, so now we can actually just run this shift.

  • Enter.

  • That's how you run all the cells, by the way.

  • So this is just gonna trade daily on the quant O P in bundle using the apple.

  • So basically, what we get here is the data frame.

  • Um, that is our performance output.

  • I'm gonna be calling that perf from now on, if you hit an air here, one of the things that they just fixed head to the the text based version of suit Auriol and check out the understanding the benchmarking process, how to overcome areas that creep in.

  • So before they were using the Google Finance a P I that stopped working and they have just replaced it with another A p I that at any point could stop working s o.

  • If you need to fix that, we can fix that relatively easily.

  • Um, anyway, it's working for now, so awesome.

  • Maybe it'll keep working.

  • And maybe they kind of fixed one of the other issues I had with that, but anyways s.

  • So hopefully if you got to this point Congratulations.

  • You've run.

  • At least you've installed zip line.

  • You've run a really basic strategy, at least on their data.

  • And now you've got this as your return.

  • Of course, this is prime.

  • Not exactly what you're hoping for.

  • So in the next tutorial, gonna show you guys how we can go about visualizing Albert results and kind of begin working with the output that we get from zip line, just like there's many ways.

  • Run it.

  • There's many ways you can work with the data from here, So that's it for now.

  • Questions, comments, concerns, whatever.

  • Feel free to leave them below.

  • If you're enjoying this content, you can support it at Python programming dot net slash Sports is my full time job.

  • So if you think I'm doing a good job, supported all my income basically comes from this, So yeah.

  • Anyway, that's it.

  • See, in the next tutorial.

What's going on, everybody.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

インストール - Ziplineチュートリアル ローカルバックテストとPythonによる金融 p.1 (Installation - Zipline Tutorial local backtesting and finance with Python p.1)

  • 0 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語