@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function progressControl($i) |
23 | 23 | { |
24 | - switch($i){ |
|
24 | + switch ($i) { |
|
25 | 25 | case 0: |
26 | 26 | echo "0%\n"; |
27 | 27 | break; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct(GetMethods $get_methods) |
29 | 29 | { |
30 | - $this->get_methods=$get_methods; |
|
30 | + $this->get_methods = $get_methods; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getTableFollow($symbol) |
38 | 38 | { |
39 | - $data=$this->get_methods->stockQuote($symbol); |
|
39 | + $data = $this->get_methods->stockQuote($symbol); |
|
40 | 40 | |
41 | 41 | sleep(4); |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function getExchangeHistory($symbol) |
47 | 47 | { |
48 | - $data=$this->get_methods->interactiveChart($symbol); |
|
48 | + $data = $this->get_methods->interactiveChart($symbol); |
|
49 | 49 | |
50 | 50 | sleep(4); |
51 | 51 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | public function getCompanies($symbol) |
56 | 56 | { |
57 | - $data=$this->get_methods->companyLookup($symbol); |
|
57 | + $data = $this->get_methods->companyLookup($symbol); |
|
58 | 58 | |
59 | - $data=$this->discardRepeated($data,$symbol); |
|
59 | + $data = $this->discardRepeated($data, $symbol); |
|
60 | 60 | |
61 | 61 | sleep(4); |
62 | 62 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private function discardRepeated($data, $symbol) |
73 | 73 | { |
74 | - for($i=0;$i<count($data);$i++){ |
|
74 | + for ($i = 0; $i < count($data); $i++) { |
|
75 | 75 | |
76 | - $symbol_to_compare=(string) $data[$i]->Symbol; |
|
76 | + $symbol_to_compare = (string) $data[ $i ]->Symbol; |
|
77 | 77 | |
78 | - if($symbol_to_compare==$symbol){ |
|
79 | - return $node=$data[$i]; |
|
78 | + if ($symbol_to_compare == $symbol) { |
|
79 | + return $node = $data[ $i ]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
@@ -60,14 +60,14 @@ |
||
60 | 60 | { |
61 | 61 | DB::table($table)->insert([ |
62 | 62 | [ |
63 | - 'symbol' => $data->Elements[0]->Symbol, |
|
63 | + 'symbol' => $data->Elements[ 0 ]->Symbol, |
|
64 | 64 | 'positions' => json_encode($data->Positions), |
65 | 65 | 'dates' => json_encode($data->Dates), |
66 | - 'values' => json_encode($data->Elements[0]->DataSeries->close->values), |
|
67 | - 'max_date' => $data->Elements[0]->DataSeries->close->maxDate, |
|
68 | - 'min_date' => $data->Elements[0]->DataSeries->close->minDate, |
|
69 | - 'min_value' => $data->Elements[0]->DataSeries->close->min, |
|
70 | - 'max_value' => $data->Elements[0]->DataSeries->close->max, |
|
66 | + 'values' => json_encode($data->Elements[ 0 ]->DataSeries->close->values), |
|
67 | + 'max_date' => $data->Elements[ 0 ]->DataSeries->close->maxDate, |
|
68 | + 'min_date' => $data->Elements[ 0 ]->DataSeries->close->minDate, |
|
69 | + 'min_value' => $data->Elements[ 0 ]->DataSeries->close->min, |
|
70 | + 'max_value' => $data->Elements[ 0 ]->DataSeries->close->max, |
|
71 | 71 | 'created_at' => Carbon::now()->toDateTimeString(), |
72 | 72 | 'updated_at' => Carbon::now()->toDateTimeString() |
73 | 73 | ] |
@@ -22,9 +22,9 @@ |
||
22 | 22 | { |
23 | 23 | $data_grid = $this->getCompanyFollowFromDB(); |
24 | 24 | |
25 | - $columns="['id', 'symbol', 'name', 'lastPrice', 'change', 'volume', 'open']"; |
|
25 | + $columns = "['id', 'symbol', 'name', 'lastPrice', 'change', 'volume', 'open']"; |
|
26 | 26 | |
27 | - return view('live_info', ['data_grid' => $data_grid, 'columns'=> $columns]); |
|
27 | + return view('live_info', [ 'data_grid' => $data_grid, 'columns'=> $columns ]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -83,7 +83,7 @@ |
||
83 | 83 | $this->db_functions->storeExchangeHistory($data,$table); |
84 | 84 | $this->progress_control->progressControl($i); |
85 | 85 | |
86 | - }catch(Exception $e){ |
|
86 | + } catch(Exception $e){ |
|
87 | 87 | |
88 | 88 | } |
89 | 89 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param HttpCalls $http_calls |
53 | 53 | * @param ProgressControl $progress_control |
54 | 54 | */ |
55 | - public function __construct(DataBaseFunctions $db_functions,HttpCalls $http_calls,ProgressControl $progress_control) |
|
55 | + public function __construct(DataBaseFunctions $db_functions, HttpCalls $http_calls, ProgressControl $progress_control) |
|
56 | 56 | { |
57 | 57 | parent::__construct(); |
58 | 58 | |
59 | - $this->db_functions=$db_functions; |
|
60 | - $this->http_calls=$http_calls; |
|
61 | - $this->progress_control=$progress_control; |
|
59 | + $this->db_functions = $db_functions; |
|
60 | + $this->http_calls = $http_calls; |
|
61 | + $this->progress_control = $progress_control; |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -69,24 +69,24 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function handle() |
71 | 71 | { |
72 | - $table='companies'; |
|
72 | + $table = 'companies'; |
|
73 | 73 | |
74 | 74 | DB::table($table)->truncate(); |
75 | 75 | |
76 | - $symbols_nasdq= '{"SymbolsNASDAQ":["AAL","AAPL","ADBE","ADI","ADP","ADSK","AKAM","ALXN","AMAT","AMGN","AMZN","ATVI","BBBY","BIDU","BIIB","BMRN","CA","CELG","CERN","CHKP","CHTR","CMCSA","COST","CSCO","CSX","CTRP","CTSH","CTXS","DISCA","DISCK","DISH","DLTR","EA","EBAY","ENDP","ESRX","EXPE","FAST","FB","FISV","FOX","FOXA","GILD","GOOG","HSIC","INCY","INTC","INTU","ILMN","ISRG","JD","KHC","LBTYA","LBTYK","LLTC","LMCA","LRCX","LVNTA","MAR","MAT","MDLZ","MNST","MSFT","MU","MXIM","MYL","NCLH","NFLX","NTAP","NVDA","NXPI","ORLY","PAYX","PCAR","PCLN","PYPL","QCOM","QVCA","REGN","ROST","SBAC","SBUX","SIRI","SNDK","SRCL","STX","SWKS","SYMC","TMUS","TSCO","TSLA","TRIP","TXN","ULTA","VIAB","VOD","VRSK","VRTX","WBA","WDC","WFM","XLNX","YHOO"]}'; |
|
76 | + $symbols_nasdq = '{"SymbolsNASDAQ":["AAL","AAPL","ADBE","ADI","ADP","ADSK","AKAM","ALXN","AMAT","AMGN","AMZN","ATVI","BBBY","BIDU","BIIB","BMRN","CA","CELG","CERN","CHKP","CHTR","CMCSA","COST","CSCO","CSX","CTRP","CTSH","CTXS","DISCA","DISCK","DISH","DLTR","EA","EBAY","ENDP","ESRX","EXPE","FAST","FB","FISV","FOX","FOXA","GILD","GOOG","HSIC","INCY","INTC","INTU","ILMN","ISRG","JD","KHC","LBTYA","LBTYK","LLTC","LMCA","LRCX","LVNTA","MAR","MAT","MDLZ","MNST","MSFT","MU","MXIM","MYL","NCLH","NFLX","NTAP","NVDA","NXPI","ORLY","PAYX","PCAR","PCLN","PYPL","QCOM","QVCA","REGN","ROST","SBAC","SBUX","SIRI","SNDK","SRCL","STX","SWKS","SYMC","TMUS","TSCO","TSLA","TRIP","TXN","ULTA","VIAB","VOD","VRSK","VRTX","WBA","WDC","WFM","XLNX","YHOO"]}'; |
|
77 | 77 | |
78 | 78 | $symbols_nasdq = json_decode($symbols_nasdq); |
79 | 79 | |
80 | 80 | $symbols = $symbols_nasdq->SymbolsNASDAQ; |
81 | 81 | |
82 | - for($i=0; $i<count($symbols); $i++){ |
|
83 | - try{ |
|
84 | - $symbol=$symbols[$i]; |
|
85 | - $data=$this->http_calls->getCompanies($symbol); |
|
82 | + for ($i = 0; $i < count($symbols); $i++) { |
|
83 | + try { |
|
84 | + $symbol = $symbols[ $i ]; |
|
85 | + $data = $this->http_calls->getCompanies($symbol); |
|
86 | 86 | $this->db_functions->storeCompanies($data); |
87 | 87 | $this->progress_control->progressControl($i); |
88 | 88 | |
89 | - }catch(Exception $e){ |
|
89 | + } catch (Exception $e) { |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | { |
31 | 31 | $data_grid = $this->getSimulatorHistory(); |
32 | 32 | |
33 | - $columns="['id', 'name', 'quantity_to_buy', 'quote_to_buy', 'price_to_buy', 'quantity_to_sell', 'quote_to_sell', 'tax_percent_to_discount', 'price_to_sell', 'gains_or_losses']"; |
|
33 | + $columns = "['id', 'name', 'quantity_to_buy', 'quote_to_buy', 'price_to_buy', 'quantity_to_sell', 'quote_to_sell', 'tax_percent_to_discount', 'price_to_sell', 'gains_or_losses']"; |
|
34 | 34 | |
35 | - return view('calculator_history', ['data_grid' => $data_grid, 'columns'=> $columns]); |
|
35 | + return view('calculator_history', [ 'data_grid' => $data_grid, 'columns'=> $columns ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $user = Auth::user(); |
44 | 44 | |
45 | - $data = DB::table('simulator_history')->where('user_id','=',$user->id)->get(); |
|
45 | + $data = DB::table('simulator_history')->where('user_id', '=', $user->id)->get(); |
|
46 | 46 | |
47 | 47 | $data = json_encode($data); |
48 | 48 |
@@ -4,8 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | |
7 | -use App\Http\Requests; |
|
8 | - |
|
9 | 7 | /** |
10 | 8 | * Class CalculatorController |
11 | 9 | * @package App\Http\Controllers |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | |
24 | 24 | public function getHistoryWithSymbol(Request $request) |
25 | 25 | { |
26 | - $symbol=$request->symbol_query; |
|
26 | + $symbol = $request->symbol_query; |
|
27 | 27 | |
28 | 28 | $query = DB::table('exchange_history') |
29 | - ->where('symbol','=',$symbol) |
|
29 | + ->where('symbol', '=', $symbol) |
|
30 | 30 | ->get(); |
31 | 31 | |
32 | 32 | return $query; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | public function getHistoryOnlyDatesAndValues(Request $request) |
36 | 36 | { |
37 | - $symbol=$request->symbol_query; |
|
37 | + $symbol = $request->symbol_query; |
|
38 | 38 | |
39 | 39 | $query = DB::table('exchange_history') |
40 | - ->select('symbol','dates','values') |
|
41 | - ->where('symbol','=',$symbol) |
|
40 | + ->select('symbol', 'dates', 'values') |
|
41 | + ->where('symbol', '=', $symbol) |
|
42 | 42 | ->get(); |
43 | 43 | |
44 | 44 | return $query; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -Route::group(['prefix' => 'api/'], function () { |
|
4 | +Route::group([ 'prefix' => 'api/' ], function() { |
|
5 | 5 | Route::post('calc/save', 'CalculatorApiController@store'); |
6 | 6 | Route::post('calc/getUserCalculs', 'CalculatorApiController@getUserCalculs'); |
7 | 7 | Route::post('history/getHistoryWithSymbol', 'HistoryApiController@getHistoryWithSymbol'); |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | public function index() |
35 | 35 | { |
36 | 36 | $data_grid = $this->getCompaniesInfoFromDB(); |
37 | - $columns="['id', 'symbol', 'name', 'exchange']"; |
|
37 | + $columns = "['id', 'symbol', 'name', 'exchange']"; |
|
38 | 38 | |
39 | - return view('home', ['data_grid' => $data_grid, 'columns'=> $columns]); |
|
39 | + return view('home', [ 'data_grid' => $data_grid, 'columns'=> $columns ]); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getCompaniesInfoFromDB() |
46 | 46 | { |
47 | 47 | $companies = Cache::rememberForever( |
48 | - 'companies', function(){ |
|
48 | + 'companies', function() { |
|
49 | 49 | return DB::table('companies')->get(); |
50 | 50 | }); |
51 | 51 | //$companies = DB::table('companies')->get(); |