Advertisement
Vaksel

Untitled

Jun 29th, 2021
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. public function volumeCompareHandler($connectionLink)
  2. {
  3.  
  4. $socket = new Socket();
  5.  
  6. $socket->initSocketConnection($connectionLink);
  7.  
  8. $savedPairs = CompareModel::getAllSavedPairsWithDuplicates(CompareModel::VOLUME_MODE);
  9.  
  10. $botman_id = Botman::where(['option_name' => 'VOLUME_BOT_TOKEN', 'is_active' => true])->select('id')->first()->id;
  11.  
  12. $follows = BotUsers::where(['is_active' => true, 'botman_id' => $botman_id])->get();
  13.  
  14. $followsLength = count($follows);
  15.  
  16. $followsReIndexed = array();
  17.  
  18. for($i = 0; $i < $followsLength; $i++)
  19. {
  20. $followsReIndexed[$follows[$i]->profile_id.$follows[$i]->botman_id][] = $follows[$i];
  21. }
  22.  
  23. Log::write('critical', 'Volume bot follows', $followsReIndexed);
  24.  
  25. while(true)
  26. {
  27. $responseObjFromBinance = $socket->getSocketResponse($connectionLink);
  28.  
  29. if(!empty($responseObjFromBinance['error']))
  30. {
  31. continue;
  32. }
  33.  
  34. // $cacheId = $responseObjFromBinance['symbol'] . '_' . array_search($responseObjFromBinance['timeFrame'], CompareModel::TIMEFRAME_TRANSFORMATIVE_ARR);
  35.  
  36. // self::putPairArrToCache($cacheId, $responseObjFromBinance);
  37.  
  38. $unique_field = $responseObjFromBinance['symbol'] . array_search($responseObjFromBinance['timeFrame'], CompareModel::TIMEFRAME_TRANSFORMATIVE_ARR) .
  39. 0 . $responseObjFromBinance['klineStartTime'];
  40.  
  41. if(!Redis::exists($unique_field))
  42. {
  43. $job = new VolumeCompareJob($responseObjFromBinance, $savedPairs, $this, $followsReIndexed);
  44. dispatch($job);
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement