@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct(Client $client) |
24 | 24 | { |
25 | - $this->client=$client; |
|
25 | + $this->client = $client; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=".$to_search); |
35 | 35 | |
36 | - $response =json_decode($response->getBody()); |
|
36 | + $response = json_decode($response->getBody()); |
|
37 | 37 | |
38 | 38 | return $response; |
39 | 39 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=".$company_symbol); |
48 | 48 | |
49 | - $response =json_decode($response->getBody()); |
|
49 | + $response = json_decode($response->getBody()); |
|
50 | 50 | |
51 | 51 | return $response; |
52 | 52 | } |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | * @param $company_symbol |
56 | 56 | * @return mixed|\Psr\Http\Message\ResponseInterface |
57 | 57 | */ |
58 | - public function interactiveChart ($company_symbol) |
|
58 | + public function interactiveChart($company_symbol) |
|
59 | 59 | { |
60 | - $request_params="%7B%22Normalized%22%3Afalse%2C%22NumberOfDays%22%3A730%2C%22DataPeriod%22%3A%22Month%22%2C%22Elements%22%3A%5B%7B%22Symbol%22%3A%22".$company_symbol."%22%2C%22Type%22%3A%22price%22%2C%22Params%22%3A%5B%22c%22%5D%7D%5D%7D"; |
|
60 | + $request_params = "%7B%22Normalized%22%3Afalse%2C%22NumberOfDays%22%3A730%2C%22DataPeriod%22%3A%22Month%22%2C%22Elements%22%3A%5B%7B%22Symbol%22%3A%22".$company_symbol."%22%2C%22Type%22%3A%22price%22%2C%22Params%22%3A%5B%22c%22%5D%7D%5D%7D"; |
|
61 | 61 | |
62 | 62 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=".$request_params); |
63 | 63 | |
64 | - $response =json_decode($response->getBody()); |
|
64 | + $response = json_decode($response->getBody()); |
|
65 | 65 | |
66 | 66 | return $response; |
67 | 67 | } |
@@ -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","GOOGL","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","GOOGL","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 | } |
@@ -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 | } |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * @param HttpCalls $http_calls |
51 | 51 | * @param ProgressControl $progress_control |
52 | 52 | */ |
53 | - public function __construct(DataBaseFunctions $db_functions,HttpCalls $http_calls,ProgressControl $progress_control) |
|
53 | + public function __construct(DataBaseFunctions $db_functions, HttpCalls $http_calls, ProgressControl $progress_control) |
|
54 | 54 | { |
55 | 55 | parent::__construct(); |
56 | 56 | |
57 | - $this->db_functions=$db_functions; |
|
58 | - $this->http_calls=$http_calls; |
|
59 | - $this->progress_control=$progress_control; |
|
57 | + $this->db_functions = $db_functions; |
|
58 | + $this->http_calls = $http_calls; |
|
59 | + $this->progress_control = $progress_control; |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function handle() |
69 | 69 | { |
70 | - $table='company_follow'; |
|
70 | + $table = 'company_follow'; |
|
71 | 71 | |
72 | - $symbols=$this->db_functions->truncateBDValuesAndGetNew($table); |
|
72 | + $symbols = $this->db_functions->truncateBDValuesAndGetNew($table); |
|
73 | 73 | |
74 | - for($i=0; $i<count($symbols); $i++){ |
|
75 | - try{ |
|
74 | + for ($i = 0; $i < count($symbols); $i++) { |
|
75 | + try { |
|
76 | 76 | |
77 | - $symbol=$symbols[$i]->symbol; |
|
78 | - $data=$this->http_calls->getTableFollow($symbol); |
|
79 | - $this->db_functions->storeCompanyFollowTable($data,$table); |
|
77 | + $symbol = $symbols[ $i ]->symbol; |
|
78 | + $data = $this->http_calls->getTableFollow($symbol); |
|
79 | + $this->db_functions->storeCompanyFollowTable($data, $table); |
|
80 | 80 | $this->progress_control->progressControl($i); |
81 | 81 | |
82 | - }catch(Exception $e){ |
|
82 | + } catch (Exception $e) { |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -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 |