{"id":326,"date":"2020-05-11T10:33:56","date_gmt":"2020-05-11T10:33:56","guid":{"rendered":"http:\/\/lucylabs.gatech.edu\/ml4t\/?page_id=326"},"modified":"2020-08-14T04:02:51","modified_gmt":"2020-08-14T04:02:51","slug":"manipulating-financial-data-in-python","status":"publish","type":"page","link":"https:\/\/lucylabs.gatech.edu\/ml4t\/manipulating-financial-data-in-python\/","title":{"rendered":"Manipulating Financial Data in Python"},"content":{"rendered":"\n\n[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.4.6&#8243;][et_pb_row _builder_version=&#8221;4.4.6&#8243;][et_pb_column _builder_version=&#8221;4.4.6&#8243; type=&#8221;4_4&#8243;][et_pb_text _builder_version=&#8221;4.4.6&#8243; hover_enabled=&#8221;0&#8243; header_font=&#8221;|||on|||||&#8221;]<h1 id=\"firstHeading\" class=\"firstHeading\" lang=\"en\" style=\"text-align: center;\"><span dir=\"auto\">Manipulating Financial Data in Python<\/span><\/h1>\n[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.4.6&#8243;][et_pb_column _builder_version=&#8221;4.4.6&#8243; type=&#8221;4_4&#8243;][et_pb_text _builder_version=&#8221;4.4.6&#8243; hover_enabled=&#8221;0&#8243;]<h2><span class=\"mw-headline\" id=\"Lesson_1:_Reading.2C_slicing_and_plotting_stock_data\">Lesson 1: Reading, slicing and plotting stock data<\/span><\/h2>\n<ul>\n<li>Overview of the data we&#8217;ll be working with (from Yahoo!)<\/li>\n<li>Introduction to our primary library: Pandas<\/li>\n<li>Reading CSV data into Pandas<\/li>\n<li>Filtering to specific dates<\/li>\n<li>Plotting<\/li>\n<\/ul>\n<p>Reading: &#8220;Python for Finance&#8221;, Chapter 6: Financial time series<\/p>\n<h2><span class=\"mw-headline\" id=\"Lesson_2:_Working_with_many_stocks_at_once\">Lesson 2: Working with many stocks at once<\/span><\/h2>\n<ul>\n<li>Our target data frame structure<\/li>\n<li>Address reverse order issue<\/li>\n<li>Reading data for multiple stocks into the structure<\/li>\n<li>Date slicing<\/li>\n<li>Symbol slicing<\/li>\n<li>Plotting<\/li>\n<li>Normalizing<\/li>\n<\/ul>\n<h2><span class=\"mw-headline\" id=\"Lesson_3:_The_power_of_Numpy\">Lesson 3: The power of Numpy<\/span><\/h2>\n<ul>\n<li>What is Numpy and how it relates to Pandas<\/li>\n<li>Why is Numpy powerful\/important?<\/li>\n<li>Creating Numpy arrays<\/li>\n<li>Indexing and slicing Numpy arrays<\/li>\n<li>Important data processing on Numpy arrays<\/li>\n<li>Example use with pandas too<\/li>\n<\/ul>\n<p>Reading: &#8220;Python for Finance&#8221;, Chapter 4: Data types and structures<\/p>\n<h2><span class=\"mw-headline\" id=\"Lesson_4:_Statistical_analysis_of_time_series\">Lesson 4: Statistical analysis of time series<\/span><\/h2>\n<ul>\n<li>Gross statistics on dataframes<\/li>\n<li>Rolling statistics on dataframes<\/li>\n<li>Plotting a technical indicator (Bollinger Bands)<\/li>\n<\/ul>\n<p>Reading: &#8220;Python for Finance&#8221;, Chapter 6: Financial time series<\/p>\n<h2><span class=\"mw-headline\" id=\"Lesson_5:_Incomplete_data\">Lesson 5: Incomplete data<\/span><\/h2>\n<ul>\n<li>How incomplete data arises in financial data<\/li>\n<li>Different approaches to dealing with it<\/li>\n<\/ul>\n<h2><span class=\"mw-headline\" id=\"Lesson_6:_Histograms_and_scatter_plots\">Lesson 6: Histograms and scatter plots<\/span><\/h2>\n<ul>\n<li>Histogram of daily returns<\/li>\n<li>Compare SPY with XOM<\/li>\n<li>Scatter plots<\/li>\n<li>Correlation is not slope!<\/li>\n<li>Compare SPY vs XOM, with SPY vs GLD scatter plots<\/li>\n<\/ul>\n<p>Reading: &#8220;Python for Finance&#8221;, Chapter 5: Data Visualization<\/p>\n<h2><span class=\"mw-headline\" id=\"Lesson_7:_Sharpe_ratio_.26_other_portfolio_statistics\">Lesson 7: Sharpe ratio &amp; other portfolio statistics<\/span><\/h2>\n<ul>\n<li>Speed up reading data by memoizing<\/li>\n<li>Average daily return<\/li>\n<li>Volatility: stddev of daily return (don&#8217;t count first day)<\/li>\n<li>Cumulative return<\/li>\n<li>Relationship between cumulative and daily<\/li>\n<li>Sharpe Ratio<\/li>\n<li>How to model a buy and hold portfolio<\/li>\n<\/ul>\n<h2><span class=\"mw-headline\" id=\"Lesson_8:_Optimizers:_Building_a_parameterized_model\">Lesson 8: Optimizers: Building a parameterized model<\/span><\/h2>\n<ul>\n<li>What does an optimizer do?<\/li>\n<li>Syntax of optimizer use<\/li>\n<li>Problem statement for an optimizer (inputs, outputs, assumptions)<\/li>\n<li>How to find X that minimizes f(X) with a minimizer<\/li>\n<li>How to build a parameterized polynomial model from real data using an optimizer<\/li>\n<\/ul>\n<h2><span class=\"mw-headline\" id=\"Lesson_9:_Optimizers:_How_to_optimize_a_portfolio\">Lesson 9: Optimizers: How to optimize a portfolio<\/span><\/h2>\n<ul>\n<li>What does it mean to &#8220;optimize&#8221; a portfolio<\/li>\n<li>Framing the problem for an optimizer<\/li>\n<li>Constraints on X for an optimizer<\/li>\n<li>Ranges on X for an optimizer<\/li>\n<\/ul>\n<p>Reading: &#8220;Python for Finance&#8221;, Chapter 11: Statistics-Portfolio Optimization<\/p>\n[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]\n\n","protected":false},"excerpt":{"rendered":"<p>Manipulating Financial Data in Python Lesson 1: Reading, slicing and plotting stock data Overview of the data we&#8217;ll be working with (from Yahoo!) Introduction to our primary library: Pandas Reading CSV data into Pandas Filtering to specific dates Plotting Reading: &#8220;Python for Finance&#8221;, Chapter 6: Financial time series Lesson 2: Working with many stocks at [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-326","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":3,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/326\/revisions"}],"predecessor-version":[{"id":648,"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/pages\/326\/revisions\/648"}],"wp:attachment":[{"href":"https:\/\/lucylabs.gatech.edu\/ml4t\/wp-json\/wp\/v2\/media?parent=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}