Skip to content

Commit

Permalink
update cancel and modify order for python
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Nov 27, 2023
1 parent da2ba37 commit b8b49fc
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions source/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ const userOrderId = 1;
await driftClient.cancelOrderByUserOrderId(userOrderId);
```

```python

const user_order_id = 1;
await drift_client.cancel_order_by_user_order_id(user_order_id);
```

| Parameter | Description | Optional | Default |
| ----------- | ----------- | -------- | ------- |
| userOrderId | Unique order id specified by user when order was placed | No | |
Expand Down Expand Up @@ -659,6 +665,18 @@ const updateParams = {
await driftClient.modifyOrder(orderParams);
```

```python

order_id = 1

modfiy_order_params = ModifyOrderParams(
base_asset_amount=drift_client.convert_to_perp_precision(1),
price=drift_client.convert_to_price_precision(20),
)

await drift_client.modify_order(order_id, modify_order_params);
```

| Parameter | Description | Optional | Default |
| ----------- | ----------- | -------- | ------- |
| orderId | The order id of order to modify | No | |
Expand All @@ -673,7 +691,7 @@ await driftClient.modifyOrder(orderParams);
| auctionDuration | how many slots the auction lasts. only applicable for market and oracle orders | Yes | |
| auctionStartPrice | the price the auction starts at | Yes | |
| auctionEndPrice | the price the auction ends at | Yes | |
| maxTs | the max timestampe before the order expires | Yes | |
| maxTs | the max timestamp before the order expires | Yes | |

Modify order cancels and places a new order.

Expand All @@ -686,7 +704,19 @@ const updateParams = {
newBaseAssetAmount: driftClient.convertToPerpPrecision(200),
}

await driftClient.modifyOrder(orderParams);
await driftClient.modifyOrderByUserOrderId(orderParams);
```

```python

user_order_id = 1

modfiy_order_params = ModifyOrderParams(
base_asset_amount=drift_client.convert_to_perp_precision(1),
price=drift_client.convert_to_price_precision(20),
)

await drift_client.modify_order_by_user_id(user_order_id, modify_order_params);
```

| Parameter | Description | Optional | Default |
Expand Down

0 comments on commit b8b49fc

Please sign in to comment.