Sir, you clearly explained both financial and coding keywords better than my professors did in 4 years of schooling. You're a great teacher!!
50min in and am already in love with the style of teaching. Errors are left in the vid as well as the logical process of debugging them, everything he mentions are backed up by examples. Superb content
to whom it can be of use: if you're stuck because of a KeyError 'DISCA', that is because the original stock list has had some change. You can solve it by using a try/except block when doing the the iteration for the final_dataframe = final_datafrme.append(.....) . Just put all of that inside the try block, and then do an except KeyError, and handle the eroor
Rather than counting zeros, an easier way to input large numbers with many zeros is to use e-notation: 3e3 (which equals 3 * 10^3, or 3000) 10e6 (equals 10 * 10^6, or 10000000) 8e100 (equals 8 * 10^100, or 80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
thank you so much for this course!!! I started my coding journey with Free Code Camp, I now work full time as a developer. This topic is on my to do list!!!
Note that there are a few pops in Nick's sound at the beginning, but these go away completely once he starts building projects at the 17:20 mark.
I don't comment often but this guy is an amazing teacher. He explained everything in such good detail. It helped me as I need a deep understanding of a topic to grasp it completely. Keep up the great work.
@2:09:00 you can use the code below to ensure you have a valid number by looping until the user has inputted a numerical value. Thanks for the great video! while True: try: portfolio_size = float(input("Enter the size of your portfolio: $")) break except ValueError: print("Please enter a valid numerical value in $")
52:39 If you stuck with appending series to a dataframe like me, this method(.append) returns a new object, so if you want to see the result, you should assign final_dataframe to new variable and then print it. new_dataframe = final_dataframe.append(pd.Series( [ symbol, price, market_cap, 'N/A' ], index=my_columns ), ignore_index=True ) print(new_dataframe.to_markdown())
at 2:28:12 While implementing the percentiles, I noticed that the data I am receiving has None type in it. So the scipy.stats module throws an error as it cant compare the None type instances. For now I am replacing it with 0. Just for people who face this error you can just add this right before you assign your return percentiles for row in hqm_dataframe.index: for time_period in time_periods: if hqm_dataframe.loc[row,f'{time_period} return'] == None: hqm_dataframe.loc[row,f'{time_period} return']=0
In 58:05 for anyone don't want to use yield, you can use list concatenation for both symbol_groups and symbol_strings symbol_groups = [list(stocks.Ticker)[x:x+100] for x in range(0, len(list(stocks.Ticker)), 100)] symbol_strings = [(',').join(i) for i in symbol_groups]
I LOVE how you go through your own process of debugging. It really helps me.
Just as a safety precaution since you never want to trust someone to know what to do you can use a while loop for the input validation: invalid_input = True while invalid_input: try: portfolio_size = input("Enter the value of our portfolio:") val = float(portfolio_size) print(val) invalid_input = False except Exception as exception: print("You must enter an integer")
Amazing video! Thank you so much for sharing this! Still going through it, but there's an observation I need to make for any beginners that might stumble upon this video: To create a new column with values based on another column(s), using a for loop to iterate through rows and make calculations (as shown in 2:31:11) will be EXTREMELY inefficient on larger datasets. It is better to use Pandas' `apply()` method paired with a `lambda` function, as follows: ``` # create list with time periods time_period = ['One-Year', 'Six-Month', 'Three-Month', 'One-Month'] # create new fields (or update existing ones) based on previous list # and calculate percentile based on Price Return for i in time_period: change_col = f'{i} Price Return' percentile_col = f'{i} Return Percentile' hqm_dataframe[percentile_col] = hqm_dataframe.apply( lambda x: score(hqm_dataframe[change_col], x[change_col]), axis=1) ``` Same method can be applied to calculate HQM Score using Pandas' `mean()` method: ``` hqm_dataframe['HQM Score'] = hqm_dataframe.apply( lambda x: pd.Series([x[f'{time_period[0]} Return Percentile'], x[f'{time_period[1]} Return Percentile'], x[f'{time_period[2]} Return Percentile'], x[f'{time_period[3]} Return Percentile'] ]).mean(), axis=1) ```
finished the entire thing in one sitting. Loved it! its an amazing course if you are starting out algo trading!
Thank you that you didn't edit video, these debugging/looking for error processes actually make things more clear. And teach how to deal with such cases. And thank you for this video at all, it's great!
31:51 great tutorial; however, IEXCloud shut down this past August 2024. How can we work around this? Are there any other APIs with sandbox mode we can use as an alternative?
Furthermore, you could try to 1) follow the approach of Ang (2009) and exclude firms with the lowest 5% of market valuation (and not only prices <$5<$5). 2) Exclude firms with negative book-value (common approach like e.g. in Fama/French (1992). 3) Also, skip the most recent month for calculating momentum. This is called 2 - 12 momentum strategy.
So far I have only used my python knowledge to program basic games, automation widgets and a few data scrappers but this... My head just exploded with curiosity!🤯 Thank you so much!
@XenonFH