Skip to content

Commit

Permalink
Add missing complex create/delete methods to the orders service (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: Devin Moss <[email protected]>
  • Loading branch information
axlos and dmoss18 authored Feb 5, 2024
1 parent b90739c commit dd9f642
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/services/orders-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default class OrderService {
return extractResponseData(order)
}

async cancelComplexOrder(accountNumber: string, orderId: number){
//Requests order cancellation
const order = await this.httpClient.deleteData(`/accounts/${accountNumber}/complex-orders/${orderId}`, {})
return extractResponseData(order)
}

async replaceOrder(accountNumber: string, orderId: number, replacementOrder : object){
//Replaces a live order with a new one. Subsequent fills of the original order will abort the replacement.
const order = await this.httpClient.putData(`/accounts/${accountNumber}/orders/${orderId}`, replacementOrder , {})
Expand Down Expand Up @@ -60,6 +66,12 @@ export default class OrderService {
return extractResponseData(orderResponse)
}

async createComplexOrder(accountNumber: string, order: object){
//Accepts a json document containing parameters to create an order for the client.
const orderResponse = await this.httpClient.postData(`/accounts/${accountNumber}/complex-orders`, order , {})
return extractResponseData(orderResponse)
}

async postOrderDryRun(accountNumber: string, order: object){
//Accepts a json document containing parameters to create an order and then runs the prefights without placing the order.
const orderDryRun = await this.httpClient.postData(`/accounts/${accountNumber}/orders/dry-run`, order , {})
Expand Down

0 comments on commit dd9f642

Please sign in to comment.