├── Example - AAPL.xlsx ├── Example - MSFT.xlsx ├── assets ├── img │ ├── p01.png │ ├── p02.png │ ├── p03.png │ ├── pic1.jpg │ ├── pic2.jpg │ ├── pic3.jpg │ ├── ser01.png │ ├── ser02.png │ ├── ser03.png │ └── ipad-hand.png ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.svg ├── css │ └── main.css └── js │ └── bootstrap.min.js ├── package.json ├── MSFT_Ratios.csv ├── AAPL_Ratios.csv ├── app.js ├── README.md ├── AAPL_Analysis.csv ├── MSFT_Analysis.csv ├── index.html ├── AAPL_IS.csv ├── MSFT_IS.csv ├── scraper.py ├── MSFT_BS.csv ├── AAPL_BS.csv └── server.py /Example - AAPL.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/Example - AAPL.xlsx -------------------------------------------------------------------------------- /Example - MSFT.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/Example - MSFT.xlsx -------------------------------------------------------------------------------- /assets/img/p01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/p01.png -------------------------------------------------------------------------------- /assets/img/p02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/p02.png -------------------------------------------------------------------------------- /assets/img/p03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/p03.png -------------------------------------------------------------------------------- /assets/img/pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/pic1.jpg -------------------------------------------------------------------------------- /assets/img/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/pic2.jpg -------------------------------------------------------------------------------- /assets/img/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/pic3.jpg -------------------------------------------------------------------------------- /assets/img/ser01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/ser01.png -------------------------------------------------------------------------------- /assets/img/ser02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/ser02.png -------------------------------------------------------------------------------- /assets/img/ser03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/ser03.png -------------------------------------------------------------------------------- /assets/img/ipad-hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/img/ipad-hand.png -------------------------------------------------------------------------------- /assets/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhemani/Finco./HEAD/assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ibanker-frontend", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "http-server" 9 | }, 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /MSFT_Ratios.csv: -------------------------------------------------------------------------------- 1 | "ROA % (Net)","7","14.02","16.58","14.72","23.77","22.88","19.34", 2 | "ROE % (Net)","14.36","26.17","30.09","27.43","44.84","43.76","38.42", 3 | "ROI % (Operating)","15.94","26.82","30.97","29.47","44.85","49.47","49.92", 4 | "EBITDA Margin %","24.17","35.62","37.77","32.62","42.13","41.8","35.62", 5 | "Calculated Tax Rate %","34.12","20.65","19.18","23.75","17.53","25","26.5", 6 | "Revenue per Employee","793,051","678,383","786,354","782,144","777,144","702,067","628,355", 7 | -------------------------------------------------------------------------------- /AAPL_Ratios.csv: -------------------------------------------------------------------------------- 1 | "ROA % (Net)","18.06","19.39","28.08","27.14","21.78","12.24","14.93", 2 | "ROE % (Net)","33.7","30.72","42.15","41.79","37.16","23.41","27.26", 3 | "ROI % (Operating)","36.64","37.98","55.79","54.47","48.76","31.43","35.39", 4 | "EBITDA Margin %","32.83","32.43","37.03","32.79","29.52","22.66","20.67", 5 | "Calculated Tax Rate %","26.13","26.15","25.16","24.22","24.42","28.56","29.89", 6 | "Revenue per Employee","1,889,662","2,030,563","2,023,349","1,714,793","1,323,971","995,581","927,870", 7 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | angular.module('fincoApp', []) 2 | 3 | .controller('tickerCtrl', ['$rootScope', '$scope', '$location', '$window', function($rootScope, $scope, $location, $window) { 4 | 5 | 6 | $scope.getReport = function () { 7 | console.log($scope.ticker); 8 | 9 | var str = 'https://dfxievhldg.localtunnel.me/csv/' + $scope.ticker; 10 | console.log(str); 11 | 12 | $window.open('https://dfxievhldg.localtunnel.me/csv/' + $scope.ticker, '_blank'); 13 | 14 | 15 | } 16 | 17 | }]) 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Finco. 2 | 3 | Finco. was created by two Business and Computer Science students who realized the bottleneck in the investment banking industry. Financial analysts and stock traders spend countless hours crunching numbers and navigating between multiple reports. Finco. compresses all this information, scrapes the web, and provides accurate valuations as well as other financial documents. 4 | 5 | Finco's automates the process of generating financial documentation and valuations for companies traded on the NASDAQ and NYSE. Provides user with a live stock price index, current balance sheet, liquidity ratios, current income statement, and a projected discounted cash flow statement. 6 | -------------------------------------------------------------------------------- /AAPL_Analysis.csv: -------------------------------------------------------------------------------- 1 | "Revenues","182,795,000,000","170,910,000,000","11,885,000,000","6.95","49,605,000,000","74,599,000,000","(24,994,000,000)","(33.50)","0.05","0.23", 2 | "Direct Costs","112,258,000,000","106,606,000,000","5,652,000,000","5.30","29,924,000,000","44,858,000,000","(14,934,000,000)","(33.29)","0.09","0.23", 3 | "Gross Profit","70,537,000,000","64,304,000,000","6,233,000,000","9.69","19,681,000,000","29,741,000,000","(10,060,000,000)","(33.83)","0.01","0.22", 4 | "Taxation","13,973,000,000","13,118,000,000","855,000,000","6.52","3,796,000,000","6,392,000,000","(2,596,000,000)","(40.61)","0.00","0.25", 5 | "Net Income","39,510,000,000","37,037,000,000","2,473,000,000","6.68","10,677,000,000","18,024,000,000","(7,347,000,000)","(40.76)","(0.02)","0.23", 6 | "EPS Continuing Basic","6.49","5.72","0.77","13.46","1.86","3.08","(1.22)","(39.61)","0.01","0.24", 7 | "EPS Net Basic","6.49","5.72","0.77","13.46","1.86","3.08","(1.22)","(39.61)","0.01","0.24", 8 | "EPS Continuing Diluted","6.45","5.68","0.77","13.56","1.85","3.06","(1.21)","(39.54)","0.01","0.24", 9 | "EPS Net Diluted","6.45","5.68","0.77","13.56","1.85","3.06","(1.21)","(39.54)","0.01","0.24", 10 | -------------------------------------------------------------------------------- /MSFT_Analysis.csv: -------------------------------------------------------------------------------- 1 | "Revenues","93,580,000,000","86,833,000,000","6,747,000,000","7.77","22,180,000,000","26,470,000,000","(4,290,000,000)","(16.21)","0.06","0.06", 2 | "Direct Costs","33,038,000,000","26,934,000,000","6,104,000,000","22.66","7,468,000,000","10,136,000,000","(2,668,000,000)","(26.32)","0.18","0.16", 3 | "Gross Profit","60,542,000,000","59,899,000,000","643,000,000","1.07","14,712,000,000","16,334,000,000","(1,622,000,000)","(9.93)","0.02","0.02", 4 | "Taxation","6,314,000,000","5,746,000,000","568,000,000","9.89","1,439,000,000","1,987,000,000","(548,000,000)","(27.58)","0.07","0.05", 5 | "Net Income","12,193,000,000","22,074,000,000","(9,881,000,000)","(44.76)","(3,195,000,000)","5,863,000,000","(9,058,000,000)","(154.49)","(0.18)","(0.12)", 6 | "EPS Continuing Basic","1.49","2.66","(1.17)","(43.98)","(0.38)","0.71","(1.09)","(153.52)","(0.17)","(0.11)", 7 | "EPS Net Basic","1.49","2.66","(1.17)","(43.98)","(0.38)","0.71","(1.09)","(153.52)","(0.17)","(0.11)", 8 | "EPS Continuing Diluted","1.48","2.63","(1.15)","(43.73)","(0.38)","0.71","(1.09)","(153.52)","(0.17)","(0.11)", 9 | "EPS Net Diluted","1.48","2.63","(1.15)","(43.73)","(0.38)","0.71","(1.09)","(153.52)","(0.17)","(0.11)", 10 | -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Carlos Alvarez 3 | * URL: http://alvarez.is 4 | * 5 | * Project Name: FLATTY - Free Bootstrap 3 Theme 6 | * Version: 1.0 7 | * URL: http://blacktie.co 8 | */ 9 | 10 | body { 11 | background-color: #EEEEEE; 12 | font-family: 'Lato', sans-serif; 13 | font-weight: 300; 14 | font-size: 16px; 15 | color: #555; 16 | 17 | -webkit-font-smoothing: antialiased; 18 | -webkit-overflow-scrolling: touch; 19 | } 20 | 21 | /* Titles */ 22 | h1, h2, h3, h4, h5, h6 { 23 | font-family: 'Lato', sans-serif; 24 | font-weight: 300; 25 | color: #333; 26 | } 27 | 28 | h1 { 29 | font-size: 40px; 30 | } 31 | 32 | h3 { 33 | color: #95a5a6; 34 | font-weight: 400; 35 | } 36 | 37 | h4 { 38 | color: #95a5a6; 39 | font-weight: 400; 40 | font-size: 20px; 41 | } 42 | 43 | /* Paragraph & Typographic */ 44 | p { 45 | line-height: 28px; 46 | margin-bottom: 25px; 47 | font-size: 16px; 48 | } 49 | 50 | .centered { 51 | text-align: center; 52 | } 53 | 54 | /* Links */ 55 | a { 56 | color: #3498db; 57 | word-wrap: break-word; 58 | 59 | -webkit-transition: color 0.1s ease-in, background 0.1s ease-in; 60 | -moz-transition: color 0.1s ease-in, background 0.1s ease-in; 61 | -ms-transition: color 0.1s ease-in, background 0.1s ease-in; 62 | -o-transition: color 0.1s ease-in, background 0.1s ease-in; 63 | transition: color 0.1s ease-in, background 0.1s ease-in; 64 | } 65 | 66 | a:hover, 67 | a:focus { 68 | color: #7b7b7b; 69 | text-decoration: none; 70 | outline: 0; 71 | } 72 | 73 | a:before, 74 | a:after { 75 | -webkit-transition: color 0.1s ease-in, background 0.1s ease-in; 76 | -moz-transition: color 0.1s ease-in, background 0.1s ease-in; 77 | -ms-transition: color 0.1s ease-in, background 0.1s ease-in; 78 | -o-transition: color 0.1s ease-in, background 0.1s ease-in; 79 | transition: color 0.1s ease-in, background 0.1s ease-in; 80 | } 81 | 82 | hr { 83 | display: block; 84 | height: 1px; 85 | border: 0; 86 | border-top: 1px solid #ccc; 87 | margin: 1em 0; 88 | padding: 0; 89 | } 90 | 91 | .navbar-default { 92 | background-color: #000000; 93 | border-color: transparent; 94 | } 95 | 96 | .navbar-default .navbar-brand { 97 | color: white; 98 | } 99 | 100 | .navbar-default .navbar-nav > li > a { 101 | color: white; 102 | } 103 | 104 | /* Helpers */ 105 | 106 | .mt { 107 | margin-top: 40px; 108 | margin-bottom: 40px; 109 | } 110 | 111 | .form-control { 112 | height: 42px; 113 | font-size: 18px; 114 | width: 280px; 115 | } 116 | 117 | i { 118 | margin: 8px; 119 | color: #3498db; 120 | } 121 | 122 | 123 | /* HeaderWrap */ 124 | #headerwrap { 125 | /* background: url(../img/bg01.jpg) no-repeat center top; */ 126 | background-color: #808080; 127 | margin-top: -20px; 128 | padding-top:200px; 129 | background-attachment: relative; 130 | background-position: center center; 131 | min-height: 650px; 132 | width: 100%; 133 | 134 | -webkit-background-size: 100%; 135 | -moz-background-size: 100%; 136 | -o-background-size: 100%; 137 | background-size: 100%; 138 | 139 | -webkit-background-size: cover; 140 | -moz-background-size: cover; 141 | -o-background-size: cover; 142 | background-size: cover; 143 | } 144 | 145 | #headerwrap h1 { 146 | margin-top: 60px; 147 | margin-bottom: 15px; 148 | color: white; 149 | font-size: 45px; 150 | font-weight: 300; 151 | letter-spacing: 1px; 152 | } 153 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | FINCO. 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 54 | 55 |
56 |
57 |
58 |
59 |

Perform automated financial analysis on any publicly-traded company on the NASDAQ or NYSE.

60 |
61 |
62 | 63 |
64 | 65 |
66 |
67 |
68 | 69 |
70 | 71 |
72 |
73 |
74 | 75 | 76 | 77 | 78 |
79 | 91 |
92 |

Created by Zain Hemani and Abdul Khan - Mhacks6

93 |
94 | 95 | 96 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /AAPL_IS.csv: -------------------------------------------------------------------------------- 1 | "Net sales","182,795,000,000","170,910,000,000","156,508,000,000","108,249,000,000","65,225,000,000","36,537,000,000","32,479,000,000", 2 | "Cost of sales","112,258,000,000","106,606,000,000","87,846,000,000","64,431,000,000","39,541,000,000","23,397,000,000","21,334,000,000", 3 | "Gross margin","70,537,000,000","64,304,000,000","68,662,000,000","43,818,000,000","25,684,000,000","13,140,000,000","11,145,000,000", 4 | "Research & development expense","6,041,000,000","4,475,000,000","3,381,000,000","2,429,000,000","1,782,000,000","1,333,000,000","1,109,000,000", 5 | "Selling, general & administrative expense","11,993,000,000","10,830,000,000","10,040,000,000","7,599,000,000","5,517,000,000","4,149,000,000","3,761,000,000", 6 | "Total operating expenses","18,034,000,000","15,305,000,000","13,421,000,000","10,028,000,000","7,299,000,000","5,482,000,000","4,870,000,000", 7 | "Operating income (loss)","52,503,000,000","48,999,000,000","55,241,000,000","33,790,000,000","18,385,000,000","7,658,000,000","6,275,000,000", 8 | "Interest & dividend income","1,795,000,000","1,616,000,000","1,088,000,000","519,000,000","-","-","-", 9 | "Interest income","-","-","-","-","311,000,000","407,000,000","653,000,000", 10 | "Interest expense","384,000,000","136,000,000","-","-","-","-","-", 11 | "Other income (expense), net","(431,000,000)","(324,000,000)","(566,000,000)","(104,000,000)","(156,000,000)","(81,000,000)","(33,000,000)", 12 | "Other income (expenses), net","980,000,000","1,156,000,000","522,000,000","415,000,000","155,000,000","326,000,000","620,000,000", 13 | "Income (loss) before provision for income taxes","53,483,000,000","50,155,000,000","55,763,000,000","34,205,000,000","18,540,000,000","7,984,000,000","6,895,000,000", 14 | "Current federal income tax expense (benefit)","8,624,000,000","9,334,000,000","7,240,000,000","3,884,000,000","2,150,000,000","2,162,000,000","1,942,000,000", 15 | "Deferred federal income tax expense (benefit)","3,183,000,000","1,878,000,000","5,018,000,000","2,998,000,000","1,676,000,000","(207,000,000)","(155,000,000)", 16 | "Total federal income tax expense (benefit)","11,807,000,000","11,212,000,000","12,258,000,000","6,882,000,000","3,826,000,000","1,955,000,000","1,787,000,000", 17 | "Current state income tax expense (benefit)","855,000,000","1,084,000,000","1,182,000,000","762,000,000","655,000,000","279,000,000","210,000,000", 18 | "Deferred state income tax expense (benefit)","(178,000,000)","(311,000,000)","(123,000,000)","37,000,000","(115,000,000)","(113,000,000)","(82,000,000)", 19 | "Total state income tax expense (benefit)","677,000,000","773,000,000","1,059,000,000","799,000,000","540,000,000","166,000,000","128,000,000", 20 | "Current foreign income tax expense (benefit)","2,147,000,000","1,559,000,000","1,203,000,000","769,000,000","282,000,000","358,000,000","277,000,000", 21 | "Deferred foreign income tax expense (benefit)","(658,000,000)","(426,000,000)","(490,000,000)","(167,000,000)","(121,000,000)","(199,000,000)","(131,000,000)", 22 | "Total foreign income tax expense (benefit)","1,489,000,000","1,133,000,000","713,000,000","602,000,000","161,000,000","159,000,000","146,000,000", 23 | "Provision for (benefit from) income taxes","13,973,000,000","13,118,000,000","14,030,000,000","8,283,000,000","4,527,000,000","2,280,000,000","2,061,000,000", 24 | "Net income (loss)","39,510,000,000","37,037,000,000","41,733,000,000","25,922,000,000","14,013,000,000","5,704,000,000","4,834,000,000", 25 | "Weighted average shares outstanding - basic","6,085,572,000","6,477,317,000","6,543,726,000","6,469,806,000","6,366,227,000","6,251,112,000","6,171,144,000", 26 | "Weighted average shares outstanding - diluted","6,122,663,000","6,521,634,000","6,617,485,000","6,556,515,000","6,472,984,000","6,349,035,000","6,314,973,000", 27 | "Year end shares outstanding","5,866,161,000","6,294,491,000","6,574,456,000","6,504,939,000","6,411,790,350","6,298,638,500","6,218,281,811", 28 | "Net earnings (loss) per common share - basic","6.49","5.719","6.377","4.007","2.201","0.913","0.783", 29 | "Net earnings (loss) per common share - diluted","6.45","5.679","6.307","3.954","2.164","0.899","0.766", 30 | "Cash dividends declared per common share","1.82","1.629","0.379","-","-","-","-", 31 | "Number of full time employees","92,600","80,300","72,800","60,400","46,600","34,300","32,000", 32 | "Number of part time employees","4,400","4,100","3,300","2,900","2,800","2,500","3,100", 33 | "Number of common stockholders","26,112","24,710","27,696","28,543","29,405","30,573","30,445", 34 | -------------------------------------------------------------------------------- /MSFT_IS.csv: -------------------------------------------------------------------------------- 1 | "Revenue","93,580,000,000","86,833,000,000","77,849,000,000","73,723,000,000","69,943,000,000","62,484,000,000","58,437,000,000", 2 | "Cost of revenue","33,038,000,000","26,934,000,000","20,249,000,000","17,530,000,000","15,577,000,000","12,395,000,000","12,155,000,000", 3 | "Gross margin","60,542,000,000","59,899,000,000","57,600,000,000","-","-","-","-", 4 | "Research & development","12,046,000,000","11,381,000,000","10,411,000,000","9,811,000,000","9,043,000,000","8,714,000,000","9,010,000,000", 5 | "Sales & marketing","15,713,000,000","15,811,000,000","15,276,000,000","13,857,000,000","13,940,000,000","13,214,000,000","12,879,000,000", 6 | "General & administrative","4,611,000,000","4,821,000,000","5,149,000,000","4,569,000,000","4,222,000,000","4,004,000,000","3,700,000,000", 7 | "Goodwill impairment","-","0","-","6,193,000,000","0","-","-", 8 | "Employee severance","-","-","-","-","-","59,000,000","330,000,000", 9 | "Integration & restructuring","-","127,000,000","-","-","-","-","-", 10 | "Impairment, integration, & restructuring","10,011,000,000","-","-","-","-","-","-", 11 | "Total operating expenses","-","-","30,836,000,000","51,960,000,000","42,782,000,000","38,386,000,000","38,074,000,000", 12 | "Operating income (loss)","18,161,000,000","27,759,000,000","26,764,000,000","21,763,000,000","27,161,000,000","24,098,000,000","20,363,000,000", 13 | "Dividends & interest income","766,000,000","883,000,000","677,000,000","800,000,000","900,000,000","843,000,000","706,000,000", 14 | "Interest expense","781,000,000","597,000,000","429,000,000","380,000,000","295,000,000","151,000,000","-", 15 | "Net recognized gains (losses) on investments","716,000,000","437,000,000","116,000,000","564,000,000","439,000,000","348,000,000","(125,000,000)", 16 | "Net gains (losses) on derivatives","(423,000,000)","(328,000,000)","(196,000,000)","(364,000,000)","(77,000,000)","(140,000,000)","(558,000,000)", 17 | "Net gains (losses) on foreign currency remeasurements","335,000,000","(165,000,000)","(74,000,000)","(117,000,000)","(26,000,000)","1,000,000","(509,000,000)", 18 | "Other income (expense)","(267,000,000)","(169,000,000)","194,000,000","1,000,000","(31,000,000)","14,000,000","(56,000,000)", 19 | "Other income (expense), net","346,000,000","61,000,000","288,000,000","504,000,000","910,000,000","915,000,000","(542,000,000)", 20 | "Income (loss) before income taxes - United States","7,363,000,000","7,127,000,000","6,674,000,000","1,600,000,000","8,862,000,000","9,575,000,000","5,529,000,000", 21 | "Income (loss) before income taxes - foreign","11,144,000,000","20,693,000,000","20,378,000,000","20,667,000,000","19,209,000,000","15,438,000,000","14,292,000,000", 22 | "Income (loss) before income taxes","18,507,000,000","27,820,000,000","27,052,000,000","22,267,000,000","28,071,000,000","25,013,000,000","19,821,000,000", 23 | "Current taxes provision (benefit) - United States federal","3,661,000,000","3,738,000,000","3,131,000,000","2,235,000,000","3,108,000,000","4,415,000,000","3,159,000,000", 24 | "Current taxes provision (benefit) - United States state & local","364,000,000","266,000,000","332,000,000","153,000,000","209,000,000","357,000,000","192,000,000", 25 | "Current taxes provision (benefit) - foreign","2,065,000,000","2,073,000,000","1,745,000,000","1,947,000,000","1,602,000,000","1,701,000,000","1,139,000,000", 26 | "Current taxes provision (benefit)","6,090,000,000","6,077,000,000","5,208,000,000","4,335,000,000","4,919,000,000","6,473,000,000","4,490,000,000", 27 | "Deferred taxes provision (benefit)","224,000,000","(331,000,000)","(19,000,000)","954,000,000","2,000,000","(220,000,000)","762,000,000", 28 | "Provision (benefit) for income taxes","6,314,000,000","5,746,000,000","5,189,000,000","5,289,000,000","4,921,000,000","6,253,000,000","5,252,000,000", 29 | "Net income (loss)","12,193,000,000","22,074,000,000","21,863,000,000","16,978,000,000","23,150,000,000","18,760,000,000","14,569,000,000", 30 | "Weighted average shares outstanding - basic","8,177,000,000","8,299,000,000","8,375,000,000","8,396,000,000","8,490,000,000","8,813,000,000","8,945,000,000", 31 | "Weighted average shares outstanding - diluted","8,254,000,000","8,399,000,000","8,470,000,000","8,506,000,000","8,593,000,000","8,927,000,000","8,996,000,000", 32 | "Year end shares outstanding","8,027,000,000","8,239,000,000","8,328,000,000","8,381,000,000","8,376,000,000","8,668,000,000","8,908,000,000", 33 | "Net earnings (loss) per share - basic","1.49","2.66","2.61","2.02","2.73","2.13","1.63", 34 | "Net earnings (loss) per share - diluted","1.48","2.63","2.58","2","2.69","2.1","1.62", 35 | "Cash dividends declared per common share","1.24","1.12","0.92","0.8","0.64","0.52","0.52", 36 | "Number of full time employees","118,000","128,000","99,000","94,000","90,000","89,000","93,000", 37 | "Number of common stockholders","109,479","113,923","119,862","128,992","134,854","138,568","142,468", 38 | "Foreign currency translation adjustments","(1,383,000,000)","-","-","-","-","-","-", 39 | -------------------------------------------------------------------------------- /scraper.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from selenium import webdriver 4 | import urllib 5 | from urlparse import urljoin 6 | import selenium.webdriver as webdriver 7 | #import urllib.request 8 | from bs4 import BeautifulSoup 9 | import contextlib 10 | import lxml.html 11 | from selenium.webdriver.support.ui import WebDriverWait 12 | from selenium.webdriver.support import expected_conditions as EC 13 | 14 | from selenium.webdriver.common.by import By 15 | 16 | driver = webdriver.PhantomJS() 17 | driver.set_window_size(1120, 550) 18 | 19 | driver.delete_all_cookies() 20 | 21 | ## GOING TO LINK 22 | # driver.get("http://uwo.summon.serialssolutions.com/2.0.0/link/dbrecommender/AAAzMi4wLVNVTU1PTi1TRVNTSU9OLWNiNjNlMmFlYTkzMzIzYWU4ZDhlMzkyZDBjNmFmZmNiAQAKVlIyUEs5U1g5VwIATGh0dHBzOi8vd3d3LmxpYi51d28uY2EvY2dpLWJpbi9lenBhdXRobi5jZ2k_dXJsPWh0dHA6Ly93d3cuTWVyZ2VudE9ubGluZS5jb20DAAEwBAAOTWVyZ2VudCBPbmxpbmUFAAhkYXRhYmFzZQ") 23 | driver.get("https://www.lib.uwo.ca/cgi-bin/ezpauthenticate.cgi?url=http://www.MergentOnline.com") 24 | # driver.get("http://www.mergentonline.com.proxy1.lib.uwo.ca/basicsearch.php") 25 | 26 | 27 | ## LOGIN 28 | element_user = driver.find_element_by_name("user") 29 | element_user.send_keys("zhemani") 30 | 31 | with file("pass.txt") as f: 32 | password = f.read() 33 | 34 | element_password = driver.find_element_by_name("pass") 35 | element_password.send_keys(password) 36 | 37 | 38 | 39 | 40 | # WORKS 41 | def find_by_xpath(locator): 42 | element = WebDriverWait(driver, 10).until( 43 | EC.presence_of_element_located((By.XPATH, locator)) 44 | ) 45 | 46 | return element 47 | 48 | find_by_xpath('//input[@value = "Login"]').click() 49 | 50 | element_ticker = driver.find_element_by_name("searchtext") 51 | 52 | # TODO - GET FROM REQUEST 53 | element_ticker.send_keys("msft") 54 | driver.find_element_by_id("basicsearchbtn").click() 55 | driver.get_screenshot_as_file('mhacks3.png') 56 | 57 | ret = driver.find_element_by_name("chkopt[]") 58 | parent = ret.find_element_by_xpath('..') 59 | 60 | # Navigation 61 | ret1 = parent.find_element_by_xpath('following-sibling::td/a') 62 | #driver.find_element_by_xpath("//input[@name, 'chkopt[]']/following-sibling") 63 | link1 = driver.find_element_by_link_text(ret1.text) 64 | link1.click() 65 | driver.get_screenshot_as_file('mhacks5.png') 66 | 67 | link2 = driver.find_element_by_link_text("Company Financials") 68 | link2.click() 69 | driver.get_screenshot_as_file('mhacks6.png') 70 | 71 | element5 = driver.find_element_by_name("range") 72 | element5.send_keys("7") 73 | element5.send_keys("enter") 74 | element6 = driver.find_element_by_name("Submit").click() 75 | 76 | driver.get_screenshot_as_file('mhacks7.png') 77 | 78 | 79 | 80 | 81 | ################################################################################ 82 | html_doc = driver.page_source 83 | 84 | soup = BeautifulSoup(html_doc) 85 | soup.prettify() 86 | table = soup.find("table",{"id": "table01"}) 87 | 88 | 89 | def makelist(table): 90 | result = [] 91 | allrows = table.findAll('tr') 92 | allrows = filter(None, allrows) 93 | result = filter(None, result) 94 | for row in allrows: 95 | result.append([]) 96 | allcols = row.findAll('td') 97 | for col in allcols: 98 | thestrings = [unicode(s) for s in col.findAll(text=True)] 99 | thetext = ''.join(thestrings) 100 | result[-1].append(thetext) 101 | result = filter(None, result) 102 | 103 | data = [] 104 | 105 | for i in range(len(result)): 106 | data.append([]) 107 | 108 | for j in range (len(result[1])): 109 | if result[i][j] != "": 110 | data[i].append(result[i][j]) 111 | 112 | 113 | return data 114 | 115 | BS = makelist(table) 116 | 117 | 118 | 119 | 120 | target = open("balanceSheet.csv", 'w') 121 | 122 | for i in range (len(BS)): 123 | for j in range(len(BS[i])): 124 | target.write('"' + BS[i][j] + '"') 125 | target.write(",") 126 | 127 | target.write("\n") 128 | 129 | 130 | ############################################################ 131 | 132 | element11 = driver.find_element_by_name("dataarea") 133 | element11.send_keys("i") 134 | element11.send_keys("enter") 135 | element12 = driver.find_element_by_name("Submit").click() 136 | 137 | driver.get_screenshot_as_file('mhacks15.png') 138 | 139 | html_doc2 = driver.page_source 140 | 141 | soup2 = BeautifulSoup(html_doc2) 142 | soup2.prettify() 143 | 144 | table2 = soup2.find("table",{"id": "table02"}) 145 | 146 | IS = makelist(table2) 147 | 148 | target = open("incomeStatement.csv", 'w') 149 | 150 | for i in range (len(IS)): 151 | for j in range(len(IS[i])): 152 | target.write('"' + IS[i][j] + '"'); 153 | target.write(",") 154 | 155 | target.write("\n") 156 | 157 | 158 | link = driver.find_element_by_link_text("Log Out") 159 | link.click() 160 | driver.get_screenshot_as_file('mhacks4.png') 161 | 162 | 163 | driver.quit() 164 | 165 | 166 | 167 | ###### REST API ###### 168 | 169 | 170 | app = Flask(__name__) 171 | api = Api(app) 172 | 173 | class HelloWorld(Resource): 174 | def get(self): 175 | return {'hello': 'world'} 176 | 177 | api.add_resource(HelloWorld, '/') 178 | 179 | if __name__ == '__main__': 180 | app.run(debug=True) 181 | -------------------------------------------------------------------------------- /MSFT_BS.csv: -------------------------------------------------------------------------------- 1 | "Cash & cash equivalents","5,595,000,000","8,669,000,000","3,804,000,000","6,938,000,000","9,610,000,000","5,505,000,000","6,076,000,000", 2 | "Short-term investments","90,931,000,000","77,040,000,000","73,218,000,000","56,102,000,000","43,162,000,000","31,283,000,000","25,371,000,000", 3 | "Total cash, cash equivalents, & short-term investments","96,526,000,000","85,709,000,000","77,022,000,000","63,040,000,000","52,772,000,000","36,788,000,000","31,447,000,000", 4 | "Accounts receivable, gross","18,243,000,000","19,845,000,000","17,822,000,000","16,169,000,000","15,320,000,000","13,389,000,000","11,643,000,000", 5 | "Allowance for doubtful accounts","335,000,000","301,000,000","336,000,000","389,000,000","333,000,000","375,000,000","451,000,000", 6 | "Accounts receivable, net","17,908,000,000","19,544,000,000","17,486,000,000","15,780,000,000","14,987,000,000","13,014,000,000","11,192,000,000", 7 | "Raw materials","1,100,000,000","944,000,000","328,000,000","210,000,000","232,000,000","172,000,000","170,000,000", 8 | "Work in process","202,000,000","266,000,000","201,000,000","96,000,000","56,000,000","16,000,000","45,000,000", 9 | "Finished goods","1,600,000,000","1,450,000,000","1,409,000,000","831,000,000","1,084,000,000","552,000,000","502,000,000", 10 | "Inventories","2,902,000,000","2,660,000,000","1,938,000,000","1,137,000,000","1,372,000,000","740,000,000","717,000,000", 11 | "Deferred income taxes","1,915,000,000","1,941,000,000","1,632,000,000","2,035,000,000","2,467,000,000","2,184,000,000","2,213,000,000", 12 | "Other current assets","5,461,000,000","4,392,000,000","3,388,000,000","3,092,000,000","3,320,000,000","2,950,000,000","3,711,000,000", 13 | "Total current assets","124,712,000,000","114,246,000,000","101,466,000,000","85,084,000,000","74,918,000,000","55,676,000,000","49,280,000,000", 14 | "Land","769,000,000","541,000,000","525,000,000","528,000,000","533,000,000","526,000,000","526,000,000", 15 | "Buildings & improvements","10,800,000,000","8,867,000,000","7,326,000,000","6,768,000,000","6,521,000,000","6,087,000,000","5,886,000,000", 16 | "Leasehold improvments","3,577,000,000","3,560,000,000","2,946,000,000","2,550,000,000","2,345,000,000","2,100,000,000","1,938,000,000", 17 | "Computer equipment & software","13,612,000,000","11,430,000,000","9,242,000,000","7,298,000,000","6,601,000,000","5,673,000,000","4,989,000,000", 18 | "Furniture & equipment","3,579,000,000","3,406,000,000","2,465,000,000","2,087,000,000","1,991,000,000","1,873,000,000","1,743,000,000", 19 | "Total property & equipment, at cost","32,337,000,000","27,804,000,000","22,504,000,000","19,231,000,000","17,991,000,000","16,259,000,000","15,082,000,000", 20 | "Accumulated depreciation - property & equipment","17,606,000,000","14,793,000,000","12,513,000,000","10,962,000,000","9,829,000,000","8,629,000,000","7,547,000,000", 21 | "Property & equipment, net","14,731,000,000","13,011,000,000","9,991,000,000","8,269,000,000","8,162,000,000","7,630,000,000","7,535,000,000", 22 | "Equity & other investments","12,053,000,000","14,597,000,000","10,844,000,000","9,776,000,000","10,865,000,000","7,754,000,000","4,933,000,000", 23 | "Goodwill","16,939,000,000","20,127,000,000","14,655,000,000","13,452,000,000","12,581,000,000","12,394,000,000","12,503,000,000", 24 | "Intangible assets, net","4,835,000,000","6,981,000,000","3,083,000,000","3,170,000,000","744,000,000","1,158,000,000","1,759,000,000", 25 | "Deferred income taxes ","-","-","-","-","-","0","279,000,000", 26 | "Other long-term assets","2,953,000,000","3,422,000,000","2,392,000,000","1,520,000,000","1,434,000,000","1,501,000,000","1,599,000,000", 27 | "Total assets","176,223,000,000","172,384,000,000","142,431,000,000","121,271,000,000","108,704,000,000","86,113,000,000","77,888,000,000", 28 | "Accounts payable","6,591,000,000","7,432,000,000","4,828,000,000","4,175,000,000","4,197,000,000","4,025,000,000","3,324,000,000", 29 | "Short-term debt","4,985,000,000","2,000,000,000","-","-","-","1,000,000,000","2,000,000,000", 30 | "Current portion of long-term debt","2,499,000,000","0","2,999,000,000","1,231,000,000","0","-","-", 31 | "Accrued compensation","5,096,000,000","4,797,000,000","4,117,000,000","3,875,000,000","3,575,000,000","3,283,000,000","3,156,000,000", 32 | "Income taxes","606,000,000","782,000,000","592,000,000","789,000,000","580,000,000","1,074,000,000","725,000,000", 33 | "Short-term unearned revenue","23,223,000,000","23,150,000,000","20,639,000,000","18,653,000,000","15,722,000,000","13,652,000,000","13,003,000,000", 34 | "Securities lending payable","92,000,000","558,000,000","645,000,000","814,000,000","1,208,000,000","182,000,000","1,684,000,000", 35 | "Other current liabilities","6,766,000,000","6,906,000,000","3,597,000,000","3,151,000,000","3,492,000,000","2,931,000,000","3,142,000,000", 36 | "Total current liabilities","49,858,000,000","45,625,000,000","37,417,000,000","32,688,000,000","28,774,000,000","26,147,000,000","27,034,000,000", 37 | "Zero coupon convertible notes ","-","-","-","-","1,250,000,000","1,250,000,000","-", 38 | "Notes","-","-","-","-","10,750,000,000","3,750,000,000","3,750,000,000", 39 | "Unamortized debt discount","-","-","-","-","(79,000,000)","(61,000,000)","(4,000,000)", 40 | "Long-term debt","-","-","-","-","11,921,000,000","4,939,000,000","3,746,000,000", 41 | "Long-term debt","27,808,000,000","20,645,000,000","12,601,000,000","10,713,000,000","-","-","-", 42 | "Long-term unearned revenue","2,095,000,000","2,008,000,000","1,760,000,000","1,406,000,000","1,398,000,000","1,178,000,000","1,281,000,000", 43 | "Deferred income taxes","2,835,000,000","2,728,000,000","1,709,000,000","1,893,000,000","1,456,000,000","229,000,000","-", 44 | "Tax contingencies & other tax liabilities","12,290,000,000","10,510,000,000","9,548,000,000","7,634,000,000","7,381,000,000","6,887,000,000","5,515,000,000", 45 | "Legal contingencies","-","-","162,000,000","220,000,000","276,000,000","236,000,000","407,000,000", 46 | "Product warranty","-","-","-","-","-","69,000,000","132,000,000", 47 | "Other long-term liabilities","1,254,000,000","1,084,000,000","290,000,000","354,000,000","415,000,000","253,000,000","215,000,000", 48 | "Other long-term liabilities","13,544,000,000","11,594,000,000","10,000,000,000","8,208,000,000","8,072,000,000","7,445,000,000","6,269,000,000", 49 | "Total liabilities","96,140,000,000","82,600,000,000","63,487,000,000","54,908,000,000","51,621,000,000","-","-", 50 | "Common stock & paid-in capital","68,465,000,000","68,366,000,000","67,306,000,000","65,797,000,000","63,415,000,000","62,856,000,000","62,382,000,000", 51 | "Retained earnings (accumulated deficit)","9,096,000,000","17,710,000,000","9,895,000,000","566,000,000","(6,332,000,000)","(16,681,000,000)","(22,824,000,000)", 52 | "Derivatives","590,000,000","31,000,000","66,000,000","-","-","-","-", 53 | "Investments","3,169,000,000","3,531,000,000","1,794,000,000","-","-","-","-", 54 | "Translation adjustments & other accumulated other comprehensive income","(1,237,000,000)","146,000,000","(117,000,000)","-","-","-","-", 55 | "Accumulated other comprehensive income","2,522,000,000","3,708,000,000","1,743,000,000","-","-","-","-", 56 | "Total stockholders' equity","80,083,000,000","89,784,000,000","78,944,000,000","66,363,000,000","57,083,000,000","46,175,000,000","39,558,000,000", 57 | -------------------------------------------------------------------------------- /AAPL_BS.csv: -------------------------------------------------------------------------------- 1 | "Cash & cash equivalents","13,844,000,000","14,259,000,000","10,746,000,000","9,815,000,000","11,261,000,000","5,263,000,000","11,875,000,000", 2 | "Short-term marketable securities","11,233,000,000","26,287,000,000","18,383,000,000","16,137,000,000","14,359,000,000","18,201,000,000","12,615,000,000", 3 | "Accounts receivable, gross","17,546,000,000","13,201,000,000","11,028,000,000","5,422,000,000","5,565,000,000","3,413,000,000","2,469,000,000", 4 | "Allowances","86,000,000","99,000,000","98,000,000","53,000,000","55,000,000","52,000,000","47,000,000", 5 | "Accounts receivable, net","17,460,000,000","13,102,000,000","10,930,000,000","5,369,000,000","5,510,000,000","3,361,000,000","2,422,000,000", 6 | "Components","471,000,000","683,000,000","-","-","-","-","-", 7 | "Finished goods","1,640,000,000","1,081,000,000","-","-","-","-","-", 8 | "Inventories","2,111,000,000","1,764,000,000","791,000,000","776,000,000","1,051,000,000","455,000,000","509,000,000", 9 | "Deferred tax assets","4,318,000,000","3,453,000,000","2,583,000,000","2,014,000,000","1,636,000,000","2,101,000,000","1,447,000,000", 10 | "Vendor non-trade receivables","9,759,000,000","7,539,000,000","7,762,000,000","6,348,000,000","4,414,000,000","-","-", 11 | "Deferred costs under subscription accounting - current","-","-","-","-","-","3,703,000,000","1,931,000,000", 12 | "Vendor non-trade receivables","-","-","-","-","-","1,696,000,000","2,282,000,000", 13 | "Inventory component prepayments - current","-","-","-","-","-","309,000,000","-", 14 | "NAND flash memory prepayments","-","-","-","-","-","-","475,000,000", 15 | "Other current assets","-","-","-","-","-","1,176,000,000","1,134,000,000", 16 | "Other current assets","-","-","-","-","-","6,884,000,000","5,822,000,000", 17 | "Other current assets","9,806,000,000","6,882,000,000","6,458,000,000","4,529,000,000","3,447,000,000","-","-", 18 | "Total current assets","68,531,000,000","73,286,000,000","57,653,000,000","44,988,000,000","41,678,000,000","36,265,000,000","34,690,000,000", 19 | "Long-term marketable securities","130,162,000,000","106,215,000,000","92,122,000,000","55,618,000,000","25,391,000,000","10,528,000,000","-", 20 | "Land & buildings","4,863,000,000","3,309,000,000","2,439,000,000","2,059,000,000","1,471,000,000","955,000,000","810,000,000", 21 | "Machinery, equipment, & internal-use software","29,639,000,000","21,242,000,000","15,743,000,000","6,926,000,000","3,589,000,000","1,932,000,000","1,491,000,000", 22 | "Office furniture & equipment","-","-","241,000,000","184,000,000","144,000,000","115,000,000","122,000,000", 23 | "Leasehold improvements","4,513,000,000","3,968,000,000","3,464,000,000","2,599,000,000","2,030,000,000","1,665,000,000","1,324,000,000", 24 | "Gross property, plant & equipment","39,015,000,000","28,519,000,000","21,887,000,000","11,768,000,000","7,234,000,000","4,667,000,000","3,747,000,000", 25 | "Accumulated depreciation & amortization","18,391,000,000","11,922,000,000","6,435,000,000","3,991,000,000","2,466,000,000","1,713,000,000","1,292,000,000", 26 | "Property, plant & equipment, net","20,624,000,000","16,597,000,000","15,452,000,000","7,777,000,000","4,768,000,000","2,954,000,000","2,455,000,000", 27 | "Goodwill","4,616,000,000","1,577,000,000","1,135,000,000","896,000,000","741,000,000","206,000,000","207,000,000", 28 | "Acquired intangible assets, gross","-","-","-","-","587,000,000","423,000,000","-", 29 | "Less: accumulated amortization - acquired intangible assets","-","-","-","-","245,000,000","176,000,000","-", 30 | "Acquired intangible assets, net","4,142,000,000","4,179,000,000","4,224,000,000","3,536,000,000","342,000,000","247,000,000","285,000,000", 31 | "Deferred costs under subscription accounting - non-current","-","-","-","-","-","1,468,000,000","1,089,000,000", 32 | "Inventory component prepayments - non-current","-","-","-","-","-","844,000,000","-", 33 | "Deferred tax assets - non-current","-","-","-","-","-","259,000,000","138,000,000", 34 | "Capitalized software development costs, net","-","-","-","-","-","106,000,000","67,000,000", 35 | "Long-term NAND flash memory prepayments","-","-","-","-","-","-","208,000,000", 36 | "Other assets","-","-","-","-","-","974,000,000","433,000,000", 37 | "Other assets","-","-","-","-","-","3,651,000,000","1,935,000,000", 38 | "Other assets","3,764,000,000","5,146,000,000","5,478,000,000","3,556,000,000","2,263,000,000","-","-", 39 | "Total assets","231,839,000,000","207,000,000,000","176,064,000,000","116,371,000,000","75,183,000,000","53,851,000,000","39,572,000,000", 40 | "Accounts payable","30,196,000,000","22,367,000,000","21,175,000,000","14,632,000,000","12,015,000,000","5,601,000,000","5,520,000,000", 41 | "Accrued warranty & related costs","4,159,000,000","2,967,000,000","1,638,000,000","1,240,000,000","761,000,000","210,000,000","267,000,000", 42 | "Accrued marketing & selling expenses","2,321,000,000","1,291,000,000","910,000,000","-","-","-","-", 43 | "Accrued taxes","1,209,000,000","1,200,000,000","1,535,000,000","1,140,000,000","-","-","-", 44 | "Accrued compensation & employee benefits","1,209,000,000","959,000,000","735,000,000","590,000,000","436,000,000","357,000,000","320,000,000", 45 | "Deferred margin on component sales","1,057,000,000","1,262,000,000","1,492,000,000","2,038,000,000","663,000,000","225,000,000","681,000,000", 46 | "Accrued marketing & distribution","-","-","-","598,000,000","396,000,000","359,000,000","329,000,000", 47 | "Income taxes payable","-","-","-","-","210,000,000","439,000,000","-", 48 | "Deferred revenue - current","-","-","-","-","-","-","4,853,000,000", 49 | "Other accrued tax liabilities","-","-","-","-","-","-","100,000,000", 50 | "Other current liabilities","8,498,000,000","6,177,000,000","5,104,000,000","3,641,000,000","3,257,000,000","1,786,000,000","2,022,000,000", 51 | "Accrued expenses","18,453,000,000","13,856,000,000","11,414,000,000","9,247,000,000","5,723,000,000","3,376,000,000","8,572,000,000", 52 | "Deferred revenue","8,491,000,000","7,435,000,000","5,953,000,000","4,091,000,000","2,984,000,000","10,305,000,000","-", 53 | "Commercial paper","6,308,000,000","-","-","-","-","-","-", 54 | "Total current liabilities","63,448,000,000","43,658,000,000","38,542,000,000","27,970,000,000","20,722,000,000","19,282,000,000","14,092,000,000", 55 | "Deferred revenue - non-current","3,031,000,000","2,625,000,000","2,648,000,000","1,686,000,000","1,139,000,000","4,485,000,000","-", 56 | "Long-term debt","28,987,000,000","16,960,000,000","0","-","-","-","-", 57 | "Deferred revenue - non-current","-","-","-","-","-","-","3,029,000,000", 58 | "Deferred tax liabilities","20,259,000,000","16,489,000,000","13,847,000,000","8,159,000,000","4,300,000,000","966,000,000","675,000,000", 59 | "Other non-current liabilities","4,567,000,000","3,719,000,000","2,817,000,000","1,941,000,000","1,231,000,000","1,286,000,000","746,000,000", 60 | "Other non-current liabilities","24,826,000,000","20,208,000,000","16,664,000,000","10,100,000,000","5,531,000,000","2,252,000,000","4,450,000,000", 61 | "Total liabilities","120,292,000,000","83,451,000,000","57,854,000,000","39,756,000,000","27,392,000,000","26,019,000,000","18,542,000,000", 62 | "Common stock","23,313,000,000","19,764,000,000","16,422,000,000","13,331,000,000","10,668,000,000","8,210,000,000","7,177,000,000", 63 | "Retained earnings","87,152,000,000","104,256,000,000","101,289,000,000","62,841,000,000","37,169,000,000","19,538,000,000","13,845,000,000", 64 | "Cumulative foreign currency translation","(242,000,000)","(105,000,000)","8,000,000","23,000,000","35,000,000","5,000,000","59,000,000", 65 | "Unrecognized gains (losses) on derivative instruments","1,364,000,000","(175,000,000)","(240,000,000)","290,000,000","(252,000,000)","31,000,000","19,000,000", 66 | "Unrealized gains (losses) on marketable securities","(40,000,000)","(191,000,000)","731,000,000","130,000,000","171,000,000","48,000,000","(70,000,000)", 67 | "Accumulated other comprehensive income (loss)","1,082,000,000","(471,000,000)","499,000,000","443,000,000","(46,000,000)","84,000,000","8,000,000", 68 | "Total shareholders' equity","111,547,000,000","123,549,000,000","118,210,000,000","76,615,000,000","47,791,000,000","27,832,000,000","21,030,000,000", 69 | -------------------------------------------------------------------------------- /assets/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, send_from_directory 2 | 3 | from selenium import webdriver 4 | import urllib 5 | import csv 6 | import xlsxwriter 7 | 8 | 9 | from urlparse import urljoin 10 | import selenium.webdriver as webdriver 11 | #import urllib.request 12 | from bs4 import BeautifulSoup 13 | import contextlib 14 | from selenium.webdriver.support.ui import WebDriverWait 15 | from selenium.webdriver.support import expected_conditions as EC 16 | 17 | from selenium.webdriver.common.by import By 18 | 19 | 20 | 21 | # LINK: https://www.wolframcloud.com/objects/f51a1d4b-7e02-47cf-8e9f-67b8516bf802?x={.....} 22 | 23 | def find_by_xpath(locator): 24 | element = WebDriverWait(driver, 10).until( 25 | EC.presence_of_element_located((By.XPATH, locator)) 26 | ) 27 | 28 | return element 29 | 30 | def makelist(table): 31 | result = [] 32 | allrows = table.findAll('tr') 33 | allrows = filter(None, allrows) 34 | result = filter(None, result) 35 | for row in allrows: 36 | result.append([]) 37 | allcols = row.findAll('td') 38 | for col in allcols: 39 | thestrings = [unicode(s) for s in col.findAll(text=True)] 40 | thetext = ''.join(thestrings) 41 | result[-1].append(thetext) 42 | result = filter(None, result) 43 | 44 | data = [] 45 | 46 | for i in range(len(result)): 47 | data.append([]) 48 | 49 | for j in range (len(result[1])): 50 | if result[i][j] != "": 51 | data[i].append(result[i][j]) 52 | 53 | data1 =[] 54 | 55 | for i in range(len(data)): 56 | data1.append([]) 57 | 58 | for j in range (len(data[1])): 59 | if data[i][j] != ">": 60 | data1[i].append(data[i][j]) 61 | 62 | return data1 63 | 64 | def getFormat(workbook, style, wide): 65 | if style == "header1": 66 | format = workbook.add_format({'bold': 1}) 67 | format.set_bg_color('#000080') 68 | format.set_font_color('white') 69 | format.set_bottom() 70 | format.set_top() 71 | format.set_font_name("Times New Roman") 72 | 73 | 74 | 75 | 76 | elif style == "header2": 77 | format = workbook.add_format({'bold': 1}) 78 | format.set_bg_color('blue') 79 | format.set_font_color('white') 80 | format.set_bottom() 81 | format.set_top() 82 | format.set_font_name("Times New Roman") 83 | 84 | 85 | elif style == "header3": 86 | format = workbook.add_format({'bold': 1}) 87 | format.set_bg_color('blue') 88 | format.set_font_color('white') 89 | format.set_bottom() 90 | format.set_top() 91 | format.set_font_name("Times New Roman") 92 | 93 | elif style == "dollars_top": 94 | format = workbook.add_format({'num_format': '#,##0'}) 95 | format.set_bg_color('white') 96 | format.set_font_color('black') 97 | format.set_font_name("Times New Roman") 98 | 99 | elif style == "dollars": 100 | format = workbook.add_format({'num_format': '#,##0'}) 101 | format.set_bg_color('white') 102 | format.set_font_color('black') 103 | format.set_font_name("Times New Roman") 104 | 105 | elif style == "percentage": 106 | format = workbook.add_format({'num_format': '0.0%'}) 107 | format.set_bg_color('white') 108 | format.set_font_color('black') 109 | format.set_font_name("Times New Roman") 110 | 111 | else: 112 | format = workbook.add_format() 113 | format.set_bg_color('white') 114 | format.set_font_name("Times New Roman") 115 | 116 | return format 117 | 118 | def getCell(row, col): 119 | letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] 120 | 121 | colAddress = letters[col] 122 | rowAddress = row + 1 123 | 124 | return colAddress + str(rowAddress) 125 | 126 | 127 | def get_statements(ticker): 128 | 129 | if len(ticker) == 1: 130 | ticker += " " 131 | elif len(ticker) == 2: 132 | ticker += " " 133 | 134 | driver = webdriver.PhantomJS() 135 | driver.set_window_size(1120, 550) 136 | 137 | driver.delete_all_cookies() 138 | driver.get("https://www.lib.uwo.ca/cgi-bin/ezpauthenticate.cgi?url=http://www.MergentOnline.com") 139 | 140 | 141 | 142 | ## LOGIN 143 | element_user = driver.find_element_by_name("user") 144 | element_user.send_keys("akhan552") 145 | 146 | with file("pass.txt") as f: 147 | password = f.read() 148 | 149 | element_password = driver.find_element_by_name("pass") 150 | element_password.send_keys(password) 151 | 152 | def find_by_xpath(locator): 153 | element = WebDriverWait(driver, 10).until( 154 | EC.presence_of_element_located((By.XPATH, locator)) 155 | ) 156 | 157 | return element 158 | 159 | 160 | find_by_xpath('//input[@value = "Login"]').click() 161 | 162 | element_ticker = driver.find_element_by_name("searchtext") 163 | 164 | # TODO - GET FROM REQUEST 165 | element_ticker.send_keys(ticker) 166 | driver.find_element_by_id("basicsearchbtn").click() 167 | 168 | ret = driver.find_element_by_name("chkopt[]") 169 | parent = ret.find_element_by_xpath('..') 170 | 171 | # Navigation 172 | ret1 = parent.find_element_by_xpath('following-sibling::td/a') 173 | #driver.find_element_by_xpath("//input[@name, 'chkopt[]']/following-sibling") 174 | link1 = driver.find_element_by_link_text(ret1.text) 175 | link1.click() 176 | 177 | link2 = driver.find_element_by_link_text("Company Financials") 178 | link2.click() 179 | 180 | element5 = driver.find_element_by_name("range") 181 | element5.send_keys("7") 182 | element5.send_keys("enter") 183 | element20 = driver.find_element_by_name("scale") 184 | element20.send_keys("n") 185 | element20.send_keys("enter") 186 | element6 = driver.find_element_by_name("Submit").click() 187 | 188 | html_doc = driver.page_source 189 | 190 | soup = BeautifulSoup(html_doc) 191 | soup.prettify() 192 | table = soup.find("table",{"id": "table01"}) 193 | 194 | BS = makelist(table) 195 | 196 | target = open(ticker + "_BS.csv", 'w') 197 | 198 | for i in range (len(BS)): 199 | for j in range(len(BS[i])): 200 | target.write('"' + BS[i][j] + '"') 201 | target.write(",") 202 | 203 | target.write("\n") 204 | 205 | element11 = driver.find_element_by_name("dataarea") 206 | element11.send_keys("i") 207 | element11.send_keys("enter") 208 | element12 = driver.find_element_by_name("Submit").click() 209 | 210 | 211 | html_doc2 = driver.page_source 212 | 213 | soup2 = BeautifulSoup(html_doc2) 214 | soup2.prettify() 215 | 216 | table2 = soup2.find("table",{"id": "table02"}) 217 | 218 | IS = makelist(table2) 219 | 220 | target = open(ticker + "_IS.csv", 'w') 221 | 222 | for i in range (len(IS)): 223 | for j in range(len(IS[i])): 224 | target.write('"' + IS[i][j] + '"'); 225 | target.write(",") 226 | 227 | target.write("\n") 228 | 229 | link3 = driver.find_element_by_link_text("Analysis") 230 | link3.click() 231 | 232 | html_doc3 = driver.page_source 233 | 234 | soup3 = BeautifulSoup(html_doc3) 235 | soup3.prettify() 236 | 237 | table3 = soup3.find("table",{"class": "tablesorter"}) 238 | 239 | analysis = makelist(table3) 240 | 241 | target = open(ticker + "_Analysis.csv", 'w') 242 | 243 | for i in range (len(analysis)): 244 | for j in range(len(analysis[i])): 245 | target.write('"' + analysis[i][j] + '"'); 246 | target.write(",") 247 | 248 | target.write("\n") 249 | 250 | 251 | link4 = driver.find_element_by_link_text("Ratios") 252 | link4.click() 253 | element21 = driver.find_element_by_name("range") 254 | element21.send_keys("7") 255 | element21.send_keys("enter") 256 | 257 | html_doc4 = driver.page_source 258 | soup4 = BeautifulSoup(html_doc4) 259 | soup4.prettify() 260 | 261 | table4 = soup4.find("table",{"id": "table25"}) 262 | 263 | ratios = makelist(table4) 264 | print ratios 265 | 266 | target = open(ticker + "_Ratios.csv", 'w') 267 | 268 | for i in range (len(ratios)): 269 | for j in range(len(ratios[i])): 270 | target.write('"' + ratios[i][j] + '"'); 271 | target.write(",") 272 | 273 | target.write("\n") 274 | target.close() 275 | 276 | 277 | 278 | 279 | link = driver.find_element_by_link_text("Log Out") 280 | link.click() 281 | 282 | driver.quit() 283 | 284 | 285 | path_to_file = analyze(ticker, ticker + "_IS.csv", ticker + "_BS.csv", ticker + "_Ratios.csv", ticker + "_Analysis.csv") 286 | 287 | # print path_to_file 288 | 289 | return path_to_file 290 | 291 | ############################# 292 | 293 | def analyze(ticker, IS_PATH, BS_PATH, RATIO_PATH, ANALYSIS_PATH): 294 | 295 | 296 | IS_reader = csv.reader(open(IS_PATH, 'r')) 297 | 298 | IS_rows_reversed = [] 299 | IS_rows = [] 300 | 301 | for r in IS_reader: 302 | IS_rows_reversed.append(r) 303 | 304 | for e in IS_rows_reversed: 305 | #print e 306 | pass 307 | 308 | 309 | 310 | 311 | for i in range (len(IS_rows_reversed)): 312 | 313 | IS_rows.append([]); 314 | if len(IS_rows_reversed[i]) > 8: 315 | IS_rows_reversed[i] = IS_rows_reversed[i][0:8] 316 | 317 | 318 | 319 | IS_rows[i].append(IS_rows_reversed[i][0]) 320 | IS_rows[i].append(IS_rows_reversed[i][7]) 321 | IS_rows[i].append(IS_rows_reversed[i][6]) 322 | IS_rows[i].append(IS_rows_reversed[i][5]) 323 | IS_rows[i].append(IS_rows_reversed[i][4]) 324 | IS_rows[i].append(IS_rows_reversed[i][3]) 325 | IS_rows[i].append(IS_rows_reversed[i][2]) 326 | IS_rows[i].append(IS_rows_reversed[i][1]) 327 | 328 | 329 | for i in IS_rows: 330 | for j in range (len(i)): 331 | if j != 0: 332 | if i[j] == "-": 333 | i[j] = "0"; 334 | 335 | 336 | ############## BS 337 | 338 | BS_reader = csv.reader(open(BS_PATH, 'r')) 339 | 340 | BS_rows_reversed = [] 341 | BS_rows = [] 342 | 343 | for r in BS_reader: 344 | BS_rows_reversed.append(r) 345 | 346 | for e in BS_rows_reversed: 347 | #print e 348 | pass 349 | 350 | 351 | 352 | 353 | for i in range (len(BS_rows_reversed)): 354 | 355 | BS_rows.append([]); 356 | if len(BS_rows_reversed[i]) > 8: 357 | BS_rows_reversed[i] = BS_rows_reversed[i][0:8] 358 | 359 | 360 | 361 | BS_rows[i].append(BS_rows_reversed[i][0]) 362 | BS_rows[i].append(BS_rows_reversed[i][7]) 363 | BS_rows[i].append(BS_rows_reversed[i][6]) 364 | BS_rows[i].append(BS_rows_reversed[i][5]) 365 | BS_rows[i].append(BS_rows_reversed[i][4]) 366 | BS_rows[i].append(BS_rows_reversed[i][3]) 367 | BS_rows[i].append(BS_rows_reversed[i][2]) 368 | BS_rows[i].append(BS_rows_reversed[i][1]) 369 | 370 | 371 | for i in BS_rows: 372 | for j in range (len(i)): 373 | if j != 0: 374 | if i[j] == "-": 375 | i[j] = "0"; 376 | 377 | 378 | 379 | 380 | ratio_reader = csv.reader(open(RATIO_PATH, 'r')) 381 | print "reader", ratio_reader 382 | 383 | 384 | ratio_rows_reversed = [] 385 | ratio_rows = [] 386 | 387 | print "READING" 388 | for r in ratio_reader: 389 | print r 390 | ratio_rows_reversed.append(r) 391 | 392 | print "REVERSED" 393 | for e in ratio_rows_reversed: 394 | print e 395 | pass 396 | 397 | 398 | for i in range (len(ratio_rows_reversed)): 399 | 400 | ratio_rows.append([]); 401 | if len(ratio_rows_reversed[i]) > 8: 402 | ratio_rows_reversed[i] = ratio_rows_reversed[i][0:8] 403 | 404 | 405 | 406 | ratio_rows[i].append(ratio_rows_reversed[i][0]) 407 | ratio_rows[i].append(ratio_rows_reversed[i][7]) 408 | ratio_rows[i].append(ratio_rows_reversed[i][6]) 409 | ratio_rows[i].append(ratio_rows_reversed[i][5]) 410 | ratio_rows[i].append(ratio_rows_reversed[i][4]) 411 | ratio_rows[i].append(ratio_rows_reversed[i][3]) 412 | ratio_rows[i].append(ratio_rows_reversed[i][2]) 413 | ratio_rows[i].append(ratio_rows_reversed[i][1]) 414 | 415 | print "test1: ", ratio_rows 416 | for i in ratio_rows: 417 | for j in range (len(i)): 418 | if j != 0: 419 | if i[j] == "-": 420 | i[j] = "0"; 421 | 422 | print "test" 423 | for i in ratio_rows: 424 | print i 425 | 426 | 427 | ###################### Analysis SUBTOTALS 428 | 429 | analysis_reader = csv.reader(open(ANALYSIS_PATH, 'r')) 430 | 431 | analysis_rows = [] 432 | 433 | for r in analysis_reader: 434 | analysis_rows.append(r) 435 | 436 | ## TEST PRINTING ## 437 | 438 | # IS_rows, BS_rows, ratio_rows, analysis 439 | 440 | # for i in IS_rows: 441 | # print i 442 | 443 | # print "" 444 | # print "" 445 | # print "" 446 | # print "" 447 | 448 | # for i in BS_rows: 449 | # print i 450 | 451 | # print "" 452 | # print "" 453 | # print "" 454 | # print "" 455 | 456 | # for i in ratio_rows: 457 | # print i 458 | 459 | ratio_rows1 = ratio_rows[:] 460 | print "ratiorows1" 461 | print ratio_rows1 462 | 463 | # print "" 464 | # print "" 465 | # print "" 466 | # print "" 467 | 468 | 469 | # for i in analysis_rows: 470 | # print i 471 | 472 | 473 | 474 | # print "" 475 | # print "" 476 | # print "" 477 | # print "" 478 | 479 | 480 | ####### BS/IS ####### 481 | 482 | workbook = xlsxwriter.Workbook(ticker + '.xlsx') 483 | DCF_worksheet = workbook.add_worksheet("DCF") 484 | 485 | FS_worksheet = workbook.add_worksheet("Financial Statements") 486 | 487 | format = workbook.add_format() 488 | 489 | format.set_pattern(1) # This is optional when using a solid fill. 490 | format.set_bg_color('white') 491 | 492 | format1 = workbook.add_format() 493 | format1.set_font_size(30) 494 | 495 | header1 = getFormat(workbook, "header1", False) 496 | header1Wide = getFormat(workbook, "header1", True) 497 | 498 | header2 = getFormat(workbook, "header2", False) 499 | header2Wide = getFormat(workbook, "header2", True) 500 | 501 | header3 = getFormat(workbook, "header3", False) 502 | header3Wide = getFormat(workbook, "header3", True) 503 | 504 | dollar_top = getFormat(workbook, "dollars_top", False) 505 | dollar = getFormat(workbook, "dollars", False) 506 | 507 | percentage_top = getFormat(workbook, "percentage_top", False) 508 | percentage = getFormat(workbook, "percentage", False) 509 | 510 | regularWide = getFormat(workbook, "header1", True) 511 | 512 | 513 | IS = 6 514 | IS_length = 0 515 | 516 | DCF = IS + IS_length + 3 517 | 518 | 519 | 520 | 521 | for col in range(26): 522 | for row in range (1000): 523 | FS_worksheet.write(row,col, '', format) 524 | 525 | 526 | bold = workbook.add_format({'bold': 1}) 527 | bold.set_bg_color('white') 528 | bold.set_font_name("Times New Roman") 529 | 530 | 531 | FS_worksheet.set_column(0, 0, 1) 532 | FS_worksheet.set_column(1, 1, 45) 533 | FS_worksheet.set_column(2, 2, 16) 534 | FS_worksheet.set_column(3, 3, 16) 535 | FS_worksheet.set_column(4, 4, 16) 536 | FS_worksheet.set_column(5, 5, 16) 537 | FS_worksheet.set_column(6, 6, 16) 538 | FS_worksheet.set_column(7, 7, 16) 539 | FS_worksheet.set_column(8, 8, 16) 540 | FS_worksheet.set_column(9, 9, 16) 541 | FS_worksheet.set_column(10, 10, 16) 542 | FS_worksheet.set_column(11, 11, 16) 543 | FS_worksheet.set_column(12, 12, 16) 544 | FS_worksheet.set_column(13, 13, 16) 545 | 546 | driver2 = webdriver.PhantomJS() 547 | driver2.set_window_size(1120, 550) 548 | 549 | driver2.delete_all_cookies() 550 | driver2.get("https://www.google.com/finance") 551 | element150 = driver2.find_element_by_id("gbqfq") 552 | element150.send_keys(ticker) 553 | driver2.find_element_by_class_name("gbqfb").click() 554 | driver2.get_screenshot_as_file('mhacks200.png') 555 | 556 | element200 = driver2.find_element_by_xpath('.//span[@class = "pr"]').text 557 | element201 = driver2.find_element_by_xpath('.//span[@class = "nwp"]').text 558 | #element200 = driver2.find_element_by_id("price-panel") 559 | 560 | 561 | driver2.quit() 562 | 563 | 564 | 565 | FS_worksheet.write(1,1, 'Microsoft Corporation', bold) 566 | FS_worksheet.write(2,1, 'Financial Statements', bold) 567 | FS_worksheet.write(2,3, 'Stock Price:', bold) 568 | FS_worksheet.write(2,4, element200, format1) 569 | FS_worksheet.write(3,3, 'Date Compiled :', bold) 570 | FS_worksheet.write(3,4, element201, bold) 571 | 572 | FS_worksheet.write(IS, 1, 'Income Statement', header1) 573 | 574 | historical_years = 7 575 | projected_years = 5 576 | 577 | total_years = historical_years + projected_years 578 | 579 | FS_worksheet.write(7,1, 'Account Name', bold) 580 | FS_worksheet.write(7,2, '2009', bold) 581 | FS_worksheet.write(7,3, '2010', bold) 582 | FS_worksheet.write(7,4, '2011', bold) 583 | FS_worksheet.write(7,5, '2012', bold) 584 | FS_worksheet.write(7,6, '2013', bold) 585 | FS_worksheet.write(7,7, '2014', bold) 586 | FS_worksheet.write(7,8, '2015', bold) 587 | IS_length += 1 588 | 589 | 590 | 591 | for i in range (2, 9): 592 | FS_worksheet.write(IS, i, '', header1) 593 | row = 1 594 | col = 0 595 | # IS_length += 1 596 | 597 | for j in IS_rows: 598 | FS_worksheet.write(row, col + 1, IS_rows[row][col], bold) 599 | 600 | 601 | for j in range(0,len(IS_rows)): 602 | IS_length += 1 603 | 604 | for x in range(0,8): 605 | if j == 0: 606 | FS_worksheet.write(IS + 3 + j, x + 1, IS_rows[j][x], dollar_top) 607 | else: 608 | FS_worksheet.write(IS + 3 + j, x + 1, IS_rows[j][x], dollar) 609 | 610 | BS_position = IS + IS_length + 5 611 | 612 | FS_worksheet.write(BS_position, 1, 'Balance Sheet', header1) 613 | 614 | for i in range (2, 9): 615 | FS_worksheet.write(BS_position, i, '', header1) 616 | row = 1 617 | col = 0 618 | # IS_length += 1 619 | for j in BS_rows: 620 | FS_worksheet.write(row, col + 1, BS_rows[row][col], dollar) 621 | 622 | 623 | for j in range(0,len(BS_rows)): 624 | 625 | for x in range(0,8): 626 | if j == 0: 627 | FS_worksheet.write(BS_position + 3 + j, x + 1, BS_rows[j][x], dollar_top) 628 | else: 629 | FS_worksheet.write(BS_position + 3 + j, x + 1, BS_rows[j][x], dollar) 630 | 631 | 632 | FS_worksheet.write(BS_position + 1,1, 'Account Name', bold) 633 | FS_worksheet.write(BS_position + 1,2, '2009', bold) 634 | FS_worksheet.write(BS_position + 1,3, '2010', bold) 635 | FS_worksheet.write(BS_position + 1,4, '2011', bold) 636 | FS_worksheet.write(BS_position + 1,5, '2012', bold) 637 | FS_worksheet.write(BS_position + 1,6, '2013', bold) 638 | FS_worksheet.write(BS_position + 1,7, '2014', bold) 639 | FS_worksheet.write(BS_position + 1,8, '2015', bold) 640 | 641 | FS_worksheet.write(1,1, '', bold) 642 | 643 | ####### RATIO SUMMARY ######## 644 | 645 | 646 | 647 | ratio_position = 6 648 | 649 | ratio_worksheet = workbook.add_worksheet("Ratio Summary") 650 | 651 | ratio_worksheet.set_column(0, 0, 1) 652 | ratio_worksheet.set_column(1, 1, 45) 653 | ratio_worksheet.set_column(2, 2, 16) 654 | ratio_worksheet.set_column(3, 3, 16) 655 | ratio_worksheet.set_column(4, 4, 16) 656 | ratio_worksheet.set_column(5, 5, 16) 657 | ratio_worksheet.set_column(6, 6, 16) 658 | ratio_worksheet.set_column(7, 7, 16) 659 | ratio_worksheet.set_column(8, 8, 16) 660 | ratio_worksheet.set_column(9, 9, 16) 661 | ratio_worksheet.set_column(10, 10, 16) 662 | ratio_worksheet.set_column(11, 11, 16) 663 | ratio_worksheet.set_column(12, 12, 16) 664 | ratio_worksheet.set_column(13, 13, 16) 665 | 666 | for col in range(26): 667 | for row in range (1000): 668 | ratio_worksheet.write(row,col, '', format) 669 | 670 | ratio_position +=1 671 | 672 | 673 | ratio_position +=1 674 | 675 | ratio_worksheet.write(1,1, 'Microsoft Corporation', bold) 676 | ratio_worksheet.write(2,1, 'Key Ratio Summary', bold) 677 | 678 | ratio_worksheet.write(2,3, 'Stock Price:', bold) 679 | ratio_worksheet.write(2,4, element200, format1) 680 | ratio_worksheet.write(3,3, 'Date Compiled: ', bold) 681 | ratio_worksheet.write(3,4, element201, bold) 682 | 683 | ratio_worksheet.write(ratio_position, 1, 'Ratio Analysis', header1) 684 | 685 | 686 | ratio_worksheet.write(ratio_position + 1, 1, 'Description', bold) 687 | ratio_worksheet.write(ratio_position + 1, 2, '2009', bold) 688 | ratio_worksheet.write(ratio_position + 1, 3, '2010', bold) 689 | ratio_worksheet.write(ratio_position + 1, 4, '2011', bold) 690 | ratio_worksheet.write(ratio_position + 1, 5, '2012', bold) 691 | ratio_worksheet.write(ratio_position + 1, 6, '2013', bold) 692 | ratio_worksheet.write(ratio_position + 1, 7, '2014', bold) 693 | ratio_worksheet.write(ratio_position + 1, 8, '2015', bold) 694 | 695 | for i in range (2, 9): 696 | ratio_worksheet.write(ratio_position, i, '', header1) 697 | row = 1 698 | col = 0 699 | # IS_length += 1 700 | 701 | print ratio_rows 702 | 703 | for j in ratio_rows: 704 | ratio_worksheet.write(row, col + 1, ratio_rows[row][col], bold) 705 | 706 | 707 | for j in range(0,len(ratio_rows)): 708 | ratio_position += 1 709 | 710 | for x in range(0,8): 711 | if j == 0: 712 | ratio_worksheet.write(ratio_position + j + 2, x + 1, ratio_rows[j][x], dollar_top) 713 | else: 714 | ratio_worksheet.write(ratio_position + j + 2, x + 1, ratio_rows[j][x], dollar) 715 | 716 | ratio_worksheet.write(1,1, '', bold) 717 | 718 | 719 | ######### DCF ######### 720 | 721 | DCF_position = 6 722 | 723 | 724 | DCF_worksheet.set_column(0, 0, 1) 725 | DCF_worksheet.set_column(1, 1, 45) 726 | DCF_worksheet.set_column(2, 2, 16) 727 | DCF_worksheet.set_column(3, 3, 16) 728 | DCF_worksheet.set_column(4, 4, 16) 729 | DCF_worksheet.set_column(5, 5, 16) 730 | DCF_worksheet.set_column(6, 6, 16) 731 | DCF_worksheet.set_column(7, 7, 16) 732 | DCF_worksheet.set_column(8, 8, 16) 733 | DCF_worksheet.set_column(9, 9, 16) 734 | DCF_worksheet.set_column(10, 10, 16) 735 | DCF_worksheet.set_column(11, 11, 16) 736 | DCF_worksheet.set_column(12, 12, 16) 737 | DCF_worksheet.set_column(13, 13, 16) 738 | 739 | for col in range(26): 740 | for row in range (1000): 741 | DCF_worksheet.write(row,col, '', format) 742 | 743 | DCF_position +=1 744 | 745 | DCF_worksheet.write(DCF_position + 1,1, 'Account Name', bold) 746 | DCF_worksheet.write(DCF_position + 1,2, '2009', bold) 747 | DCF_worksheet.write(DCF_position + 1,3, '2010', bold) 748 | DCF_worksheet.write(DCF_position + 1,4, '2011', bold) 749 | DCF_worksheet.write(DCF_position + 1,5, '2012', bold) 750 | DCF_worksheet.write(DCF_position + 1,6, '2013', bold) 751 | DCF_worksheet.write(DCF_position + 1,7, '2014', bold) 752 | DCF_worksheet.write(DCF_position + 1,8, '2015', bold) 753 | 754 | 755 | 756 | DCF_worksheet.write(1,1, 'Microsoft Corporation', bold) 757 | DCF_worksheet.write(2,1, 'Discounted Cash Flow Analysis', bold) 758 | DCF_worksheet.write(2,3, 'Stock Price:', bold) 759 | DCF_worksheet.write(2,4, element200, format1) 760 | DCF_worksheet.write(3,3, 'Date Compiled:', bold) 761 | DCF_worksheet.write(3,4, element201, bold) 762 | 763 | DCF_worksheet.write(DCF_position, 1, 'Discounted Cash Flow Analysis', header1) 764 | 765 | for i in range (2, 1 + 11): 766 | DCF_worksheet.write(DCF_position, i, '', header1) 767 | row = 1 768 | col = 0 769 | 770 | DCF_worksheet.write(DCF_position + 1, 1, 'Description', bold) 771 | DCF_worksheet.write(DCF_position + 1, 2, '2013', bold) 772 | DCF_worksheet.write(DCF_position + 1, 3, '2014', bold) 773 | DCF_worksheet.write(DCF_position + 1, 4, '2015E', bold) 774 | DCF_worksheet.write(DCF_position + 1, 5, '2016E', bold) 775 | DCF_worksheet.write(DCF_position + 1, 6, '2017E', bold) 776 | DCF_worksheet.write(DCF_position + 1, 7, '2018E', bold) 777 | DCF_worksheet.write(DCF_position + 1, 8, '2019E', bold) 778 | DCF_worksheet.write(DCF_position + 1, 9, '2020E', bold) 779 | DCF_worksheet.write(DCF_position + 1, 10, '2021E', bold) 780 | DCF_worksheet.write(DCF_position + 1, 11, '2022E', bold) 781 | 782 | 783 | 784 | DCF_position += 1 785 | 786 | # REVENUES 787 | 788 | DCF_worksheet.write(DCF_position + 1, 1, analysis_rows[0][0], dollar) # REVENUES 789 | DCF_worksheet.write(DCF_position + 1, 2, analysis_rows[0][2], dollar) # 2 YEARS AGO 790 | DCF_worksheet.write(DCF_position + 1, 3, analysis_rows[0][1], dollar) # LAST YEAR 791 | 792 | 793 | DCF_worksheet.write(DCF_position + 2, 1, "Growth", dollar) 794 | DCF_worksheet.write(DCF_position + 2, 2, "", dollar) 795 | DCF_worksheet.write(DCF_position + 2, 3, "=" + getCell(DCF_position + 1, 3) + "/" + getCell(DCF_position + 1, 2) + "-1", percentage) 796 | 797 | # projected growth 798 | DCF_worksheet.write(DCF_position + 2, 4, '=' + getCell(DCF_position + 2, 3) + "*0.6", percentage) 799 | DCF_worksheet.write(DCF_position + 2, 5, '=' + getCell(DCF_position + 2, 4), percentage) 800 | DCF_worksheet.write(DCF_position + 2, 6, '=' + getCell(DCF_position + 2, 5), percentage) 801 | DCF_worksheet.write(DCF_position + 2, 7, '=' + getCell(DCF_position + 2, 6), percentage) 802 | DCF_worksheet.write(DCF_position + 2, 8, '=' + getCell(DCF_position + 2, 7), percentage) 803 | DCF_worksheet.write(DCF_position + 2, 9, '=' + getCell(DCF_position + 2, 8), percentage) 804 | DCF_worksheet.write(DCF_position + 2, 10, '=' + getCell(DCF_position + 2, 9), percentage) 805 | DCF_worksheet.write(DCF_position + 2, 11, '=' + getCell(DCF_position + 2, 10), percentage) 806 | 807 | # resulting revenues 808 | DCF_worksheet.write(DCF_position + 1, 4, '=(1+' + getCell(DCF_position + 2, 4) + ")*" + getCell(DCF_position + 1, 3), dollar) 809 | DCF_worksheet.write(DCF_position + 1, 5, '=(1+' + getCell(DCF_position + 2, 5) + ")*" + getCell(DCF_position + 1, 4), dollar) 810 | DCF_worksheet.write(DCF_position + 1, 6, '=(1+' + getCell(DCF_position + 2, 6) + ")*" + getCell(DCF_position + 1, 5), dollar) 811 | DCF_worksheet.write(DCF_position + 1, 7, '=(1+' + getCell(DCF_position + 2, 7) + ")*" + getCell(DCF_position + 1, 6), dollar) 812 | DCF_worksheet.write(DCF_position + 1, 8, '=(1+' + getCell(DCF_position + 2, 8) + ")*" + getCell(DCF_position + 1, 7), dollar) 813 | DCF_worksheet.write(DCF_position + 1, 9, '=(1+' + getCell(DCF_position + 2, 9) + ")*" + getCell(DCF_position + 1, 8), dollar) 814 | DCF_worksheet.write(DCF_position + 1, 10, '=(1+' + getCell(DCF_position + 2, 10) + ")*" + getCell(DCF_position + 1, 9), dollar) 815 | DCF_worksheet.write(DCF_position + 1, 11, '=(1+' + getCell(DCF_position + 2, 11) + ")*" + getCell(DCF_position + 1, 10), dollar) 816 | 817 | DCF_position += 2 818 | 819 | 820 | # DIRECT COSTS 821 | 822 | 823 | DCF_worksheet.write(DCF_position + 1, 1, analysis_rows[1][0], dollar) # REVENUES 824 | DCF_worksheet.write(DCF_position + 1, 2, analysis_rows[1][2], dollar) # 2 YEARS AGO 825 | DCF_worksheet.write(DCF_position + 1, 3, analysis_rows[1][1], dollar) # LAST YEAR 826 | 827 | 828 | DCF_worksheet.write(DCF_position + 2, 1, "% of Sales", dollar) 829 | DCF_worksheet.write(DCF_position + 2, 2, "=" + getCell(DCF_position + 1, 2) + "/" + getCell(DCF_position - 1, 2), percentage) 830 | DCF_worksheet.write(DCF_position + 2, 3, "=" + getCell(DCF_position + 1, 3) + "/" + getCell(DCF_position - 1, 3), percentage) 831 | 832 | # projected % of revenue 833 | DCF_worksheet.write(DCF_position + 2, 4, '=' + getCell(DCF_position + 2, 3), percentage) 834 | DCF_worksheet.write(DCF_position + 2, 5, '=' + getCell(DCF_position + 2, 4), percentage) 835 | DCF_worksheet.write(DCF_position + 2, 6, '=' + getCell(DCF_position + 2, 5), percentage) 836 | DCF_worksheet.write(DCF_position + 2, 7, '=' + getCell(DCF_position + 2, 6), percentage) 837 | DCF_worksheet.write(DCF_position + 2, 8, '=' + getCell(DCF_position + 2, 7), percentage) 838 | DCF_worksheet.write(DCF_position + 2, 9, '=' + getCell(DCF_position + 2, 8), percentage) 839 | DCF_worksheet.write(DCF_position + 2, 10, '=' + getCell(DCF_position + 2, 9), percentage) 840 | DCF_worksheet.write(DCF_position + 2, 11, '=' + getCell(DCF_position + 2, 10), percentage) 841 | 842 | # resulting costs 843 | DCF_worksheet.write(DCF_position + 1, 4, '=' + getCell(DCF_position + 2, 4) + "*" + getCell(DCF_position - 1, 4), dollar) 844 | DCF_worksheet.write(DCF_position + 1, 5, '=' + getCell(DCF_position + 2, 5) + "*" + getCell(DCF_position - 1, 5), dollar) 845 | DCF_worksheet.write(DCF_position + 1, 6, '=' + getCell(DCF_position + 2, 6) + "*" + getCell(DCF_position - 1, 6), dollar) 846 | DCF_worksheet.write(DCF_position + 1, 7, '=' + getCell(DCF_position + 2, 7) + "*" + getCell(DCF_position - 1, 7), dollar) 847 | DCF_worksheet.write(DCF_position + 1, 8, '=' + getCell(DCF_position + 2, 8) + "*" + getCell(DCF_position - 1, 8), dollar) 848 | DCF_worksheet.write(DCF_position + 1, 9, '=' + getCell(DCF_position + 2, 9) + "*" + getCell(DCF_position - 1, 9), dollar) 849 | DCF_worksheet.write(DCF_position + 1, 10, '=' + getCell(DCF_position + 2, 10) + "*" + getCell(DCF_position - 1, 10), dollar) 850 | DCF_worksheet.write(DCF_position + 1, 11, '=' + getCell(DCF_position + 2, 11) + "*" + getCell(DCF_position - 1, 11), dollar) 851 | 852 | 853 | DCF_position += 2 854 | 855 | 856 | # GROSS PROFIT 857 | 858 | 859 | DCF_worksheet.write(DCF_position + 1, 1, analysis_rows[2][0], dollar) # REVENUES 860 | DCF_worksheet.write(DCF_position + 1, 2, analysis_rows[2][2], dollar) # 2 YEARS AGO 861 | DCF_worksheet.write(DCF_position + 1, 3, analysis_rows[2][1], dollar) # LAST YEAR 862 | 863 | 864 | DCF_worksheet.write(DCF_position + 2, 1, "% of Sales", dollar) 865 | DCF_worksheet.write(DCF_position + 2, 2, "=" + getCell(DCF_position + 1, 2) + "/" + getCell(DCF_position - 3, 2), percentage) 866 | DCF_worksheet.write(DCF_position + 2, 3, "=" + getCell(DCF_position + 1, 3) + "/" + getCell(DCF_position - 3, 3), percentage) 867 | DCF_worksheet.write(DCF_position + 2, 4, "=" + getCell(DCF_position + 1, 4) + "/" + getCell(DCF_position - 3, 4), percentage) 868 | DCF_worksheet.write(DCF_position + 2, 5, "=" + getCell(DCF_position + 1, 5) + "/" + getCell(DCF_position - 3, 5), percentage) 869 | DCF_worksheet.write(DCF_position + 2, 6, "=" + getCell(DCF_position + 1, 6) + "/" + getCell(DCF_position - 3, 6), percentage) 870 | DCF_worksheet.write(DCF_position + 2, 7, "=" + getCell(DCF_position + 1, 7) + "/" + getCell(DCF_position - 3, 7), percentage) 871 | DCF_worksheet.write(DCF_position + 2, 8, "=" + getCell(DCF_position + 1, 8) + "/" + getCell(DCF_position - 3, 8), percentage) 872 | DCF_worksheet.write(DCF_position + 2, 9, "=" + getCell(DCF_position + 1, 9) + "/" + getCell(DCF_position - 3, 9), percentage) 873 | DCF_worksheet.write(DCF_position + 2, 10, "=" + getCell(DCF_position + 1, 10) + "/" + getCell(DCF_position - 3, 10), percentage) 874 | DCF_worksheet.write(DCF_position + 2, 11, "=" + getCell(DCF_position + 1, 11) + "/" + getCell(DCF_position - 3, 11), percentage) 875 | 876 | 877 | # resulting costs 878 | DCF_worksheet.write(DCF_position + 1, 4, '=' + getCell(DCF_position - 3, 4) + "-" + getCell(DCF_position - 1, 4), dollar) 879 | DCF_worksheet.write(DCF_position + 1, 5, '=' + getCell(DCF_position - 3, 5) + "-" + getCell(DCF_position - 1, 5), dollar) 880 | DCF_worksheet.write(DCF_position + 1, 6, '=' + getCell(DCF_position - 3, 6) + "-" + getCell(DCF_position - 1, 6), dollar) 881 | DCF_worksheet.write(DCF_position + 1, 7, '=' + getCell(DCF_position - 3, 7) + "-" + getCell(DCF_position - 1, 7), dollar) 882 | DCF_worksheet.write(DCF_position + 1, 8, '=' + getCell(DCF_position - 3, 8) + "-" + getCell(DCF_position - 1, 8), dollar) 883 | DCF_worksheet.write(DCF_position + 1, 9, '=' + getCell(DCF_position - 3, 9) + "-" + getCell(DCF_position - 1, 9), dollar) 884 | DCF_worksheet.write(DCF_position + 1, 10, '=' + getCell(DCF_position - 3, 10) + "-" + getCell(DCF_position - 1, 10), dollar) 885 | DCF_worksheet.write(DCF_position + 1, 11, '=' + getCell(DCF_position - 3, 11) + "-" + getCell(DCF_position - 1, 11), dollar) 886 | 887 | 888 | DCF_position += 4 889 | 890 | # Taxation 891 | 892 | 893 | DCF_worksheet.write(DCF_position + 1, 1, analysis_rows[3][0], dollar) # REVENUES 894 | DCF_worksheet.write(DCF_position + 1, 2, analysis_rows[3][2], dollar) # 2 YEARS AGO 895 | DCF_worksheet.write(DCF_position + 1, 3, analysis_rows[3][1], dollar) # LAST YEAR 896 | 897 | 898 | DCF_worksheet.write(DCF_position + 2, 1, "% of Sales", dollar) 899 | DCF_worksheet.write(DCF_position + 2, 2, "=" + getCell(DCF_position + 1, 2) + "/" + getCell(DCF_position - 7, 2), percentage) 900 | DCF_worksheet.write(DCF_position + 2, 3, "=" + getCell(DCF_position + 1, 3) + "/" + getCell(DCF_position - 7, 3), percentage) 901 | 902 | # projected % of revenue 903 | DCF_worksheet.write(DCF_position + 2, 4, '=' + getCell(DCF_position + 2, 3), percentage) 904 | DCF_worksheet.write(DCF_position + 2, 5, '=' + getCell(DCF_position + 2, 4), percentage) 905 | DCF_worksheet.write(DCF_position + 2, 6, '=' + getCell(DCF_position + 2, 5), percentage) 906 | DCF_worksheet.write(DCF_position + 2, 7, '=' + getCell(DCF_position + 2, 6), percentage) 907 | DCF_worksheet.write(DCF_position + 2, 8, '=' + getCell(DCF_position + 2, 7), percentage) 908 | DCF_worksheet.write(DCF_position + 2, 9, '=' + getCell(DCF_position + 2, 8), percentage) 909 | DCF_worksheet.write(DCF_position + 2, 10, '=' + getCell(DCF_position + 2, 9), percentage) 910 | DCF_worksheet.write(DCF_position + 2, 11, '=' + getCell(DCF_position + 2, 10), percentage) 911 | 912 | # resulting costs 913 | DCF_worksheet.write(DCF_position + 1, 4, '=' + getCell(DCF_position + 2, 4) + "*" + getCell(DCF_position - 7, 4), dollar) 914 | DCF_worksheet.write(DCF_position + 1, 5, '=' + getCell(DCF_position + 2, 5) + "*" + getCell(DCF_position - 7, 5), dollar) 915 | DCF_worksheet.write(DCF_position + 1, 6, '=' + getCell(DCF_position + 2, 6) + "*" + getCell(DCF_position - 7, 6), dollar) 916 | DCF_worksheet.write(DCF_position + 1, 7, '=' + getCell(DCF_position + 2, 7) + "*" + getCell(DCF_position - 7, 7), dollar) 917 | DCF_worksheet.write(DCF_position + 1, 8, '=' + getCell(DCF_position + 2, 8) + "*" + getCell(DCF_position - 7, 8), dollar) 918 | DCF_worksheet.write(DCF_position + 1, 9, '=' + getCell(DCF_position + 2, 9) + "*" + getCell(DCF_position - 7, 9), dollar) 919 | DCF_worksheet.write(DCF_position + 1, 10, '=' + getCell(DCF_position + 2, 10) + "*" + getCell(DCF_position - 7, 10), dollar) 920 | DCF_worksheet.write(DCF_position + 1, 11, '=' + getCell(DCF_position + 2, 11) + "*" + getCell(DCF_position - 7, 11), dollar) 921 | 922 | DCF_position += 2 923 | 924 | 925 | 926 | # Net Income AND Fixed Costs 927 | 928 | # NI HISTORICAL 929 | DCF_worksheet.write(DCF_position + 1, 1, analysis_rows[4][0], dollar) # REVENUES 930 | DCF_worksheet.write(DCF_position + 1, 2, analysis_rows[4][2], dollar) # 2 YEARS AGO 931 | DCF_worksheet.write(DCF_position + 1, 3, analysis_rows[4][1], dollar) # LAST YEAR 932 | 933 | # FC HISTORICAL 934 | DCF_worksheet.write(DCF_position - 3, 1, "Fixed Costs", dollar) 935 | DCF_worksheet.write(DCF_position - 3, 2, '=' + getCell(DCF_position - 5, 2) + "-" + getCell(DCF_position + 1, 2) + "-" + getCell(DCF_position - 1, 2), dollar) 936 | DCF_worksheet.write(DCF_position - 3, 3, '=' + getCell(DCF_position - 5, 3) + "-" + getCell(DCF_position + 1, 3) + "-" + getCell(DCF_position - 1, 3), dollar) 937 | 938 | # FC % revenue 939 | 940 | DCF_worksheet.write(DCF_position - 2, 1, "% of Sales", dollar) 941 | DCF_worksheet.write(DCF_position - 2, 2, "=" + getCell(DCF_position - 3, 2) + "/" + getCell(DCF_position - 9, 2), percentage) 942 | DCF_worksheet.write(DCF_position - 2, 3, "=" + getCell(DCF_position - 3, 3) + "/" + getCell(DCF_position - 9, 3), percentage) 943 | DCF_worksheet.write(DCF_position - 2, 4, "=" + getCell(DCF_position - 3, 4) + "/" + getCell(DCF_position - 9, 4), percentage) 944 | DCF_worksheet.write(DCF_position - 2, 5, "=" + getCell(DCF_position - 3, 5) + "/" + getCell(DCF_position - 9, 5), percentage) 945 | DCF_worksheet.write(DCF_position - 2, 6, "=" + getCell(DCF_position - 3, 6) + "/" + getCell(DCF_position - 9, 6), percentage) 946 | DCF_worksheet.write(DCF_position - 2, 7, "=" + getCell(DCF_position - 3, 7) + "/" + getCell(DCF_position - 9, 7), percentage) 947 | DCF_worksheet.write(DCF_position - 2, 8, "=" + getCell(DCF_position - 3, 8) + "/" + getCell(DCF_position - 9, 8), percentage) 948 | DCF_worksheet.write(DCF_position - 2, 9, "=" + getCell(DCF_position - 3, 9) + "/" + getCell(DCF_position - 9, 9), percentage) 949 | DCF_worksheet.write(DCF_position - 2, 10, "=" + getCell(DCF_position - 3, 10) + "/" + getCell(DCF_position - 9, 10), percentage) 950 | DCF_worksheet.write(DCF_position - 2, 11, "=" + getCell(DCF_position - 3, 11) + "/" + getCell(DCF_position - 9, 11), percentage) 951 | 952 | 953 | DCF_worksheet.write(DCF_position - 3, 4, '=' + getCell(DCF_position - 3, 3), dollar) 954 | DCF_worksheet.write(DCF_position - 3, 5, '=' + getCell(DCF_position - 3, 4), dollar) 955 | DCF_worksheet.write(DCF_position - 3, 6, '=' + getCell(DCF_position - 3, 5), dollar) 956 | DCF_worksheet.write(DCF_position - 3, 7, '=' + getCell(DCF_position - 3, 6), dollar) 957 | DCF_worksheet.write(DCF_position - 3, 8, '=' + getCell(DCF_position - 3, 7), dollar) 958 | DCF_worksheet.write(DCF_position - 3, 9, '=' + getCell(DCF_position - 3, 8), dollar) 959 | DCF_worksheet.write(DCF_position - 3, 10, '=' + getCell(DCF_position - 3, 9), dollar) 960 | DCF_worksheet.write(DCF_position - 3, 11, '=' + getCell(DCF_position - 3, 10), dollar) 961 | 962 | # net income 963 | 964 | DCF_worksheet.write(DCF_position + 1, 4, '=' + getCell(DCF_position - 5, 4) + "-" + getCell(DCF_position - 3, 4) + "-" + getCell(DCF_position - 1, 4), dollar) 965 | DCF_worksheet.write(DCF_position + 1, 5, '=' + getCell(DCF_position - 5, 5) + "-" + getCell(DCF_position - 3, 5) + "-" + getCell(DCF_position - 1, 5), dollar) 966 | DCF_worksheet.write(DCF_position + 1, 6, '=' + getCell(DCF_position - 5, 6) + "-" + getCell(DCF_position - 3, 6) + "-" + getCell(DCF_position - 1, 6), dollar) 967 | DCF_worksheet.write(DCF_position + 1, 7, '=' + getCell(DCF_position - 5, 7) + "-" + getCell(DCF_position - 3, 7) + "-" + getCell(DCF_position - 1, 7), dollar) 968 | DCF_worksheet.write(DCF_position + 1, 8, '=' + getCell(DCF_position - 5, 8) + "-" + getCell(DCF_position - 3, 8) + "-" + getCell(DCF_position - 1, 8), dollar) 969 | DCF_worksheet.write(DCF_position + 1, 9, '=' + getCell(DCF_position - 5, 9) + "-" + getCell(DCF_position - 3, 9) + "-" + getCell(DCF_position - 1, 9), dollar) 970 | DCF_worksheet.write(DCF_position + 1, 10, '=' + getCell(DCF_position - 5, 10) + "-" + getCell(DCF_position - 3, 10) + "-" + getCell(DCF_position - 1, 10), dollar) 971 | DCF_worksheet.write(DCF_position + 1, 11, '=' + getCell(DCF_position - 5, 11) + "-" + getCell(DCF_position - 3, 11) + "-" + getCell(DCF_position - 1, 11), dollar) 972 | 973 | DCF_worksheet.write(1,1, '', bold) 974 | 975 | DCF_position += 2 976 | 977 | # 978 | # print len(ratio_rows1) 979 | 980 | 981 | DCF_worksheet.write(DCF_position + 1, 1, 'Free Cash Flow (Projections)', dollar) 982 | DCF_worksheet.write(DCF_position + 1, 2, '=' + ratio_rows[3][6] + "/100*" + getCell(DCF_position - 11, 2), dollar) 983 | DCF_worksheet.write(DCF_position + 1, 3, '=' + ratio_rows[3][7] + "/100*" + getCell(DCF_position - 11, 3), dollar) 984 | 985 | num_ebitda_margins = 0 986 | avg_ebitda_margins = 0 987 | 988 | for r in range (1, len(ratio_rows[3])): 989 | # print ratio_rows[3][r] 990 | avg_ebitda_margins += float(ratio_rows[3][r]) 991 | 992 | avg_ebitda_margins /= len(ratio_rows[3]) 993 | 994 | # print "avg: " + str(avg_ebitda_margins) 995 | 996 | DCF_worksheet.write(DCF_position + 1, 4, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 4), dollar) 997 | DCF_worksheet.write(DCF_position + 1, 5, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 5), dollar) 998 | DCF_worksheet.write(DCF_position + 1, 6, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 6), dollar) 999 | DCF_worksheet.write(DCF_position + 1, 7, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 7), dollar) 1000 | DCF_worksheet.write(DCF_position + 1, 8, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 8), dollar) 1001 | DCF_worksheet.write(DCF_position + 1, 9, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 9), dollar) 1002 | DCF_worksheet.write(DCF_position + 1, 10, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 10), dollar) 1003 | DCF_worksheet.write(DCF_position + 1, 11, '=' + str(avg_ebitda_margins) + "/100*" + getCell(DCF_position - 11, 11), dollar) 1004 | 1005 | DCF_position += 2 1006 | 1007 | DCF_worksheet.write(DCF_position + 1, 1, 'WACC', dollar) 1008 | DCF_worksheet.write(DCF_position + 1, 2, '6.29%', dollar) 1009 | 1010 | DCF_position += 2 1011 | 1012 | DCF_worksheet.write(DCF_position + 1, 1, 'Terminal Value', dollar) 1013 | DCF_worksheet.write(DCF_position + 1, 2, '=' + getCell(DCF_position - 3, 11) + "*1.03/(" + getCell(DCF_position - 1, 2) + "-0.03" + ")", dollar) 1014 | 1015 | DCF_position += 2 1016 | 1017 | DCF_worksheet.write(DCF_position + 1, 1, 'Enterprise Value', dollar) 1018 | DCF_worksheet.write(DCF_position + 1, 2, '=NPV(' + getCell(DCF_position - 3, 2) + "," + getCell(DCF_position - 5, 4) + ":" + getCell(DCF_position - 5, 11) + ")+" + getCell(DCF_position - 1, 2) + "/(1+" + getCell(DCF_position - 3, 2) + ")^8" , dollar) 1019 | 1020 | 1021 | # DCF_worksheet.write(DCF_position + 2, 1, "% of Sales", dollar) 1022 | # DCF_worksheet.write(DCF_position + 2, 2, "=" + getCell(DCF_position + 1, 2) + "/" + getCell(DCF_position - 9, 2), dollar) 1023 | # DCF_worksheet.write(DCF_position + 2, 3, "=" + getCell(DCF_position + 1, 3) + "/" + getCell(DCF_position - 9, 3), dollar) 1024 | # DCF_worksheet.write(DCF_position + 2, 4, "=" + getCell(DCF_position + 1, 4) + "/" + getCell(DCF_position - 9, 4), dollar) 1025 | # DCF_worksheet.write(DCF_position + 2, 5, "=" + getCell(DCF_position + 1, 5) + "/" + getCell(DCF_position - 9, 5), dollar) 1026 | # DCF_worksheet.write(DCF_position + 2, 6, "=" + getCell(DCF_position + 1, 6) + "/" + getCell(DCF_position - 9, 6), dollar) 1027 | # DCF_worksheet.write(DCF_position + 2, 7, "=" + getCell(DCF_position + 1, 7) + "/" + getCell(DCF_position - 9, 7), dollar) 1028 | # DCF_worksheet.write(DCF_position + 2, 8, "=" + getCell(DCF_position + 1, 8) + "/" + getCell(DCF_position - 9, 8), dollar) 1029 | # DCF_worksheet.write(DCF_position + 2, 9, "=" + getCell(DCF_position + 1, 9) + "/" + getCell(DCF_position - 9, 9), dollar) 1030 | # DCF_worksheet.write(DCF_position + 2, 10, "=" + getCell(DCF_position + 1, 10) + "/" + getCell(DCF_position - 9, 10), dollar) 1031 | # DCF_worksheet.write(DCF_position + 2, 11, "=" + getCell(DCF_position + 1, 11) + "/" + getCell(DCF_position - 9, 11), dollar) 1032 | # 1033 | # 1034 | # # resulting costs 1035 | # DCF_worksheet.write(DCF_position + 1, 4, '=' + getCell(DCF_position - 3, 4) + "-" + getCell(DCF_position - 1, 4), dollar) 1036 | # DCF_worksheet.write(DCF_position + 1, 5, '=' + getCell(DCF_position - 3, 5) + "-" + getCell(DCF_position - 1, 5), dollar) 1037 | # DCF_worksheet.write(DCF_position + 1, 6, '=' + getCell(DCF_position - 3, 6) + "-" + getCell(DCF_position - 1, 6), dollar) 1038 | # DCF_worksheet.write(DCF_position + 1, 7, '=' + getCell(DCF_position - 3, 7) + "-" + getCell(DCF_position - 1, 7), dollar) 1039 | # DCF_worksheet.write(DCF_position + 1, 8, '=' + getCell(DCF_position - 3, 8) + "-" + getCell(DCF_position - 1, 8), dollar) 1040 | # DCF_worksheet.write(DCF_position + 1, 9, '=' + getCell(DCF_position - 3, 9) + "-" + getCell(DCF_position - 1, 9), dollar) 1041 | # DCF_worksheet.write(DCF_position + 1, 10, '=' + getCell(DCF_position - 3, 10) + "-" + getCell(DCF_position - 1, 10), dollar) 1042 | # DCF_worksheet.write(DCF_position + 1, 11, '=' + getCell(DCF_position - 3, 11) + "-" + getCell(DCF_position - 1, 11), dollar) 1043 | 1044 | 1045 | 1046 | workbook.close() 1047 | 1048 | return ticker + ".xlsx" 1049 | 1050 | 1051 | from flask import Flask 1052 | app = Flask(__name__) 1053 | 1054 | @app.route('/test/') 1055 | def hello_world(): 1056 | return 'Hello World!' 1057 | 1058 | 1059 | 1060 | 1061 | @app.route('/csv/') 1062 | def send_js(path): 1063 | print "server" 1064 | 1065 | 1066 | filepath = get_statements(path) 1067 | 1068 | # print filepath 1069 | return send_from_directory('', filepath) 1070 | 1071 | 1072 | if __name__ == '__main__': 1073 | app.run() 1074 | 1075 | -------------------------------------------------------------------------------- /assets/fonts/glyphicons-halflings-regular.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | --------------------------------------------------------------------------------