{"id":490,"date":"2018-09-02T09:17:45","date_gmt":"2018-09-02T07:17:45","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=490"},"modified":"2020-11-21T22:22:52","modified_gmt":"2020-11-21T21:22:52","slug":"investor-with-edgar","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/","title":{"rendered":"Investor and Edgar"},"content":{"rendered":"<p>In this document we demonstrate how to use the Edgar Database for the selection of the stocks into a portfilio with the help of the <a href=\"https:\/\/www.pschatzmann.ch\/home\/2018\/05\/30\/investor-a-java-quant-library\/\">Investor library.<\/a><\/p>\n<p>This functionality is using the <a href=\"\/home\/2017\/09\/30\/edgar\/\">Edgar Webservice<\/a> which is based on the data which is available on <a href=\"https:\/\/www.sec.gov\/edgar.shtml\">https:\/\/www.sec.gov\/edgar.shtml<\/a>.<\/p>\n<h3>Setup<\/h3>\n<p>We add the necessary jars and import the related packages.<\/p>\n<pre><code class=\"Scala\">%classpath config resolver maven-public http:\/\/software.pschatzmann.ch\/repository\/maven-public\/\n%classpath add mvn ch.pschatzmann:investor:0.9-SNAPSHOT\n%classpath add mvn ch.pschatzmann:jupyter-jdk-extensions:0.0.1-SNAPSHOT\n\n\/\/ our stock evaluation framwork\nimport ch.pschatzmann.dates._;\nimport ch.pschatzmann.stocks._;\nimport ch.pschatzmann.stocks.data.universe._;\nimport ch.pschatzmann.stocks.input._;\nimport ch.pschatzmann.stocks.accounting._;\nimport ch.pschatzmann.stocks.accounting.kpi._;\nimport ch.pschatzmann.stocks.execution._;\nimport ch.pschatzmann.stocks.execution.fees._;\nimport ch.pschatzmann.stocks.execution.price._;\nimport ch.pschatzmann.stocks.parameters._;\nimport ch.pschatzmann.stocks.strategy._;\nimport ch.pschatzmann.stocks.strategy.optimization._;\nimport ch.pschatzmann.stocks.strategy.allocation._;\nimport ch.pschatzmann.stocks.strategy.selection._;\nimport ch.pschatzmann.stocks.integration._;\nimport ch.pschatzmann.stocks.integration.ChartData.FieldName._;\nimport ch.pschatzmann.stocks.strategy.OptimizedStrategy.Schedule._;\n\n\/\/ java\nimport java.util.stream.Collectors;\nimport java.util._;\nimport java.lang._;\nimport java.util.function.Consumer;\nimport scala.collection.JavaConverters\n\n\/\/\/ jupyter custom displayer\nimport ch.pschatzmann.display.Displayers\n<\/code><\/pre>\n<p>Added new repo: maven-public<\/p>\n<p>import ch.pschatzmann.dates._<br \/>\nimport ch.pschatzmann.stocks._<br \/>\nimport ch.pschatzmann.stocks.data.universe._<br \/>\nimport ch.pschatzmann.stocks.input._<br \/>\nimport ch.pschatzmann.stocks.accounting._<br \/>\nimport ch.pschatzmann.stocks.accounting.kpi._<br \/>\nimport ch.pschatzmann.stocks.execution._<br \/>\nimport ch.pschatzmann.stocks.execution.fees._<br \/>\nimport ch.pschatzmann.stocks.execution.price._<br \/>\nimport ch.pschatzmann.stocks.parameters._<br \/>\nimport ch.pschatzmann.stocks.strategy._<br \/>\nimport ch.pschatzmann.stocks.strategy.optimization._<br \/>\nimport ch.pschatzmann.stocks.strategy.allocation._<br \/>\nimport ch.pschatzmann.stocks.strategy.selection._<br \/>\nimport ch.pschatzmann.stocks.integration._<br \/>\nimport ch.pschatzmann.stocks.integration.ChartData.FieldName._<br \/>\nimport ch.pschatzmann.stocks.strategy.OptimizedStrategy.Schedule._<br \/>\nimport java.util.stream&#8230;<\/p>\n<pre><code class=\"Scala\">Displayers.setup()\nContext.setCachingActive(false);\nContext.isCachingActive();\n<\/code><\/pre>\n<p>false<\/p>\n<h3>EdgarUniverse<\/h3>\n<p>We can use the EdgarUniverse to select stocks which are available in the Edgar Database.<br \/>\nThe data is selected by specifying one or mulitple parameters for one year or for multiple years if we define a list of multiplication factors which define the weights for each year: E.g (1.0, 1.0, 1.0) is selecting 3 years where the values are fully counted.<\/p>\n<p>If no parmameter is specified we use the following list: &#8220;NetIncomeLoss&#8221;,&#8221;ProfitLoss&#8221;,&#8221;OperatingIncomeLoss&#8221;.<\/p>\n<p>Here are a couple of examples:<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest Net Income in the year 2017\nnew EdgarUniverse(2017, 10)\n<\/code><\/pre>\n<p>[:AAPL, :MSFT, :XOM, :FB, :PG, :GOOG, :CSCO, :ORCL, :PSX, :PCS]<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest Net Income in the year 2015\nnew EdgarUniverse(2015, 10, Arrays.asList(\"NetIncomeLoss\"))\n<\/code><\/pre>\n<p>[:AAPL, :GOOG, :XOM, :MSFT, :ORCL, :CSCO, :UAL, :PG, :CZR, :PSX]<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest R&amp;D in the year 2017\nnew EdgarUniverse(2017, 10, Arrays.asList(\"ResearchAndDevelopmentExpense\"))\n<\/code><\/pre>\n<p>[:GOOG, :MSFT, :AAPL, :CSCO, :BMY, :ORCL, :FB, :PG, :VMW, :BXLT]<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest Net Income in the year 2015-2017\nnew EdgarUniverse(2017, Arrays.asList(0.5, 0.8, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true)\n<\/code><\/pre>\n<p>[:AAPL, :XOM, :MSFT, :ORCL, :PG, :CSCO, :GOOG, :PSX, :NKE, :FB]<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest Net Income Increases in the year 2014-2017\nvar u = new EdgarUniverse(2017, Arrays.asList(0.2, 0.5, 0.8, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true)\nu.setCalculatePercentChange(true)\nu\n<\/code><\/pre>\n<p>[:UFCS, :TTD, :NEFE, :LBMH, :GNBT, :SULT, :ZETAIII, :TORM, :PSPW, :GORO]<\/p>\n<pre><code class=\"Scala\">\/\/ top 10 companyies with the highest Net Income Increases in the year 2015-2017\nvar u = new EdgarUniverse(2017, Arrays.asList(0.5, 0.8, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true)\nu.setCalculatePercentChange(true)\nu\n<\/code><\/pre>\n<p>[:TTD, :NEFE, :LBMH, :GNBT, :SULT, :ZETAIII, :TORM, :GORO, :ANTB, :FSYS]<\/p>\n<h3>Stock Readers<\/h3>\n<p>Since the edgar filings only contain the ticker symbol w\/o the information of the related exchange, we need to use one of the StockReaders which can cope with this:<br \/>\n&#8211; YahooReader<br \/>\n&#8211; QuandlWIKIReader<br \/>\n&#8211; AlphaVantageReader<br \/>\n&#8211; IEXReader<\/p>\n<pre><code class=\"Scala\">var reader = new YahooReader()\n\n<\/code><\/pre>\n<p>ch.pschatzmann.stocks.input.YahooReader@32f670bd<\/p>\n<h3>Selection of the Stocks with the Highest Profits<\/h3>\n<p>For the past n years we determine the top n stocks of the previos year and we execute the evaluation of the selected stock with the best strategies. The portfiolio of selected stocks is updated every year.<\/p>\n<p>We determine the Universe and the trading strategy selection for the prior year and then execute the strategy for the current period.<\/p>\n<p>If a stock has been deselected (from the latest universe) the system waits for the next sell signal to liquidate the stock.<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new EdgarUniverse(year, 10)\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 110935.92901799994, Absolute Return Avarage per day 73.46750266092711, Absolute Return StdDev 1272.9836060189323, Return % 110.93592901799994, Return % per year 18.501557983147574, Return % StdDev 0.007667029354465832, Sharp Ratio 1.0845780729422094, Max Draw Down % 13.407077915993506, Max Draw Down Absolute 26276.164564999985, Max Draw Down &#8211; Number of days 67, Max Draw Down &#8211; High 195987.25933899995, Max Draw Down &#8211; Low 169711.09477399997, Max Draw Down &#8211; Period 20150720-20150825, Number of Trades 660, Number of Buys 294, Number of Sells 357, Number of Cash Transfers 1, Number of Traded Stocks 14, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<\/p>\n<h3>Immediate Liquidation<\/h3>\n<p>With executor.setImmediateLiquidationOfDiscontinuedStocks(true) we can make sure that the stock is liquidated at the beginning of the period. Per default this setting is set to false.<\/p>\n<p>In our example however this does not make any difference.<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\nexecutor.setImmediateLiquidationOfDiscontinuedStocks(true)\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new EdgarUniverse(year, 10)\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 110935.92901799994, Absolute Return Avarage per day 73.46750266092711, Absolute Return StdDev 1272.9836060189323, Return % 110.93592901799994, Return % per year 18.501557983147574, Return % StdDev 0.007667029354465832, Sharp Ratio 1.0845780729422094, Max Draw Down % 13.407077915993506, Max Draw Down Absolute 26276.164564999985, Max Draw Down &#8211; Number of days 67, Max Draw Down &#8211; High 195987.25933899995, Max Draw Down &#8211; Low 169711.09477399997, Max Draw Down &#8211; Period 20150720-20150825, Number of Trades 660, Number of Buys 294, Number of Sells 357, Number of Cash Transfers 1, Number of Traded Stocks 14, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<\/p>\n<h3>The Highest NetIncomeLoss for the last 4 years<\/h3>\n<p>In the examples above we did the selection of stocks from edgar based on one year. In the following example we use 4<br \/>\nyears with decreasing weights into the past.<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new EdgarUniverse(year, Arrays.asList(0.1, 0.3, 0.5, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true)\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 91674.36287099996, Absolute Return Avarage per day 60.7114985900662, Absolute Return StdDev 1125.80725621386, Return % 91.67436287099996, Return % per year 15.28917236498477, Return % StdDev 0.007289437564493472, Sharp Ratio 0.9964474472955415, Max Draw Down % 12.528013739524901, Max Draw Down Absolute 22594.888259, Max Draw Down &#8211; Number of days 69, Max Draw Down &#8211; High 180354.912828, Max Draw Down &#8211; Low 157760.024569, Max Draw Down &#8211; Period 20150716-20150825, Number of Trades 279, Number of Buys 100, Number of Sells 149, Number of Cash Transfers 1, Number of Traded Stocks 13, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<\/p>\n<h3>The Highest NetIncomeLoss % Changes for the last 4 years<\/h3>\n<p>In the previos examples we used the absolte parameter values to select the stock. In the following example we use<br \/>\nthe calculated percent increase to do the selection:<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new EdgarUniverse(year, Arrays.asList(0.2, 0.5, 0.8, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true)\n\/\/ calculate percentages\nportfolioUniverse.setCalculatePercentChange(true)\n\/\/ select only entries for which we have rates\nportfolioUniverse.setReader(reader)\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 7.534670300056998E7, Absolute Return Avarage per day 49898.47880832449, Absolute Return StdDev 750806.5447598386, Return % 75346.70300056998, Return % per year 12566.094742649659, Return % StdDev 0.8961801040280745, Sharp Ratio 0.4572988021119511, Max Draw Down % 57.63149010342141, Max Draw Down Absolute 396677.9932570002, Max Draw Down &#8211; Number of days 211, Max Draw Down &#8211; High 688300.7754010002, Max Draw Down &#8211; Low 291622.78214399994, Max Draw Down &#8211; Period 20140303-20141218, Number of Trades 2071, Number of Buys 992, Number of Sells 1005, Number of Cash Transfers 1, Number of Traded Stocks 9, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<code><\/code><\/p>\n<h3>The top R &amp; D for the last 4 years<\/h3>\n<p>We assume that companies with higher R&amp;D will be more prifitable in the futrue. Thefore we run a selection based on the<br \/>\nResearchAndDevelopmentExpense parameter.<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new EdgarUniverse(year, Arrays.asList(0.2, 0.5, 0.8, 1.0), 10, Arrays.asList(\"ResearchAndDevelopmentExpense\"), true)\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 132432.49043699994, Absolute Return Avarage per day 87.70363605099334, Absolute Return StdDev 1418.0295992067922, Return % 132.43249043699993, Return % per year 22.086689338268684, Return % StdDev 0.009047709205959679, Sharp Ratio 1.0521000706609243, Max Draw Down % 17.4923968403975, Max Draw Down Absolute 31283.021613999997, Max Draw Down &#8211; Number of days 264, Max Draw Down &#8211; High 178837.82250899996, Max Draw Down &#8211; Low 147554.80089499996, Max Draw Down &#8211; Period 20150302-20160120, Number of Trades 492, Number of Buys 183, Number of Sells 273, Number of Cash Transfers 1, Number of Traded Stocks 14, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<\/p>\n<h3>Combining Multiple Edgar Universes<\/h3>\n<p>Finally we verfiy the result if we combine multiple Edgar universe queries.<\/p>\n<pre><code class=\"Scala\">var periods = Context.getDateRanges(\"2011-01-01\",\"2012-01-01\",\"2013-01-01\",\"2014-01-01\",\"2015-01-01\",\"2016-01-01\",\"2017-01-01\");\nvar account = new Account(\"Simulation\", \"USD\", 100000.00, periods.get(0).getStart(), new PerTradeFees(6.95))\nvar strategies = TradingStrategyFactory.list()\nvar trader = new PaperTrader(account);\nvar allocationStrategy = new DistributedAllocationStrategy(trader);\nvar executor = new StrategyExecutor(trader, allocationStrategy);\n\nfor (i &lt;- 1 to 5) {\nvar year = Context.getYear(periods.get(i-1).getStart());\nvar portfolioUniverse = new ListUniverse()\nportfolioUniverse.add(new EdgarUniverse(year, Arrays.asList(0.2, 0.5, 0.8, 1.0), 10, Arrays.asList(\"ResearchAndDevelopmentExpense\"), true));\nportfolioUniverse.add(new EdgarUniverse(year, Arrays.asList(0.1, 0.3, 0.5, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true));\nvar percentUniverse = new EdgarUniverse(year, Arrays.asList(0.2, 0.5, 0.8, 1.0), 10, Arrays.asList(\"NetIncomeLoss\"), true);\npercentUniverse.setCalculatePercentChange(true)\npercentUniverse.setReader(reader)\nportfolioUniverse.add(percentUniverse)\n\nvar strategySelector = new StrategySelector(account, strategies, periods.get(i-1), KPI.AbsoluteReturn)\nvar stockSelector = new StockSelector(strategySelector)\nvar result = stockSelector.getSelection(10, portfolioUniverse, reader)\nexecutor.setStrategies(result.getStrategies(reader));\nexecutor.run(periods.get(i));\n}\naccount.setCloseDate(periods.get(5).getEnd())\naccount.getKPIValues()\n<\/code><\/pre>\n<p>[Absolute Return 2590477.323824001, Absolute Return Avarage per day 1715.5478965721861, Absolute Return StdDev 54115.573000169396, Return % 2590.4773238240014, Return % per year 432.0319560580068, Return % StdDev 0.35988216033679105, Sharp Ratio 0.4283444360447413, Max Draw Down % 28.32373779736678, Max Draw Down Absolute 621152.2363629988, Max Draw Down &#8211; Number of days 338, Max Draw Down &#8211; High 2193044.720322, Max Draw Down &#8211; Low 1571892.483959001, Max Draw Down &#8211; Period 20150323-20160120, Number of Trades 1165, Number of Buys 470, Number of Sells 624, Number of Cash Transfers 1, Number of Traded Stocks 20, Total Fees 0.0, Cash 100000.0, Total Value (at actual rates) including cash 100000.0, Total Value (at purchased rates) 100000.0, Realized Gains 0.0, Unrealized Gains 0.0]<\/p>\n<h3>Evaluation by Stock<\/h3>\n<p>Finally we check the contribution of each stock to the final result<\/p>\n<pre><code class=\"Scala\">account.getStockIDs()\n<\/code><\/pre>\n<p>[:ALV, :AMD, :BMY, :CCL, :CSCO, :GOOG, :GORO, :LEXG, :MXIM, :NAV, :NKE, :ORCL, :PEG, :PG, :PSX, :TORM, :UAL, :UFCS, :VMW, :XOM]<\/p>\n<pre><code class=\"Scala\">Displayers.display(account.getKPIValueByStockID(KPI.AbsoluteReturn))\n<\/code><\/pre>\n<table >\n<tr>\n<th>Key<\/th>\n<th>Value<\/th>\n<\/tr>\n<tr>\n<td>:ALV<\/td>\n<td>43917.4517<\/td>\n<\/tr>\n<tr>\n<td>:AMD<\/td>\n<td>374607.4<\/td>\n<\/tr>\n<tr>\n<td>:BMY<\/td>\n<td>26007.5749<\/td>\n<\/tr>\n<tr>\n<td>:CCL<\/td>\n<td>77770.5171<\/td>\n<\/tr>\n<tr>\n<td>:CSCO<\/td>\n<td>106319.9304<\/td>\n<\/tr>\n<tr>\n<td>:GOOG<\/td>\n<td>90385.743<\/td>\n<\/tr>\n<tr>\n<td>:GORO<\/td>\n<td>78422.4839<\/td>\n<\/tr>\n<tr>\n<td>:LEXG<\/td>\n<td>1887803.4234<\/td>\n<\/tr>\n<tr>\n<td>:MXIM<\/td>\n<td>111056.0838<\/td>\n<\/tr>\n<tr>\n<td>:NAV<\/td>\n<td>136403.905<\/td>\n<\/tr>\n<tr>\n<td>:NKE<\/td>\n<td>109642.6169<\/td>\n<\/tr>\n<tr>\n<td>:ORCL<\/td>\n<td>31564.3644<\/td>\n<\/tr>\n<tr>\n<td>:PEG<\/td>\n<td>62550.7346<\/td>\n<\/tr>\n<tr>\n<td>:PG<\/td>\n<td>8749.6637<\/td>\n<\/tr>\n<tr>\n<td>:PSX<\/td>\n<td>79538.8133<\/td>\n<\/tr>\n<tr>\n<td>:TORM<\/td>\n<td>9331.71<\/td>\n<\/tr>\n<tr>\n<td>:UAL<\/td>\n<td>44121.4117<\/td>\n<\/tr>\n<tr>\n<td>:UFCS<\/td>\n<td>88431.39<\/td>\n<\/tr>\n<tr>\n<td>:VMW<\/td>\n<td>172154.7032<\/td>\n<\/tr>\n<tr>\n<td>:XOM<\/td>\n<td>-5573.9024<\/td>\n<\/tr>\n<\/table>\n<p>^<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this document we demonstrate how to use the Edgar Database for the selection of the stocks into a portfilio with the help of the Investor library. This functionality is using the Edgar Webservice which is based on the data which is available on https:\/\/www.sec.gov\/edgar.shtml. Setup We add the necessary [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":495,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[12,13],"tags":[],"class_list":["post-490","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-edgar","category-quantitative-trading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Investor and Edgar - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Investor and Edgar - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"In this document we demonstrate how to use the Edgar Database for the selection of the stocks into a portfilio with the help of the Investor library. This functionality is using the Edgar Webservice which is based on the data which is available on https:\/\/www.sec.gov\/edgar.shtml. Setup We add the necessary [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-02T07:17:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-21T21:22:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"162\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Investor and Edgar\",\"datePublished\":\"2018-09-02T07:17:45+00:00\",\"dateModified\":\"2020-11-21T21:22:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/\"},\"wordCount\":1166,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/edgardat.jpg\",\"articleSection\":[\"EDGAR\",\"Quantitative Trading\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/\",\"name\":\"Investor and Edgar - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/edgardat.jpg\",\"datePublished\":\"2018-09-02T07:17:45+00:00\",\"dateModified\":\"2020-11-21T21:22:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/edgardat.jpg\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/edgardat.jpg\",\"width\":400,\"height\":162},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/02\\\/investor-with-edgar\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Investor and Edgar\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Investor and Edgar - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/","og_locale":"en_US","og_type":"article","og_title":"Investor and Edgar - Phil Schatzmann","og_description":"In this document we demonstrate how to use the Edgar Database for the selection of the stocks into a portfilio with the help of the Investor library. This functionality is using the Edgar Webservice which is based on the data which is available on https:\/\/www.sec.gov\/edgar.shtml. Setup We add the necessary [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/","og_site_name":"Phil Schatzmann","article_published_time":"2018-09-02T07:17:45+00:00","article_modified_time":"2020-11-21T21:22:52+00:00","og_image":[{"width":400,"height":162,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg","type":"image\/jpeg"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Investor and Edgar","datePublished":"2018-09-02T07:17:45+00:00","dateModified":"2020-11-21T21:22:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/"},"wordCount":1166,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg","articleSection":["EDGAR","Quantitative Trading"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/","url":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/","name":"Investor and Edgar - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg","datePublished":"2018-09-02T07:17:45+00:00","dateModified":"2020-11-21T21:22:52+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/edgardat.jpg","width":400,"height":162},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/02\/investor-with-edgar\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Investor and Edgar"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=490"}],"version-history":[{"count":1,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/490\/revisions"}],"predecessor-version":[{"id":2225,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/490\/revisions\/2225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/495"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}