You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to use the below code in foreach loop to set userData websocket to grab new orders and order updates for multiple accounts. but i can only create userdata webocket for first account in the foreach loop as it start $loop->run for the first account and never return back to the foreach loop. Please suggest/help me how can i set the UserData websocket for remaining accounts. here is the code i am using:
I have tried to use the below code in foreach loop to set userData websocket to grab new orders and order updates for multiple accounts. but i can only create userdata webocket for first account in the foreach loop as it start $loop->run for the first account and never return back to the foreach loop. Please suggest/help me how can i set the UserData websocket for remaining accounts. here is the code i am using:
$balance_update = function($api, $balances) {
print_r($balances);
echo "Balance update".PHP_EOL;
};
$order_update = function($api, $report) {
echo "Order update".PHP_EOL;
print_r($report);
$price = $report['price'];
$quantity = $report['quantity'];
$symbol = $report['symbol'];
$side = $report['side'];
$orderType = $report['orderType'];
$orderId = $report['orderId'];
$orderStatus = $report['orderStatus'];
$executionType = $report['orderStatus'];
if ( $executionType == "NEW" ) {
if ( $executionType == "REJECTED" ) {
echo "Order Failed! Reason: {$report['rejectReason']}".PHP_EOL;
}
echo "{$symbol} {$side} {$orderType} ORDER #{$orderId} ({$orderStatus})".PHP_EOL;
echo "..price: {$price}, quantity: {$quantity}".PHP_EOL;
return;
}
//NEW, CANCELED, REPLACED, REJECTED, TRADE, EXPIRED
echo "{$symbol} {$side} {$executionType} {$orderType} ORDER #{$orderId}".PHP_EOL;
};
$api->userData($balance_update, $order_update);
The text was updated successfully, but these errors were encountered: