@@ -5,12 +5,8 @@ |
||
5 | 5 | use App\InteractionMethodsMOD\GetMethods; |
6 | 6 | use Carbon\Carbon; |
7 | 7 | use DB; |
8 | -use Illuminate\Http\Request; |
|
9 | - |
|
10 | 8 | use GuzzleHttp\Client; |
11 | 9 | |
12 | -use App\Http\Requests; |
|
13 | - |
|
14 | 10 | /** |
15 | 11 | * Class ExchangeHistoryTableFeeder |
16 | 12 | * @package App\Http\Controllers |
@@ -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 | ] |
@@ -21,13 +21,13 @@ |
||
21 | 21 | return $response; |
22 | 22 | } |
23 | 23 | |
24 | - public function interactiveChart (Client $client, $company_symbol) |
|
24 | + public function interactiveChart(Client $client, $company_symbol) |
|
25 | 25 | { |
26 | - $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"; |
|
26 | + $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"; |
|
27 | 27 | |
28 | 28 | $response = $client->get("http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=".$request_params); |
29 | 29 | |
30 | - $response =json_decode($response->getBody()); |
|
30 | + $response = json_decode($response->getBody()); |
|
31 | 31 | |
32 | 32 | return $response; |
33 | 33 | } |