bowhead icon indicating copy to clipboard operation
bowhead copied to clipboard

gdax scalper: array_pop() expects parameter 1 to be array, null given

Open laffinggas opened this issue 6 years ago • 2 comments

After booting bowhead and running the gdax scalper (sandbox api) it will run normally for some time and then the program will crash with the exception: array_pop() expects parameter 1 to be array, null given

Subsequently restarting the script causes it to instantly crash again w/ the same exception. The exception trace is:

() at /var/www/bowhead/app/Util/Indicators.php:360 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a array_pop() at /var/www/bowhead/app/Util/Indicators.php:360 Bowhead\Util\Indicators->stoch() at /var/www/bowhead/app/Traits/Strategies.php:160 Bowhead\Console\Commands\GdaxScalperCommand->bowhead_sar_stoch() at /var/www/bowhead/app/Console/Commands/GdaxScalperCommand.php:175 Bowhead\Console\Commands\GdaxScalperCommand->fire() at n/a:n/a call_user_func_array() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 Illuminate\Container\BoundMethod::Illuminate\Container{closure}() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 Illuminate\Container\BoundMethod::callBoundMethod() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 Illuminate\Container\BoundMethod::call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Container/Container.php:539 Illuminate\Container\Container->call() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:182 Illuminate\Console\Command->execute() at /var/www/bowhead/vendor/symfony/console/Command/Command.php:240 Symfony\Component\Console\Command\Command->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Console/Command.php:167 Illuminate\Console\Command->run() at /var/www/bowhead/vendor/symfony/console/Application.php:858 Symfony\Component\Console\Application->doRunCommand() at /var/www/bowhead/vendor/symfony/console/Application.php:216 Symfony\Component\Console\Application->doRun() at /var/www/bowhead/vendor/symfony/console/Application.php:122 Symfony\Component\Console\Application->run() at /var/www/bowhead/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122 Illuminate\Foundation\Console\Kernel->handle() at /var/www/bowhead/artisan:35

Thus, it appears that the call chain generating the exception arises from bowhead_sar_stoch(), specifically at the level when the stoch() function within Util/Indicators is called (pasted below).

public function stoch($pair='BTC/USD', $data=null, $matype1=TRADER_MA_TYPE_SMA, $matype2=TRADER_MA_TYPE_SMA) { if (empty($data)) { $data = $this->getRecentData($pair); } if (empty($data['high'])) { return 0; } #$prev_close = $data['close'][count($data['close']) - 2]; // prior close #$current = $data['close'][count($data['close']) - 1]; // we assume this is current #high,low,close, fastk_period, slowk_period, slowk_matype, slowd_period, slowd_matype $stoch = trader_stoch($data['high'], $data['low'], $data['close'], 13, 3, $matype1, 3, $matype2); $slowk = $stoch[0]; $slowd = $stoch[1]; $slowk = array_pop($slowk); #$slowk[count($slowk) - 1];

The bolded line is what's causing the exception. Not really sure how you'd go about debugging this / figuring out the problem.

laffinggas avatar Nov 24 '17 21:11 laffinggas

Hi, I have the same problem... did you find a solution?

Filoz avatar Dec 16 '17 22:12 Filoz

Hi, Me too

webfaqtory avatar Jan 03 '18 10:01 webfaqtory