Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from AurelC2G/market_orders
Browse files Browse the repository at this point in the history
Fixed market orders
  • Loading branch information
vdbelt authored Mar 24, 2021
2 parents 9fcd4f6 + 4c8be34 commit e8f6462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Api/Support/PendingOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function market(float $size) : self
{
$this->attributes['type'] = self::TYPE_MARKET;
$this->attributes['size'] = $size;
$this->attributes['price'] = null;

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Api/OrdersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testCreateOrder()
$this->assertEquals('BTC-PERP', $order->market);
$this->assertEquals(99.9, $order->size);
$this->assertEquals(
['market' => 'BTC-PERP', 'size' => 99.9, 'type' => 'market', 'side' => 'sell', 'ioc' => true],
['market' => 'BTC-PERP', 'size' => 99.9, 'type' => 'market', 'side' => 'sell', 'ioc' => true, 'price' => null],
$order->toArray()
);

Expand All @@ -138,7 +138,7 @@ public function testCreateOrder()
$this->assertEquals('BTC-PERP', $order->market);
$this->assertEquals(10, $order->size);
$this->assertEquals(
['market' => 'BTC-PERP', 'size' => 10, 'type' => 'market', 'side' => 'buy', 'reduceOnly' => true, 'clientId' => 'foo'],
['market' => 'BTC-PERP', 'size' => 10, 'type' => 'market', 'side' => 'buy', 'reduceOnly' => true, 'clientId' => 'foo', 'price' => null],
$order->toArray()
);
}
Expand Down

0 comments on commit e8f6462

Please sign in to comment.