@@ -54,7 +54,7 @@ |
||
| 54 | 54 | { |
| 55 | 55 | $router->group([ |
| 56 | 56 | 'namespace' => $this->namespace, 'middleware' => 'web', |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require app_path('Http/routes.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::get('/', function () { |
|
| 14 | +Route::get('/', function() { |
|
| 15 | 15 | return view('welcome'); |
| 16 | 16 | }); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct() |
| 39 | 39 | { |
| 40 | - $this->middleware($this->guestMiddleware(), ['except' => 'logout']); |
|
| 40 | + $this->middleware($this->guestMiddleware(), [ 'except' => 'logout' ]); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | protected function create(array $data) |
| 65 | 65 | { |
| 66 | 66 | return User::create([ |
| 67 | - 'name' => $data['name'], |
|
| 68 | - 'email' => $data['email'], |
|
| 69 | - 'password' => bcrypt($data['password']), |
|
| 67 | + 'name' => $data[ 'name' ], |
|
| 68 | + 'email' => $data[ 'email' ], |
|
| 69 | + 'password' => bcrypt($data[ 'password' ]), |
|
| 70 | 70 | ]); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $response = $client->get("http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=".$to_search); |
| 13 | 13 | |
| 14 | - $response =json_decode($response->getBody()); |
|
| 14 | + $response = json_decode($response->getBody()); |
|
| 15 | 15 | |
| 16 | 16 | return $response; |
| 17 | 17 | } |
@@ -20,18 +20,18 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $response = $client->get("http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=".$company_symbol); |
| 22 | 22 | |
| 23 | - $response =json_decode($response->getBody()); |
|
| 23 | + $response = json_decode($response->getBody()); |
|
| 24 | 24 | |
| 25 | 25 | return $response; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function interactiveChart (Client $client, $company_symbol) |
|
| 28 | + public function interactiveChart(Client $client, $company_symbol) |
|
| 29 | 29 | { |
| 30 | - $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"; |
|
| 30 | + $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"; |
|
| 31 | 31 | |
| 32 | 32 | $response = $client->get("http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=".$request_params); |
| 33 | 33 | |
| 34 | - $response =json_decode($response->getBody()); |
|
| 34 | + $response = json_decode($response->getBody()); |
|
| 35 | 35 | |
| 36 | 36 | return $response; |
| 37 | 37 | } |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $symbols = DB::table('companies')->select('symbol')->get(); |
| 29 | 29 | |
| 30 | - for($i=0; $i<count($symbols); $i++) |
|
| 30 | + for ($i = 0; $i < count($symbols); $i++) |
|
| 31 | 31 | { |
| 32 | - $symbol=$symbols[$i]->symbol; |
|
| 32 | + $symbol = $symbols[ $i ]->symbol; |
|
| 33 | 33 | $gm = new GetMethods(); |
| 34 | - $this->httpCall($gm,$symbol); |
|
| 34 | + $this->httpCall($gm, $symbol); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function httpCall(GetMethods $interaction_methods, $symbol) |
| 47 | 47 | { |
| 48 | - $glz_cli=new Client(); |
|
| 48 | + $glz_cli = new Client(); |
|
| 49 | 49 | |
| 50 | - $data = $interaction_methods->interactiveChart($glz_cli,$symbol); |
|
| 50 | + $data = $interaction_methods->interactiveChart($glz_cli, $symbol); |
|
| 51 | 51 | |
| 52 | 52 | $this->storeDataInDB($data); |
| 53 | 53 | } |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | DB::table('exchange_history')->insert([ |
| 64 | 64 | [ |
| 65 | - 'symbol' => $data->Elements[0]->Symbol, |
|
| 65 | + 'symbol' => $data->Elements[ 0 ]->Symbol, |
|
| 66 | 66 | 'positions' => json_encode($data->Positions), |
| 67 | 67 | 'dates' => json_encode($data->Dates), |
| 68 | - 'values' => json_encode($data->Elements[0]->DataSeries->close->values), |
|
| 69 | - 'max_date' => $data->Elements[0]->DataSeries->close->maxDate, |
|
| 70 | - 'min_date' => $data->Elements[0]->DataSeries->close->minDate, |
|
| 71 | - 'min_value' => $data->Elements[0]->DataSeries->close->min, |
|
| 72 | - 'max_value' => $data->Elements[0]->DataSeries->close->max, |
|
| 68 | + 'values' => json_encode($data->Elements[ 0 ]->DataSeries->close->values), |
|
| 69 | + 'max_date' => $data->Elements[ 0 ]->DataSeries->close->maxDate, |
|
| 70 | + 'min_date' => $data->Elements[ 0 ]->DataSeries->close->minDate, |
|
| 71 | + 'min_value' => $data->Elements[ 0 ]->DataSeries->close->min, |
|
| 72 | + 'max_value' => $data->Elements[ 0 ]->DataSeries->close->max, |
|
| 73 | 73 | 'created_at' => Carbon::now()->toDateTimeString(), |
| 74 | 74 | 'updated_at' => Carbon::now()->toDateTimeString() |
| 75 | 75 | ] |
@@ -33,9 +33,9 @@ |
||
| 33 | 33 | public function index() |
| 34 | 34 | { |
| 35 | 35 | $data_grid = $this->getCompaniesInfoFromDB(); |
| 36 | - $columns="['id', 'symbol', 'name', 'exchange']"; |
|
| 36 | + $columns = "['id', 'symbol', 'name', 'exchange']"; |
|
| 37 | 37 | |
| 38 | - return view('home', ['data_grid' => $data_grid, 'columns'=> $columns]); |
|
| 38 | + return view('home', [ 'data_grid' => $data_grid, 'columns'=> $columns ]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @param $to_store |
| 83 | - * @param $extension_file |
|
| 83 | + * @param string $extension_file |
|
| 84 | 84 | * @param $name_file |
| 85 | 85 | */ |
| 86 | 86 | public function createAndStore($to_store, $extension_file, $name_file) |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $exchange_history = $this->getDataFromBD(); |
| 46 | 46 | |
| 47 | - for($i=0; $i<count($exchange_history); $i++) |
|
| 47 | + for ($i = 0; $i < count($exchange_history); $i++) |
|
| 48 | 48 | { |
| 49 | - $company_history = $exchange_history[$i]; |
|
| 49 | + $company_history = $exchange_history[ $i ]; |
|
| 50 | 50 | |
| 51 | 51 | $this->transformData($company_history); |
| 52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $this->createAndStore($company_history, "json", $name_file); |
| 64 | 64 | |
| 65 | - $company_history=json_encode($company_history); |
|
| 65 | + $company_history = json_encode($company_history); |
|
| 66 | 66 | |
| 67 | 67 | $formatter = Formatter::make($company_history, Formatter::JSON); |
| 68 | 68 | |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | DB::table('companies')->truncate(); |
| 57 | 57 | |
| 58 | - $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"]}'; |
|
| 58 | + $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"]}'; |
|
| 59 | 59 | |
| 60 | 60 | $symbols_nasdq = json_decode($symbols_nasdq); |
| 61 | 61 | |
| 62 | 62 | $symbols_nasdq = $symbols_nasdq->SymbolsNASDAQ; |
| 63 | 63 | |
| 64 | - for($i=0; $i<count($symbols_nasdq); $i++) |
|
| 64 | + for ($i = 0; $i < count($symbols_nasdq); $i++) |
|
| 65 | 65 | { |
| 66 | - $symbol=$symbols_nasdq[$i]; |
|
| 66 | + $symbol = $symbols_nasdq[ $i ]; |
|
| 67 | 67 | $gm = new GetMethods(); |
| 68 | - $this->httpCall($gm,$symbol); |
|
| 68 | + $this->httpCall($gm, $symbol); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function httpCall(GetMethods $interaction_methods, $symbol) |
| 77 | 77 | { |
| 78 | - $glz_cli=new Client(); |
|
| 78 | + $glz_cli = new Client(); |
|
| 79 | 79 | |
| 80 | - $data = $interaction_methods->companyLookup($glz_cli,$symbol); |
|
| 80 | + $data = $interaction_methods->companyLookup($glz_cli, $symbol); |
|
| 81 | 81 | |
| 82 | - $this->discardRepeated($data,$symbol); |
|
| 82 | + $this->discardRepeated($data, $symbol); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function discardRepeated($data, $symbol) |
| 91 | 91 | { |
| 92 | - for($i=0;$i<count($data);$i++){ |
|
| 92 | + for ($i = 0; $i < count($data); $i++) { |
|
| 93 | 93 | |
| 94 | - $symbol_to_compare=(string) $data[$i]->Symbol; |
|
| 94 | + $symbol_to_compare = (string) $data[ $i ]->Symbol; |
|
| 95 | 95 | |
| 96 | - if($symbol_to_compare==$symbol){ |
|
| 96 | + if ($symbol_to_compare == $symbol) { |
|
| 97 | 97 | |
| 98 | - $node=$data[$i]; |
|
| 98 | + $node = $data[ $i ]; |
|
| 99 | 99 | |
| 100 | 100 | $this->storeDataInDB($node); |
| 101 | 101 | } |