| OLD | NEW |
| 1 <script> | 1 part of stocksapp; |
| 2 import "dart:math"; | |
| 3 | 2 |
| 4 // Snapshot from http://www.nasdaq.com/screening/company-list.aspx | 3 // Snapshot from http://www.nasdaq.com/screening/company-list.aspx |
| 5 // Fetched 2/23/2014. | 4 // Fetched 2/23/2014. |
| 6 // "Symbol","Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary
Quote", | 5 // "Symbol","Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary
Quote", |
| 7 final List<List<String>> _kCompanyList = [ | 6 final List<List<String>> _kCompanyList = [ |
| 8 ["TFSC","1347 Capital Corp.","9.43","\$56.09M","2014","Finance","Business Serv
ices","http://www.nasdaq.com/symbol/tfsc"], | 7 ["TFSC","1347 Capital Corp.","9.43","\$56.09M","2014","Finance","Business Serv
ices","http://www.nasdaq.com/symbol/tfsc"], |
| 9 ["TFSCR","1347 Capital Corp.","0.37","n/a","2014","Finance","Business Services
","http://www.nasdaq.com/symbol/tfscr"], | 8 ["TFSCR","1347 Capital Corp.","0.37","n/a","2014","Finance","Business Services
","http://www.nasdaq.com/symbol/tfscr"], |
| 10 ["TFSCU","1347 Capital Corp.","9.97","\$41.67M","2014","n/a","n/a","http://www
.nasdaq.com/symbol/tfscu"], | 9 ["TFSCU","1347 Capital Corp.","9.97","\$41.67M","2014","n/a","n/a","http://www
.nasdaq.com/symbol/tfscu"], |
| 11 ["TFSCW","1347 Capital Corp.","0.2","n/a","2014","Finance","Business Services"
,"http://www.nasdaq.com/symbol/tfscw"], | 10 ["TFSCW","1347 Capital Corp.","0.2","n/a","2014","Finance","Business Services"
,"http://www.nasdaq.com/symbol/tfscw"], |
| 12 ["PIH","1347 Property Insurance Holdings, Inc.","7.66","\$48.7M","2014","Finan
ce","Property-Casualty Insurers","http://www.nasdaq.com/symbol/pih"], | 11 ["PIH","1347 Property Insurance Holdings, Inc.","7.66","\$48.7M","2014","Finan
ce","Property-Casualty Insurers","http://www.nasdaq.com/symbol/pih"], |
| (...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 } | 2993 } |
| 2995 } | 2994 } |
| 2996 | 2995 |
| 2997 class StockOracle { | 2996 class StockOracle { |
| 2998 List<Stock> stocks; | 2997 List<Stock> stocks; |
| 2999 | 2998 |
| 3000 StockOracle(this.stocks); | 2999 StockOracle(this.stocks); |
| 3001 | 3000 |
| 3002 StockOracle.fromCompanyList(List<List<String>> list) { | 3001 StockOracle.fromCompanyList(List<List<String>> list) { |
| 3003 stocks = list.map((fields) => new Stock.fromFields(fields)).toList(); | 3002 stocks = list.map((fields) => new Stock.fromFields(fields)).toList(); |
| 3003 stocks.sort((a, b) => a.symbol.compareTo(b.symbol)); |
| 3004 } | 3004 } |
| 3005 | 3005 |
| 3006 Stock lookupBySymbol(String symbol) { | 3006 Stock lookupBySymbol(String symbol) { |
| 3007 this.stocks.forEach((stock) { | 3007 this.stocks.forEach((stock) { |
| 3008 if (stock.symbol == symbol) | 3008 if (stock.symbol == symbol) |
| 3009 return stock; | 3009 return stock; |
| 3010 }); | 3010 }); |
| 3011 return null; | 3011 return null; |
| 3012 } | 3012 } |
| 3013 } | 3013 } |
| 3014 | 3014 |
| 3015 final StockOracle oracle = new StockOracle.fromCompanyList(_kCompanyList); | 3015 final StockOracle oracle = new StockOracle.fromCompanyList(_kCompanyList); |
| 3016 | |
| 3017 </script> | |
| OLD | NEW |