Fix styling

This commit is contained in:
mahdimsr 2025-09-28 21:45:15 +00:00 committed by github-actions[bot]
parent 2fde2137e4
commit 8d1c837092
5 changed files with 63 additions and 63 deletions

View File

@ -5,7 +5,7 @@
* *
* This example demonstrates how to use the LaravelBitunixApi package * This example demonstrates how to use the LaravelBitunixApi package
* to place position TP/SL orders on Bitunix exchange. * to place position TP/SL orders on Bitunix exchange.
* *
* Note: When triggered, it will close the position at market price based on the position quantity at that time. * Note: When triggered, it will close the position at market price based on the position quantity at that time.
* Each position can only have one Position TP/SL Order. * Each position can only have one Position TP/SL Order.
*/ */
@ -107,7 +107,7 @@ try {
foreach ($symbols as $symbol) { foreach ($symbols as $symbol) {
echo "Placing position TP/SL order for {$symbol}...\n"; echo "Placing position TP/SL order for {$symbol}...\n";
$response = $api->placePositionTpSlOrder( $response = $api->placePositionTpSlOrder(
$symbol, $symbol,
'111', '111',
@ -116,7 +116,7 @@ try {
'45000', '45000',
'LAST_PRICE' 'LAST_PRICE'
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -138,7 +138,7 @@ try {
foreach ($positionIds as $positionId) { foreach ($positionIds as $positionId) {
echo "Placing position TP/SL order for position ID {$positionId}...\n"; echo "Placing position TP/SL order for position ID {$positionId}...\n";
$response = $api->placePositionTpSlOrder( $response = $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
$positionId, $positionId,
@ -147,7 +147,7 @@ try {
'45000', '45000',
'LAST_PRICE' 'LAST_PRICE'
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -174,7 +174,7 @@ try {
foreach ($stopTypeCombinations as $index => $combination) { foreach ($stopTypeCombinations as $index => $combination) {
echo "Placing position TP/SL order with stop types: {$combination[0]}, {$combination[1]}...\n"; echo "Placing position TP/SL order with stop types: {$combination[0]}, {$combination[1]}...\n";
$response = $api->placePositionTpSlOrder( $response = $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
@ -183,17 +183,17 @@ try {
'45000', '45000',
$combination[1] $combination[1]
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
echo "✅ Position TP/SL order with {$combination[0]}/{$combination[1]} placed successfully!\n"; echo "✅ Position TP/SL order with {$combination[0]}/{$combination[1]} placed successfully!\n";
echo 'Order ID: '.$data['data']['orderId']."\n"; echo 'Order ID: '.$data['data']['orderId']."\n";
} else { } else {
echo "❌ Failed to place position TP/SL order: ".$data['msg']."\n"; echo '❌ Failed to place position TP/SL order: '.$data['msg']."\n";
} }
} else { } else {
echo "❌ HTTP Error: ".$response->getStatusCode()."\n"; echo '❌ HTTP Error: '.$response->getStatusCode()."\n";
} }
} }
@ -202,7 +202,7 @@ try {
// Example 7: Error handling // Example 7: Error handling
echo "7. Error handling example...\n"; echo "7. Error handling example...\n";
$response = $api->placePositionTpSlOrder('INVALID', '111'); $response = $api->placePositionTpSlOrder('INVALID', '111');
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -221,31 +221,31 @@ try {
/** /**
* Place Position TP/SL Order Features: * Place Position TP/SL Order Features:
* *
* - Place position TP/SL orders for existing positions * - Place position TP/SL orders for existing positions
* - Rate limit: 10 req/sec/UID * - Rate limit: 10 req/sec/UID
* - Supports both take profit and stop loss * - Supports both take profit and stop loss
* - When triggered, closes position at market price * - When triggered, closes position at market price
* - Each position can only have one Position TP/SL Order * - Each position can only have one Position TP/SL Order
* *
* Required Parameters: * Required Parameters:
* - symbol: Trading pair * - symbol: Trading pair
* - positionId: Position ID associated with TP/SL * - positionId: Position ID associated with TP/SL
* *
* Optional Parameters: * Optional Parameters:
* - tpPrice: Take-profit trigger price * - tpPrice: Take-profit trigger price
* - tpStopType: Take-profit trigger type (LAST_PRICE/MARK_PRICE) * - tpStopType: Take-profit trigger type (LAST_PRICE/MARK_PRICE)
* - slPrice: Stop-loss trigger price * - slPrice: Stop-loss trigger price
* - slStopType: Stop-loss trigger type (LAST_PRICE/MARK_PRICE) * - slStopType: Stop-loss trigger type (LAST_PRICE/MARK_PRICE)
* *
* Note: At least one of tpPrice or slPrice is required. * Note: At least one of tpPrice or slPrice is required.
* *
* Key Differences from regular TP/SL Order: * Key Differences from regular TP/SL Order:
* - Simpler parameters (no order types, prices, quantities) * - Simpler parameters (no order types, prices, quantities)
* - Automatically closes position at market price when triggered * - Automatically closes position at market price when triggered
* - One order per position limit * - One order per position limit
* - Uses position/place_order endpoint * - Uses position/place_order endpoint
* *
* Environment Variables Required: * Environment Variables Required:
* *
* BITUNIX_API_KEY=your-api-key * BITUNIX_API_KEY=your-api-key

View File

@ -124,7 +124,7 @@ try {
foreach ($symbols as $symbol) { foreach ($symbols as $symbol) {
echo "Placing TP/SL order for {$symbol}...\n"; echo "Placing TP/SL order for {$symbol}...\n";
$response = $api->placeTpSlOrder( $response = $api->placeTpSlOrder(
$symbol, $symbol,
'111', '111',
@ -139,7 +139,7 @@ try {
'1', '1',
'1' '1'
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -161,7 +161,7 @@ try {
foreach ($positionIds as $positionId) { foreach ($positionIds as $positionId) {
echo "Placing TP/SL order for position ID {$positionId}...\n"; echo "Placing TP/SL order for position ID {$positionId}...\n";
$response = $api->placeTpSlOrder( $response = $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
$positionId, $positionId,
@ -176,7 +176,7 @@ try {
'1', '1',
'1' '1'
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -195,7 +195,7 @@ try {
// Example 6: Error handling // Example 6: Error handling
echo "6. Error handling example...\n"; echo "6. Error handling example...\n";
$response = $api->placeTpSlOrder('INVALID', '111'); $response = $api->placeTpSlOrder('INVALID', '111');
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$data = json_decode($response->getBody()->getContents(), true); $data = json_decode($response->getBody()->getContents(), true);
if ($data['code'] === 0) { if ($data['code'] === 0) {
@ -214,16 +214,16 @@ try {
/** /**
* Place TP/SL Order Features: * Place TP/SL Order Features:
* *
* - Place TP/SL orders for existing positions * - Place TP/SL orders for existing positions
* - Rate limit: 10 req/sec/UID * - Rate limit: 10 req/sec/UID
* - Supports both take profit and stop loss * - Supports both take profit and stop loss
* - Flexible parameter configuration * - Flexible parameter configuration
* *
* Required Parameters: * Required Parameters:
* - symbol: Trading pair * - symbol: Trading pair
* - positionId: Position ID associated with TP/SL * - positionId: Position ID associated with TP/SL
* *
* Optional Parameters: * Optional Parameters:
* - tpPrice: Take-profit trigger price * - tpPrice: Take-profit trigger price
* - tpStopType: Take-profit trigger type (LAST_PRICE/MARK_PRICE) * - tpStopType: Take-profit trigger type (LAST_PRICE/MARK_PRICE)
@ -235,10 +235,10 @@ try {
* - slOrderPrice: Stop-loss order price * - slOrderPrice: Stop-loss order price
* - tpQty: Take-profit order quantity (base coin) * - tpQty: Take-profit order quantity (base coin)
* - slQty: Stop-loss order quantity (base coin) * - slQty: Stop-loss order quantity (base coin)
* *
* Note: At least one of tpPrice or slPrice is required. * Note: At least one of tpPrice or slPrice is required.
* At least one of tpQty or slQty is required. * At least one of tpQty or slQty is required.
* *
* Environment Variables Required: * Environment Variables Required:
* *
* BITUNIX_API_KEY=your-api-key * BITUNIX_API_KEY=your-api-key

View File

@ -15,7 +15,7 @@ use Msr\LaravelBitunixApi\Requests\PlacePositionTpSlOrderRequestContract;
use Msr\LaravelBitunixApi\Requests\PlaceTpSlOrderRequestContract; use Msr\LaravelBitunixApi\Requests\PlaceTpSlOrderRequestContract;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
class LaravelBitunixApi implements ChangeLeverageRequestContract, ChangeMarginModeRequestContract, FlashClosePositionRequestContract, FutureKLineRequestContract, GetPendingPositionsRequestContract, GetSingleAccountRequestContract, PlaceOrderRequestContract, PlaceTpSlOrderRequestContract, PlacePositionTpSlOrderRequestContract class LaravelBitunixApi implements ChangeLeverageRequestContract, ChangeMarginModeRequestContract, FlashClosePositionRequestContract, FutureKLineRequestContract, GetPendingPositionsRequestContract, GetSingleAccountRequestContract, PlaceOrderRequestContract, PlacePositionTpSlOrderRequestContract, PlaceTpSlOrderRequestContract
{ {
private Client $publicFutureClient; private Client $publicFutureClient;

View File

@ -14,14 +14,14 @@ beforeEach(function () {
it('can place position TP/SL order with required parameters only', function () { it('can place position TP/SL order with required parameters only', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
}); });
it('can place position TP/SL order with take profit only', function () { it('can place position TP/SL order with take profit only', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', // tpPrice '50000', // tpPrice
@ -32,7 +32,7 @@ it('can place position TP/SL order with take profit only', function () {
it('can place position TP/SL order with stop loss only', function () { it('can place position TP/SL order with stop loss only', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
null, // tpPrice null, // tpPrice
@ -45,7 +45,7 @@ it('can place position TP/SL order with stop loss only', function () {
it('can place position TP/SL order with both take profit and stop loss', function () { it('can place position TP/SL order with both take profit and stop loss', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', // tpPrice '50000', // tpPrice
@ -67,7 +67,7 @@ it('can handle different symbol formats', function () {
$symbols = ['BTCUSDT', 'ETHUSDT', 'ADAUSDT']; $symbols = ['BTCUSDT', 'ETHUSDT', 'ADAUSDT'];
foreach ($symbols as $symbol) { foreach ($symbols as $symbol) {
expect(fn() => $api->placePositionTpSlOrder($symbol, '111')) expect(fn () => $api->placePositionTpSlOrder($symbol, '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -78,7 +78,7 @@ it('can handle different position ID formats', function () {
$positionIds = ['111', 'position-123', '19848247723672']; $positionIds = ['111', 'position-123', '19848247723672'];
foreach ($positionIds as $positionId) { foreach ($positionIds as $positionId) {
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', $positionId)) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', $positionId))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -89,7 +89,7 @@ it('can handle different stop types', function () {
$stopTypes = ['LAST_PRICE', 'MARK_PRICE']; $stopTypes = ['LAST_PRICE', 'MARK_PRICE'];
foreach ($stopTypes as $stopType) { foreach ($stopTypes as $stopType) {
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -106,7 +106,7 @@ it('can handle different price formats', function () {
$prices = ['50000', '50000.1', '50000.01', '50000.001']; $prices = ['50000', '50000.1', '50000.01', '50000.001'];
foreach ($prices as $price) { foreach ($prices as $price) {
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
$price, $price,
@ -128,7 +128,7 @@ it('can handle multiple place position TP/SL order calls', function () {
]; ];
foreach ($calls as $params) { foreach ($calls as $params) {
expect(fn() => $api->placePositionTpSlOrder(...$params)) expect(fn () => $api->placePositionTpSlOrder(...$params))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -138,7 +138,7 @@ it('validates place position TP/SL order response structure', function () {
// This test verifies the method can be called without throwing exceptions // This test verifies the method can be called without throwing exceptions
// The actual response structure will be validated by the API // The actual response structure will be validated by the API
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
}); });
@ -146,11 +146,11 @@ it('can handle edge cases for position TP/SL order', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
// Test with minimum required parameters // Test with minimum required parameters
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with all parameters // Test with all parameters
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -164,11 +164,11 @@ it('can handle special characters in parameters', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
// Test with special characters in position ID // Test with special characters in position ID
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', 'pos-123-abc')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', 'pos-123-abc'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with decimal prices // Test with decimal prices
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000.123', '50000.123',
@ -182,19 +182,19 @@ it('can handle different combinations of parameters', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
// Test with only TP price // Test with only TP price
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111', '50000')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111', '50000'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with only SL price // Test with only SL price
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111', null, null, '45000')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111', null, null, '45000'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with only TP stop type // Test with only TP stop type
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111', '50000', 'MARK_PRICE')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111', '50000', 'MARK_PRICE'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with only SL stop type // Test with only SL stop type
expect(fn() => $api->placePositionTpSlOrder('BTCUSDT', '111', null, null, '45000', 'MARK_PRICE')) expect(fn () => $api->placePositionTpSlOrder('BTCUSDT', '111', null, null, '45000', 'MARK_PRICE'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
}); });
@ -202,7 +202,7 @@ it('can handle position TP/SL order with mixed stop types', function () {
$api = app(PlacePositionTpSlOrderRequestContract::class); $api = app(PlacePositionTpSlOrderRequestContract::class);
// Test with different stop types for TP and SL // Test with different stop types for TP and SL
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -212,7 +212,7 @@ it('can handle position TP/SL order with mixed stop types', function () {
))->not->toThrow(Exception::class); ))->not->toThrow(Exception::class);
// Test with opposite stop types // Test with opposite stop types
expect(fn() => $api->placePositionTpSlOrder( expect(fn () => $api->placePositionTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',

View File

@ -14,14 +14,14 @@ beforeEach(function () {
it('can place TP/SL order with required parameters only', function () { it('can place TP/SL order with required parameters only', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
expect(fn() => $api->placeTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placeTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
}); });
it('can place TP/SL order with take profit only', function () { it('can place TP/SL order with take profit only', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', // tpPrice '50000', // tpPrice
@ -40,7 +40,7 @@ it('can place TP/SL order with take profit only', function () {
it('can place TP/SL order with stop loss only', function () { it('can place TP/SL order with stop loss only', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
null, // tpPrice null, // tpPrice
@ -59,7 +59,7 @@ it('can place TP/SL order with stop loss only', function () {
it('can place TP/SL order with both take profit and stop loss', function () { it('can place TP/SL order with both take profit and stop loss', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', // tpPrice '50000', // tpPrice
@ -87,7 +87,7 @@ it('can handle different symbol formats', function () {
$symbols = ['BTCUSDT', 'ETHUSDT', 'ADAUSDT']; $symbols = ['BTCUSDT', 'ETHUSDT', 'ADAUSDT'];
foreach ($symbols as $symbol) { foreach ($symbols as $symbol) {
expect(fn() => $api->placeTpSlOrder($symbol, '111')) expect(fn () => $api->placeTpSlOrder($symbol, '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -98,7 +98,7 @@ it('can handle different position ID formats', function () {
$positionIds = ['111', 'position-123', '19848247723672']; $positionIds = ['111', 'position-123', '19848247723672'];
foreach ($positionIds as $positionId) { foreach ($positionIds as $positionId) {
expect(fn() => $api->placeTpSlOrder('BTCUSDT', $positionId)) expect(fn () => $api->placeTpSlOrder('BTCUSDT', $positionId))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -109,7 +109,7 @@ it('can handle different stop types', function () {
$stopTypes = ['LAST_PRICE', 'MARK_PRICE']; $stopTypes = ['LAST_PRICE', 'MARK_PRICE'];
foreach ($stopTypes as $stopType) { foreach ($stopTypes as $stopType) {
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -126,7 +126,7 @@ it('can handle different order types', function () {
$orderTypes = ['LIMIT', 'MARKET']; $orderTypes = ['LIMIT', 'MARKET'];
foreach ($orderTypes as $orderType) { foreach ($orderTypes as $orderType) {
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -147,7 +147,7 @@ it('can handle different quantity formats', function () {
$quantities = ['1', '0.1', '10.5', '100']; $quantities = ['1', '0.1', '10.5', '100'];
foreach ($quantities as $qty) { foreach ($quantities as $qty) {
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -170,7 +170,7 @@ it('can handle different price formats', function () {
$prices = ['50000', '50000.1', '50000.01', '50000.001']; $prices = ['50000', '50000.1', '50000.01', '50000.001'];
foreach ($prices as $price) { foreach ($prices as $price) {
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
$price, $price,
@ -196,7 +196,7 @@ it('can handle multiple place TP/SL order calls', function () {
]; ];
foreach ($calls as $params) { foreach ($calls as $params) {
expect(fn() => $api->placeTpSlOrder(...$params)) expect(fn () => $api->placeTpSlOrder(...$params))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
} }
}); });
@ -206,7 +206,7 @@ it('validates place TP/SL order response structure', function () {
// This test verifies the method can be called without throwing exceptions // This test verifies the method can be called without throwing exceptions
// The actual response structure will be validated by the API // The actual response structure will be validated by the API
expect(fn() => $api->placeTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placeTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
}); });
@ -214,11 +214,11 @@ it('can handle edge cases for TP/SL order', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
// Test with minimum required parameters // Test with minimum required parameters
expect(fn() => $api->placeTpSlOrder('BTCUSDT', '111')) expect(fn () => $api->placeTpSlOrder('BTCUSDT', '111'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with all parameters // Test with all parameters
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000', '50000',
@ -238,11 +238,11 @@ it('can handle special characters in parameters', function () {
$api = app(PlaceTpSlOrderRequestContract::class); $api = app(PlaceTpSlOrderRequestContract::class);
// Test with special characters in position ID // Test with special characters in position ID
expect(fn() => $api->placeTpSlOrder('BTCUSDT', 'pos-123-abc')) expect(fn () => $api->placeTpSlOrder('BTCUSDT', 'pos-123-abc'))
->not->toThrow(Exception::class); ->not->toThrow(Exception::class);
// Test with decimal prices // Test with decimal prices
expect(fn() => $api->placeTpSlOrder( expect(fn () => $api->placeTpSlOrder(
'BTCUSDT', 'BTCUSDT',
'111', '111',
'50000.123', '50000.123',