Fix styling

This commit is contained in:
mahdimsr 2025-09-28 21:02:08 +00:00 committed by github-actions[bot]
parent 38114203a1
commit 526ef64ad8
10 changed files with 151 additions and 154 deletions

View File

@ -35,12 +35,12 @@ try {
$data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) {
echo "✅ Position flash closed successfully!\n";
echo "Position ID: " . $data['data']['positionId'] . "\n";
echo 'Position ID: '.$data['data']['positionId']."\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -50,7 +50,7 @@ try {
$positionIds = [
'19848247723672',
'19848247723673',
'19848247723674'
'19848247723674',
];
foreach ($positionIds as $positionId) {
@ -83,11 +83,11 @@ try {
if ($data['code'] === 0) {
echo "✅ Position closed successfully!\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
echo "This is expected for invalid position ID\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
} catch (Exception $e) {

View File

@ -33,23 +33,23 @@ try {
$data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) {
echo "✅ Pending positions retrieved successfully!\n";
echo "Number of positions: " . count($data['data']) . "\n";
echo 'Number of positions: '.count($data['data'])."\n";
foreach ($data['data'] as $position) {
echo " - Position ID: " . $position['positionId'] . "\n";
echo " Symbol: " . $position['symbol'] . "\n";
echo " Side: " . $position['side'] . "\n";
echo " Quantity: " . $position['qty'] . "\n";
echo " Unrealized PnL: " . $position['unrealizedPNL'] . "\n";
echo " Margin: " . $position['margin'] . "\n";
echo " Leverage: " . $position['leverage'] . "\n";
echo ' - Position ID: '.$position['positionId']."\n";
echo ' Symbol: '.$position['symbol']."\n";
echo ' Side: '.$position['side']."\n";
echo ' Quantity: '.$position['qty']."\n";
echo ' Unrealized PnL: '.$position['unrealizedPNL']."\n";
echo ' Margin: '.$position['margin']."\n";
echo ' Leverage: '.$position['leverage']."\n";
echo " ---\n";
}
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -62,21 +62,21 @@ try {
$data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) {
echo "✅ BTCUSDT pending positions retrieved successfully!\n";
echo "Number of BTCUSDT positions: " . count($data['data']) . "\n";
echo 'Number of BTCUSDT positions: '.count($data['data'])."\n";
foreach ($data['data'] as $position) {
echo " - Position ID: " . $position['positionId'] . "\n";
echo " Entry Value: " . $position['entryValue'] . "\n";
echo " Average Open Price: " . $position['avgOpenPrice'] . "\n";
echo " Liquidation Price: " . $position['liqPrice'] . "\n";
echo " Margin Rate: " . $position['marginRate'] . "\n";
echo ' - Position ID: '.$position['positionId']."\n";
echo ' Entry Value: '.$position['entryValue']."\n";
echo ' Average Open Price: '.$position['avgOpenPrice']."\n";
echo ' Liquidation Price: '.$position['liqPrice']."\n";
echo ' Margin Rate: '.$position['marginRate']."\n";
echo " ---\n";
}
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -94,32 +94,32 @@ try {
if (! empty($data['data'])) {
$position = $data['data'][0];
echo " Position Details:\n";
echo " Position ID: " . $position['positionId'] . "\n";
echo " Symbol: " . $position['symbol'] . "\n";
echo " Side: " . $position['side'] . "\n";
echo " Quantity: " . $position['qty'] . "\n";
echo " Entry Value: " . $position['entryValue'] . "\n";
echo " Average Open Price: " . $position['avgOpenPrice'] . "\n";
echo " Unrealized PnL: " . $position['unrealizedPNL'] . "\n";
echo " Realized PnL: " . $position['realizedPNL'] . "\n";
echo " Margin: " . $position['margin'] . "\n";
echo " Leverage: " . $position['leverage'] . "\n";
echo " Margin Mode: " . $position['marginMode'] . "\n";
echo " Position Mode: " . $position['positionMode'] . "\n";
echo " Liquidation Price: " . $position['liqPrice'] . "\n";
echo " Margin Rate: " . $position['marginRate'] . "\n";
echo " Fee: " . $position['fee'] . "\n";
echo " Funding: " . $position['funding'] . "\n";
echo " Created: " . date('Y-m-d H:i:s', $position['ctime'] / 1000) . "\n";
echo " Modified: " . date('Y-m-d H:i:s', $position['mtime'] / 1000) . "\n";
echo ' Position ID: '.$position['positionId']."\n";
echo ' Symbol: '.$position['symbol']."\n";
echo ' Side: '.$position['side']."\n";
echo ' Quantity: '.$position['qty']."\n";
echo ' Entry Value: '.$position['entryValue']."\n";
echo ' Average Open Price: '.$position['avgOpenPrice']."\n";
echo ' Unrealized PnL: '.$position['unrealizedPNL']."\n";
echo ' Realized PnL: '.$position['realizedPNL']."\n";
echo ' Margin: '.$position['margin']."\n";
echo ' Leverage: '.$position['leverage']."\n";
echo ' Margin Mode: '.$position['marginMode']."\n";
echo ' Position Mode: '.$position['positionMode']."\n";
echo ' Liquidation Price: '.$position['liqPrice']."\n";
echo ' Margin Rate: '.$position['marginRate']."\n";
echo ' Fee: '.$position['fee']."\n";
echo ' Funding: '.$position['funding']."\n";
echo ' Created: '.date('Y-m-d H:i:s', $position['ctime'] / 1000)."\n";
echo ' Modified: '.date('Y-m-d H:i:s', $position['mtime'] / 1000)."\n";
} else {
echo "No position found with ID: {$positionId}\n";
}
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -132,12 +132,12 @@ try {
$data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) {
echo "✅ Filtered positions retrieved successfully!\n";
echo "Number of filtered positions: " . count($data['data']) . "\n";
echo 'Number of filtered positions: '.count($data['data'])."\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
} catch (Exception $e) {

View File

@ -36,20 +36,20 @@ try {
$account = $data['data'][0];
echo "Account Details:\n";
echo " Margin Coin: " . $account['marginCoin'] . "\n";
echo " Available: " . $account['available'] . "\n";
echo " Frozen: " . $account['frozen'] . "\n";
echo " Margin: " . $account['margin'] . "\n";
echo " Transfer: " . $account['transfer'] . "\n";
echo " Position Mode: " . $account['positionMode'] . "\n";
echo " Cross Unrealized PnL: " . $account['crossUnrealizedPNL'] . "\n";
echo " Isolation Unrealized PnL: " . $account['isolationUnrealizedPNL'] . "\n";
echo " Bonus: " . $account['bonus'] . "\n";
echo ' Margin Coin: '.$account['marginCoin']."\n";
echo ' Available: '.$account['available']."\n";
echo ' Frozen: '.$account['frozen']."\n";
echo ' Margin: '.$account['margin']."\n";
echo ' Transfer: '.$account['transfer']."\n";
echo ' Position Mode: '.$account['positionMode']."\n";
echo ' Cross Unrealized PnL: '.$account['crossUnrealizedPNL']."\n";
echo ' Isolation Unrealized PnL: '.$account['isolationUnrealizedPNL']."\n";
echo ' Bonus: '.$account['bonus']."\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -65,20 +65,20 @@ try {
$account = $data['data'][0];
echo "Account Details:\n";
echo " Margin Coin: " . $account['marginCoin'] . "\n";
echo " Available: " . $account['available'] . "\n";
echo " Frozen: " . $account['frozen'] . "\n";
echo " Margin: " . $account['margin'] . "\n";
echo " Transfer: " . $account['transfer'] . "\n";
echo " Position Mode: " . $account['positionMode'] . "\n";
echo " Cross Unrealized PnL: " . $account['crossUnrealizedPNL'] . "\n";
echo " Isolation Unrealized PnL: " . $account['isolationUnrealizedPNL'] . "\n";
echo " Bonus: " . $account['bonus'] . "\n";
echo ' Margin Coin: '.$account['marginCoin']."\n";
echo ' Available: '.$account['available']."\n";
echo ' Frozen: '.$account['frozen']."\n";
echo ' Margin: '.$account['margin']."\n";
echo ' Transfer: '.$account['transfer']."\n";
echo ' Position Mode: '.$account['positionMode']."\n";
echo ' Cross Unrealized PnL: '.$account['crossUnrealizedPNL']."\n";
echo ' Isolation Unrealized PnL: '.$account['isolationUnrealizedPNL']."\n";
echo ' Bonus: '.$account['bonus']."\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
echo "\n";
@ -118,11 +118,11 @@ try {
if ($data['code'] === 0) {
echo "✅ Account details retrieved successfully!\n";
} else {
echo "❌ API Error: " . $data['msg'] . "\n";
echo '❌ API Error: '.$data['msg']."\n";
echo "This is expected for invalid margin coin\n";
}
} else {
echo "❌ HTTP Error: " . $response->getStatusCode() . "\n";
echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
}
} catch (Exception $e) {

View File

@ -10,7 +10,6 @@ interface FlashClosePositionRequestContract
* Flash close position by position ID
*
* @param string $positionId Position ID
* @return ResponseInterface
*/
public function flashClosePosition(string $positionId): ResponseInterface;
}

View File

@ -11,7 +11,6 @@ interface GetPendingPositionsRequestContract
*
* @param string|null $symbol Trading pair (optional)
* @param string|null $positionId Position ID (optional)
* @return ResponseInterface
*/
public function getPendingPositions(?string $symbol = null, ?string $positionId = null): ResponseInterface;
}

View File

@ -10,7 +10,6 @@ interface GetSingleAccountRequestContract
* Get account details with the given margin coin
*
* @param string $marginCoin Margin coin (e.g., 'USDT')
* @return ResponseInterface
*/
public function getSingleAccount(string $marginCoin): ResponseInterface;
}

View File

@ -36,7 +36,7 @@ it('can handle different position ID formats', function () {
'123456789',
'987654321',
'position-123',
'pos_456'
'pos_456',
];
foreach ($positionIds as $positionId) {

View File

@ -74,7 +74,7 @@ it('can handle different position ID formats', function () {
'123456789',
'987654321',
'position-123',
'pos_456'
'pos_456',
];
foreach ($positionIds as $positionId) {
@ -139,7 +139,7 @@ it('can handle combination of symbol and position ID', function () {
$combinations = [
['BTCUSDT', '19848247723672'],
['ETHUSDT', '19848247723673'],
['ADAUSDT', '19848247723674']
['ADAUSDT', '19848247723674'],
];
foreach ($combinations as [$symbol, $positionId]) {