Code:
PHP Notice: Undefined index: return in /root/bitcoin-rolling-bot-php-master/arbot.php on line 513
PHP Warning: Invalid argument supplied for foreach() in /root/bitcoin-rolling-bot-php-master/arbot.php on line 513
the line of code it indicates is the second line in this block.
Code:
if ($BALANCE) $BTCremaining = $BTC*($currentBalanceBTC-$reBalanceBTC);
foreach ( $TradeHistory['return'] as $key => $value){
//DEBUG use this information to calculate trades/costs/profits
if ( $value['type'] == $exchangeBuySell[0] && $BTCremaining >= $minBidBTC ) {
$costBalance['total'] = $costBalance['total'] + $value['rate']*$value['amount'];
$costBalance['shares'] = $costBalance['shares'] + $value['amount'];//$amountTrade[0]; Total shares analysed not / spread
$BTCremaining = $BTCremaining - $value['amount'];
$countBuys++;
}
/*
{
"success":1,
"return":{
"166830":{
"pair":"btc_usd",
"type":"sell",
"amount":1,
"rate":1,
"order_id":343148,
"is_your_order":1,
"timestamp":1342445793
}
}
}*/
I don't know php at all so I was hoping someone might be able to help me with this... it doesn't seem to want to make any trades and simply reiterates when it reaches this line. can someone please help me out with debugging this?
upon asking a code ninja I know about the issue, he says that $TradeHistory doesnt have the 'return' key populated
so the foreach gets a null (or whatever php uses), and promptly goes 'wtf?' but i'm still clueless about how to repair it.