so as it turns out Goldman Sachs has an open source or open development quantitative Finance uh python package which I find really interesting you can see here that they have like a developer page and they have a bunch of solutions here in the docs they have this GS Quant which is their python toolkit for quantitative Finance which I find really interesting and I was poking around in here and I was looking for um some examp examples or some tutorials and I'll get to that in a minute I just wanted to show you that they do have a GitHub repository page as well that you can go in and take a look at um some of the things that they're doing here um some of the requirements and how to install it and when I was exploring this I saw ah excellent examples and I clicked on it and it brought me to this page and I said okay I'll keep looking around and and I poked my way through some of this stuff here and I eventually landed on this Jupiter notebook page that had several different types of um Jupiter notebooks where GS Quant was used and I found this one really interesting so this Jupiter notebook here was looking at um I think the last um election cycle and it just does a pretty interesting analysis of the FX markets based on the before and after data of the last us election cycle so I know that this year is a US election cycle so it might be kind of interesting to go through this again um of course I don't have the kind of data that Goldman Sachs has and it does look like in order to do this you do need like a session with Goldman Sachs and if I'm being honest does look like you need to create an account in order to get some of the product features that they talk about on this website here for developers but nevertheless um I did want to go through this because I briefly looked over it and I thought you know I think these guys would be pretty interested in some kind of quantitative Finance like this um you can see here that um gsan has data sets that you can import um obviously it does look like they have um some modules for importing assets and the identifiers for those assets in their security Master a security Master is typically like a company's main database for all the different Securities that pass through their their um institution so um this security Master is Goldman Sachs which I imagine is pretty wide spread and has most Securities out there considering they're one of the major players in the markets they do have a datetime module looks like they have an API for the data um this is Fred data API and I'm not exactly sure what that's pulling we'll find out a little bit uh below they of course wouldn't be a Quant module or it wouldn't be a Quant SDK if they didn't have a Time series U module here or package and it looks like they have returns and diff and then they're grabbing sklearn for PCA map plot lib and some of the other Usual Suspects looks like they create a session and this is how you would typically go about it if you had a client ID and a secret a client secret so that you could do some analytics or read product data and you can see they're going to look at the current macro landscape and understand how the risk has evolved in the last six months through the lens of PCA or principal component analysis um so what we'll talk about first is the data PCA interpreting the top two risk drivers and then I'm assuming this is like they're going to test out the returns um based on the realized data vers what the predicted is based on the PCA analysis um okay so let's just get into it so let's look at the data looks like they can pull volatility from the GS data catalog and I tried looking through their catalog but unfortunately you do need like a user ID and an account to look at that catalog um it looks like they can pull volatility data from it though and we can probably see it here so they're grabbing FX spot IRS spot volatility and the volatility from there um I'm not sure what the IR swap rates are here so they're defining a a start date and an end date and you know that's pretty typical stuff here but here they're grabbing GS data sets and this is the list of data sets that they're grabbing it looks like and um then they're putting it through these so it looks like they're getting the FX spot rate the X FX volatility IRS spot IR volatility and then they get the data based on the start and end date they're getting the Euro US D USD Japan yada yada yada looks like if this is the time uh interval I'm assuming um it sort of cuts off at the end here so I don't know exactly what goes on after that then they turn it into a pivot table and plot it so this is what it looks like um I don't need to go into the specifics of how they got to this image you know it's it's it's all right here but you can see this is just the time series plotting of the FX rates um or excuse me the FX volatility across the years right you can see in 2020 it went way way way up U but that's to be expected looks like back here there was like a a bare Market but then we had a a good good Bull Run in this in this period of time cool so um or excuse me this is volatility I need to get that through my head this is the first time I'm looking at this so this is the volatility of the FX rates um across time so you can see it was really volatile around this period which I wonder what happened around this period um cool so we get that so they do the same thing with the implied rate volatility for each of the FX rates as well looks a little bit different right all right and then it looks like they Ed the Fred API key you insert your key here and then you grab the API and they're getting the vix okay so they're just getting the um Federal Reserve something data I'm guessing um and they're pulling the vix on that and vix is an index for volatility as well so they've essentially pulled three different volatility met uh three different volatilities here um for different FX different currenc CES and then as a whole so now we move on to the PCA uh let's now look across the number of macro series to run PCA understanding what's driving risk here so looks like instruments they're setting the instruments the equities Commodities rates fxs credit fundamentals they're doing the Fred symbols here they're setting some color mapping here um and then they're setting the real volatility window ass map data frame so it looks like they're going to yep do some for Loops where they go through and um looks like they're mapping X for each instrument item okay gotcha yikes I'm not going to get too deep into this because it looks like what they're trying to do is just set a data frame for all the different instruments um across the time that they grabbed um and mapping it into the you know into the columns that they need so it looks like though that with GS Quan I want to just see so instrument items and they've Define instruments here okay and the items here okay gotcha so they've just created a few dictionaries they're going into the dictionaries and they're mapping that into um their data frame it looks like and yeah cool and they're getting the volatility data and they're doing that for a bunch of different stuff here gotcha and they're okay so they're calling get data over and over again on different things okay this is starting to make a little bit more sense to me um cool so then at the end of all that looks like they just have a pretty standard data frame of their instruments and the dates and the values of those instruments in that data frame they have 34 columns and the header is obviously five rows but I'm assuming there's a lot more um let's run a three Factor PCA for the last 260 days rolling period and record how much variance is explained by each component so this is a pretty standard PCA analysis that they're doing here um contribution to variance from each component they have three components one two three so you can visualize the three components that are driving risk across or driving volatility across the years um okay that kind of makes sense now let's look at the top two components explaining the risk in 2020 as well as over time period note components can rotate over time so we look at the absolute ratios of pc1 and PC2 and vice versa okay that makes sense uh they trained the first model on the full data set they trained the second model on just 2020 um and then they plot it and I kind of like the way that they plot this because they show like in a pretty typical like what you learn in school the positive and negative um you know graph settings here and so this is pretty interesting you kind of get an outlay of the two driving PCA um components that um affect each instrument and you can kind of see that the like FX volatility is over here versus um looks like they have okay these are just different break evens interesting so these could not be farther apart so you can see that PCA one and two are like complete opposite ends here for the you know 3m3 real uh implied real implied volatility all that good stuff BCA I find are so difficult to um read the graphs that the graphs are typically pretty difficult to read here um and I'm guessing this is just 2020 only so this is like a similar setup up here but it's only doing 2020 instead of the whole data set and you can see here like which instruments get the most um I don't know which which are affected the most by the each component and then they do some predictions verse actual so I know I sort of ran out of gas toward the end here but uh if you want to take a look um GS Quant has has a lot of interesting Jupiter notebooks that you can look through and maybe even you might want to explore the uh the GitHub repository here to see if you can you can learn some stuff anyway I just quickly threw this together um sorry if it's a sloppy video I just wanted to get it out for you guys um until next time I'll see you then bye