0: Hi, my name is weak and today, we going to be продикти маркет юзинг машин inn will buy a data on s n pe five hundred индекс зен Вил Клин дейта, апп трей мотол зен.
1: Will do back testing to экшели, фигаут, хау гуд мотол из and will to more питерс ту экьюреси и and with some next a you can use to continue н the motto on your own its going to be really fun and.
2: Project for i quest i экшли от of time н маркет, машин ленинг, компетишенс, энд девелопинг, селлинг algorithms, that of real world консолейшен вен пк.
3: The not rich wall show. You so. I show you those today, so you и r project lets тайн.
4: By this project we will have кредит машин лернинг мото н продикт тур эсэнпи файв хандред индекс пресс гивен хисторикал дэта ви олсо хэв бэк тест the motto on twenty plus еарс хисторикал дэта.
5: So, we can really be confident in the productions that its making окей, летс, у we going to be the projects, you can also use book if you have an стол.
6: And the first thing will do will импорт самсинг оо the wicked this package коллз Зея файненс эйпиай ту даун дейли так, индекс прессе энн.
7: The first thing will do is will иниша самсинг колд э тикер класс вич Вил эбл ту да prey history for a single simple in this case, we will use the джиэс, писи симпл, вич из the s. And p. Файв хандред индекс.
8: So we and then the next thing will do из и the historical пресс соу ви юз зе хистори метод and in which will деда Фром.
9: Very beginning вен зе индекс виз криэйтед соу летс ран энд ви экшели энд апп Визе вич из very very nice and in the each is the price on a single thread.
10: The so known трейдинг дэйс и not included in the state and the колом оо the opening Прейс со the praise вен зе маркет опен зе хай Прейс н the day that оо praise in the day that close Прейс вен зе.
11: Cloud and the vol со the total, vol соу вили use this to продект и the star go up or down to.
12: We also have this additional колем dividends энд стак, сутс мувер.
13: So will take a look at the index of the эсэнпи, файв, хандред, детей, and we can see we have a date time, индекс and the index is the this come on the left, if you know and.
14: Weable. А он to really индекс слайде фрейм изили.
15: Right so the first thing will do из the plot the data in the н со и plot the closing Прейс агентств зе индекс.
16: So what this is doing is its saying шоу the index вот is really the трейдинг days, the dates on the x and show the closing Прейс, он the y axes соу ви кэн ран, and we got a nice of the эсэнпи файв хандред, пей хистри энд.
17: Really regret not buying the index фонд энни поинт ин the last few years.
18: Will do a слайд пид of data cleaning her вас ремув экстра ви донт нид соу ви ремув видео and we also remove так сплит Кола.
19: This comes a more for individual стакс н индекс соу ви донт экшели ниде.
20: And and the next thing we do it up таргет со зис из вот акши гоин ту би продикти Юзин машин соу зисе из гоин ту би Визе прайс, апп оо даун ту so some people like to продект.
21: Абсолют прайс соу трейн проект the star will b seventeen dollars туморол биг биг проблем из or metal can be extremely ю can be very good product in the absolute Прейс бат ю кэн.
22: Money because ultimately иф ю баинг и селлинг старкс ю донт он the absolute пресс bright you care more геттинг экью он the direction out if the praise Вилл гоу апп оо даун соу ю no can i buy the stark and then.
23: Up you can be really close to in the экш прайс, n t to be, very форбан н. Протин, иф зе стакдаун, соу, вигона трай ту ду из say the stack o up can we экшели продект.
24: Go up and that way if we wanna buy the stock, we know we are and the place go up so, а target is going to be will её так, so first we call tomorrow and бейсики.
25: Going by it gonna be tomorrows, пресс энд Вил ю shift to help so show you what экшели happen?
26: So we talk that close come and then we шифт и all the praise is back one so you can see фо дженефер найнтин фифти зе тумороу, кам из now the praise. Он дженефер зе клоузинг Прейс соу ви ви.
27: Have a calling the shows tomorrow прайс.
28: Then bust on tomorrow прайс ви на set up a target со the target is what we gonna try to product with machine ma, and really all we need to do with the target is is tomorrows Прейс грейтер зен тудей пёс.
29: So this бейсики ретерн буллион, indicating a tumor praise из e today at vi шелли конверт соу ви кэн, ю машин, ленин со v and an integer.
30: Окей, c type so now we gonna show the эсэнпи файв андре де n. We can see we know have a target this one one the praise Ван апп с that's Ван Тумар Прейс.
31: And it zero then the price went down, and this is what we gonna try to product that next thing will do is the lot of историка дэйта ин зе Сетифе, энд южели э лот оф historical data is great but.
32: Data if you go back to for the market шифт ид фундаментали энд сам all the not be useful and making фьючер продакшнс соу вот we gonna do is we gonna remove the came for найти?
33: So we are going to use the pen метод эо c and basic ли say only take the rose the the index is a list, найти на genie first and we can take a long what happened, and you can see.
34: Only dates автор дженнера ферст найти, найти нау, ай, Роут, дак капи, энд ай, рот, the date, капи, иф, ю, донт, ю, can sometimes, get, пендес, сеттинг, виз, капи, ворнинг, вен, ю трай ту.
35: So the дак апи.
36: Ok, so we ну да, and we can экшели старт ту трейн, а first machine мотол соу летс, а and more random forest, a i love to use random?
37: Force is my default мотол фо мост машин ленинг фо фьюри соу Ван рэндом форест ворк бай трейнинг н. Индивидуал дисижен 3 with and then эвердин зе резолт Фром дисижен 3 со.
38: This process фо а резистен ту овер зей кэн от bad its over the only quickly and they can pick up none н тенденции и the data so.
39: For example, the open прайс из not lie with the target форэкса оф the open прайс из форсан версис 3 саузенд зериз ноу линии релейшен шоп битвин зе опен прайс n. The target if the open прайс из хаер её.
40: Target we also be high so more can pick up on relationship, which star продекшен мост the релейшеншип на line you can find the ли релейшеншип зен ю can make a money.
41: So the initial айзер мотол.
42: And we have passed and a few so and эстимейт из the number of individual дисижен 3 v one train the a this is generally the bear апп лимит, райт ю кэн джаст гет фри си мейк.
43: Quickly you try this year, min, симпл сплит и help protect, ген. Дисижен, 3 с have оверфит, иф зей, билд зе 3 too deeply иф ю.
44: Don't know much about дисижен 3 don't worry about it but setting н симпл сплит о project версии the a v с. The last you the motor will be but the less оверфит со в experiments with and just fine.
45: And im gonna set random state эквл ту Ван соу а random forest as you guessed хэз зен блин, so setting a random state means that if we run the same to twice the?
46: Numbers generate Вил би проектаб сиквенс, ич тайм юзи 100 one so, if we и twice Вилл get the same results, вот хелпс, иф ю дети, прувинг, модул энд ю меке.
47: Module, you prove версии до ok? Now we are up in to a train and test now this is time, data and this time.
48: Series data you can you asian оо you can, but if you do then look amazing when your training and horrible ин the real world and the reason why is if you use крашен о another way too sad, а training in testa.
49: Take your time series in to account you will be the future project the past, which you do in the world, and m. Ликин информейшен.
50: So if i at product та tomorrow and i give you what the are gonna be in thirty days you do продект, а tomorrow then if i don't tell you anything about the future, so we won't оо ту экшели н h e. Продект.
51: Star place not just н v h have termanology about the future have in the road, so the way it up is we are going to put all of the ооо accept the last hundred in to the.
52: And we put the last hundred роуз ин ту зе тест, а show you more way to экшели путлер, бат фо нау и simple bell and this is easy to do сет.
53: Прожекторс соу айм гонна криэйт в we going to you took the target now i like to be really эксплее прожекторс, а been born before by just that comes as прожекторс.
54: And more looks amazing when im training in bright like hand in the real world work what really easy to do is sir use the tomorrow колом оо the target Кола il продект зе таргет энн.
55: Вот хэппенинг из модал экшели ноуз see future white witch is happen in the real world right, so this close i use volume опен хай, n. Low so that gonna be a прожекторс.
56: And we do is ви на go heat and fit the mode so more fit train прожекторс со зис из прожектор колом энд then we are going to try продект зе таргет.
57: So this is gone train the motor or using the продикто колом, ИНН продикт зе Гетт со летс тэйк э little bad to run now Ван финиш о next stop is экшели ту ру the мотол из.
58: This is really important пис оф машин, лернинг райт ю нид ту межер иф оо и doing you so so we, импорт, эген Фром, ви гона, импорт сами Песин, скор энд ол, the precision ско.
59: Из, sir, when we said, the market апп в when the cup соу вот of the time. When we said, the market оо апп, экшли, гоу апп. And this is экшели.
60: Really good a metric экьюти метрик фо зис партикуляр, кейс бикоз айм сумме зис кейс ви вонт ту бай так and when we by stock we wanna hold that stuck and and.
61: We were there, when we by stock the stock place из экшели гоинг из so depending on what you want, and what you go, you me just метрик юзинг ту межер, перформанс, бат ин зис кейс?
62: Score so. We generate продакшенс юзино из продект метод and pass in this продактом. Продакшенс, зис продакшенс. А in a.
63: Nam what is a work so we акули на turn this in two and serious and use the same индекс тест y эту импорт пендос.
64: So we импорт не series, and we can see продекшен из now, a series and it's lilith the and then we экшели калкулэйт зе пресижен кор соу.
65: Score, юзикл, таргет энд продактив, таргет энд ви кэн си зис из нот a very good thing right so when we said that start ей вид гоу апп and only one апп форти ту персент оо the time.
66: Great we be экшли трейдин агентств зис мотал туин то to do, but thats okay we gonna make this motel better, and we will be able to get more accurate продакшенс.
67: Okay so the next thing will do из вот just квикли плата продакшенс энд ту ду зэт ви Вил комбайн экш вальюс виза продактив вальюс энд Вил юз зе пендес функшн ту ду.
68: So, we can t our test target which из экша вальюс энд продактив вальюс энд and passing ак сикес Ван вич минс 3 each of these импут эс ин да now.
69: We can do we can and watch this as is the line Зиро из а продакшенс энд the blue line is вот экшли соу, ви кэн си ви мостли, productid зе зе маркет, в glow up.
70: Explain. Why are продекшен?
71: The next thing we do is best way to test so we only able the test агентств ласт хандрид, эс бат, иф ю рили, билдинг, стак, пресс, мотал, энд ю.
72: The real world you wanna be the test её кра молтби райт ноу хау алгоритм от of different situations that give you more confidence ворк ин the future so we gonna do is we gonna.
73: Something back testing and an order to nail a testing the first thing will do из кри продекшен функшн н. Бейсики джаст апп эврифинг ви джаст дэд ин ту Ван фанкшн соу итс зе фитинг оф зе.
74: Training protectors, энд, the target.
75: Its дженрейтинг, продакшенс и modo да, продект тест продектовать ту сириус вот копии пейст.
76: Дин из а. Геев ним production and finally its combining эврисин Сёмин, видид бифор, энн ретерн, а combined ей векш вальюс ин the production.
77: Now we can do is back тест функшн, вич, тейкс ИНН эс and pe five hundred the machine motor э, продикто ит оо тейкс ИНН, в which will set to twenty five hundred and a step валю.
78: So what is this star so when you back тест ю он have a certain, а of data to train your first module, so every трейдинг, а has about two and fifteen days so this is sane.
79: А and train first мото виз на and the step is to fifty вич минс зет ви Вил би трейнинг, мото фо эбаут её and then going to the next r and going to the next year so.
80: What we gonna do is we gonna take the first ten иерс оф дейта энд продект вельюс, фор зе лёвен Вилл тейк зе ферст лёвен ерс оф дейта продект в for that there will take the first с of data продект вюс фо зе.
81: And so and these they will окшелек продакшенс фор э лот оф дифферент её and have more confidence, so in this back тест функшн ви го крит лист колд олл.
82: The of data frames, which data frame и the продекшен фо сингл е and then we are going to крит фанкшн ту луп э кросс, дэта.
83: And make продекшен фор ол зе ерс эксепт зе ферст, её and then we split up, a training and a test тейта.
84: I use the date капи ту войдёт сатин, виз, капи, ворнинг.
85: And this code is doing экзакли вот the training set in the test the training set is all of the year to the year, and the test is the care than we use продект функшн, ту не production.
86: Трин тест прожектор ИНН мото.
87: Then we to production впенд, а production for giving под so he can take a list of н. Комбайн.
88: Mean to a single death, so lets go and run this, and then what we can do is back тест or?
89: S. N. Pe five hundred деда виз зе мото ви криэйтед ор n. With the продектовать олир энд афтер, ви финиш, зе бэктест, ви кэн экшели старт evaluating the air of a продакшенс соу ферст лутс тейк лук эт продакшен.
90: And see how many days we к the market go up down so валют-ка а how many times each type of production with me so we can see ви продикти зе маркет в go down.
91: On about three thousand days, we проект the market, we go up on about to thousand days, and now we can экшли Лукин скор.
92: And we can take the target, and we can take the protections.
93: And this will give us a precision скор окей, соу кросс о this rose is about six thousand and so трейнинг, дэйс ви вер эбаут, фифти фри, персент, Аккре precise, so when we said, the market вид гоу апп, вен, апп фифти.
94: Persona the time.
95: Now is the good so бэнчмарк, ви кэн о days, the market экшели н and to do that we can look at the wall of the target divided by the number оо роуз.
96: То and guess so the n pe five hundred in the days we looking экшели Ван апп фифти 3 point six days, and then down six point free, просент Дейс соу иф ви олви хэв дан this just wake.
97: Everyday and say, i buy and sell under the day we экшли форме just a z. Окей.
98: Now we have бэк тестинг ви экшели хэв от of confidence in a motor and a tester.
99: So the next thing will do i adore продикто а motor, and sirius райт, соу, гона ду, ви гонна и id links соу.
100: If if you just human last train to предиктив э стак в glow up tomorrow, Самаре намберс ю май лук из the stock place today was last week, was free men go go five.
101: And you might imports to help you determine if that stuck down, and we give information so what the horizon on which we looked?
102: So we calculate the mean клоуз пей ин the last two days the last трейдинг вик вот из five days the last three монсеро вот из six трейдинг дэйс зе ласт е and the last four years.
103: And then will find the реш битвин, тудей Козин Прейс энд the closing Прейс н вот и help no n, дак он даун би ду оо апп swim.
104: So we give the algorithm мор информейшн ту хелп мейк продекшен энди с call new продектовать холд сам the new крит, окей, соу ви гона лук тру зис.
105: And then we gonna каплей роллинг эвередж.
106: Against the horizon and вот take that mean and then what we can do is экшели крейт, э капл, оф кос, соу, Ван Вил, би колд, реши кам энд Вил, нейм, зе кам, клоуз, реш.
107: So close реше ту клоуз реше файв её and then we added to c and pe five hundred да фрейм, соу, ол зис, ис гонна, би из the clothes прайс ин зе.
108: Five hundred divided by роллинг эри.
109: So the first time to the loop зис из гонна би зе ре битвин, тудейс, клоуз энд the a closed and lost two days секонд тайм ту the loop, it by the реш битвин, тудей, клоуз зе эдж клоуз ин ласт файв, дэйс энд and so we can also.
110: Trend and the trent b number of days in the past the horizon the айс экшели Ван апп
111: And where we can do here i say тренком иквел соу вот will do is will you shift again и shift four and then what will do is will find роллинг сам?
112: Ok of that so what is this too вот scroll, up and find and pe five андре дерен соу, вот this is gonna do is it is going to on a given day, it is going to look.
113: Past few days and see the other the sum of the target соу иф вер он дженни эйт найнтин найти its gonna look at the last four fives and find some the target.
114: Only for the well, so in really we won the computer роллинг сами to take the сам so that some of the number of days the start Прейс экшели Ван апп.
115: Ok and then, we add this to new прожекторс.
116: Рише колом фрэнком.
117: So tom and we should know have extra колом нас and pe five hundred days, and you can see the lot of words so so whats туда, so when пенне от find in?
118: Из rose праер ту зе Карро-таки computer роллинг эдж джаст ретерн э соу зис из клоуз реше ту what is best он он edge of the two days prior to эннинг зе карне соу.
119: Genere секонд найти, найти the а no days before this so i can экшели компьют роллинг сам со ретернс н о ретернс нэм, он Дженнет на can write text офис.
120: And the prince with this cause its different for, and include the ей so here its looking for two, привьёте ит да, include the Карандей и lt did.
121: Including today таргет ин the color, which will give you like and make look amazing, but it's not work in the real world, so we get some extra колом юзинг да x.
122: Sorry, this, the missing, роуз соу, ви нау си, а data start in найти free that in ванён эн ванён с so we need it about four years of data action компьютерс.
123: So lets see how is? Performed?
124: So lets lets апдейта модул лайкли энд соу инкрис намбер оф эстет ту ту хандред энд ви Вилл редьюс мин симпл сплет.
125: Two feet and will keep a random state so let она and then we re write a продект фанкшн ли со Капин песе?
126: So here when you just run date, продект, бейсиклабораторная ви экшели Ван из мо контрол о how we define Ван энд вот com zero соу ви.
127: Project проба метод and watch this will return из экшели э проба, зе роу Вил би э Зиро ор Ван соу, ретерн зе probability that start пёс Вил гоу даун тумороу энд зе пробли зе.
128: Price, will go апп, Тумар соу вот we can do is just get the calm of this, which will be the probability стаей гоус апп, and then what we wanna do it custom фрэш соу бай дифолт зе фреш?
129: Point five so if the грейтер, зен фифти, просент зе Прейс апп тёрн, её the pray, but we акши сепер сиксти, сент соу зис минс зе хэс ту би мор, конфидент.
130: The price up in order to экшели шоу, the price up and watch this will do из редьюс, то numbers of трейдинг дэйс соу и reduce the number of days that продект зе прайс во up but will increase the chance that the price.
131: Экшели гоу апп он, но days, which its really well with what we want right, we dont make a tongue of trace we know when we make a trait that praise экшели, гоу апп бат ви донт н трейд, everything day thats ever lose money пути квикли энд зе рест.
132: This function should be the same so let вот h. And ran back тест эген.
133: And this time in new прожектор ю main using the clothes open Хайло вольюм, комс энд. The reason for that is so just абсолют намберс райт соу ит из супер информатив ту the motto.
134: If the praise тудей из for hundred sixty five dollars, i doesnt tell me anything about the praise, vi er down tomorrow the wreck the most информ опарт, вот is the praise тудей о to the praise ясстре компьер ту the praise ласт вик со зэтс вай ви эк.
135: Alt right, so once the back, тест из don, what we can do is we can take a look at.
136: The well, you count again оо the продекшен.
137: So you remember last time there about three days were продикти зе Прейс в go down and about two and dave продактив зе Прейс вуд гоу апп соу да, the last time the distribution is very different now you can see.
138: Only a few days that we've проект the praise вот go up and thats из we change the страшат райт ви ви аст a modo il be more confidence in its продакшенс бифор ит экшли, продикти её the praise вот goa, and what this means из.
139: В акши гонна би трейдинг, в би баинг сток он фью дэйс бат холли энд the about to find out hall we will be more on days, so we will check the precision скор.
140: And we looked таргет энд and will look at r. Продекшен.
141: And we can see when we buy сток соу, вен зе мотал продикт её the place will go up fifty seven просент оф the time, i will экшели гоу апп соу, зис ми нот си грейт райт, фифти севен, просент фейлин, грейт ИНН, мост, places but it's эк.
142: Red special гивин, её we just looking a time is dead end justice хисторикал пресс оф the index is вот экшели мейк ю money, if you trade offer from найти, найти free to the now what i рекомен.
143: Using this module to go make trades ноу, the you can add to to make it more talk about but this is экшли и good result, in the day we have to work with and its right so the stack.
144: About fifty three persons the days, but a moto из экшели.
145: Он to by fifty seven the time okay so and talk about.
146: Extend your small, so we did love right, we done some stock деда фо зе эсэнпи файв хандред, индекс ви Клин энвила, её dead we set up machine таргет ви.
147: Нил мото ви вьёте эр эту бэк тест a really your other other long, periods of time then we improved мото экстра прожектор Колос.
148: So if you wanna continue extending зис мотол, сами of рекоменд Синкин, эбаут соу зе Энже, её open овернайт, соу, зе эсэнпи, файв, хандред онли, трейд юэс, маркет арс бат зе Азер, индести эраунд.
149: World open before the us маркетс, опен соу, иф май би во. Лукин, доуз prices and seeing if you can экшели её rise if an index on the other side the world is инкретин тут help продект эс and pe five hundred at you can.
150: News so that includes артикул the coming out дженерал макроэкономик conditions like interested, инфлейшн, эта you can also think about in some key components of the эсэнпи, файв, хандред лайк ки стакс.
151: Sectors its possible that for example, if тэк и down turn it possible that six н и five hundred в go down maybe don't go down, или so thats an you can try you can also try increasing the resolution райт.
152: Looking дейта хир а you try луи и data my tech та ивен иф ю т изи тут but if you are you can make more Юре продакшнс соу джаст.
153: My diane take this, but i know ролл экспириенс ю они от if you, if you want it right, so l p u.