Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function volumeCompareHandler($connectionLink)
- {
- $socket = new Socket();
- $socket->initSocketConnection($connectionLink);
- $savedPairs = CompareModel::getAllSavedPairsWithDuplicates(CompareModel::VOLUME_MODE);
- $botman_id = Botman::where(['option_name' => 'VOLUME_BOT_TOKEN', 'is_active' => true])->select('id')->first()->id;
- $follows = BotUsers::where(['is_active' => true, 'botman_id' => $botman_id])->get();
- $followsLength = count($follows);
- $followsReIndexed = array();
- for($i = 0; $i < $followsLength; $i++)
- {
- $followsReIndexed[$follows[$i]->profile_id.$follows[$i]->botman_id][] = $follows[$i];
- }
- Log::write('critical', 'Volume bot follows', $followsReIndexed);
- while(true)
- {
- $responseObjFromBinance = $socket->getSocketResponse($connectionLink);
- if(!empty($responseObjFromBinance['error']))
- {
- continue;
- }
- // $cacheId = $responseObjFromBinance['symbol'] . '_' . array_search($responseObjFromBinance['timeFrame'], CompareModel::TIMEFRAME_TRANSFORMATIVE_ARR);
- // self::putPairArrToCache($cacheId, $responseObjFromBinance);
- $unique_field = $responseObjFromBinance['symbol'] . array_search($responseObjFromBinance['timeFrame'], CompareModel::TIMEFRAME_TRANSFORMATIVE_ARR) .
- 0 . $responseObjFromBinance['klineStartTime'];
- if(!Redis::exists($unique_field))
- {
- $job = new VolumeCompareJob($responseObjFromBinance, $savedPairs, $this, $followsReIndexed);
- dispatch($job);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement