fhqvst / avanza

A JavaScript client for the unofficial Avanza API
MIT License
229 stars 59 forks source link

Issue with Deleting order #96

Closed bellbrant closed 1 year ago

bellbrant commented 1 year ago

Seems like there is a new CONSTANT for the 'constants.paths.ORDER_DELETE_PATH' Anybody got an idea? @dichai1983 ? :)

bellbrant commented 1 year ago

I think i solved it:

  1. In index.js replace "deleteOrder" with

    /**
    * Delete and cancel an order.
    *
    * @param {Object} options Order options.
    * @param {String} options.accountId ID of the account on which this order was placed.
    * @param {String} options.orderId Order ID received when the order was placed.
    */
    
    deleteOrder(options) {
    console.log(options)
    return this.call('POST', constants.paths.ORDER_DELETE_PATH, options);
    }

    2.Then when calling the function "deleteOrder", do the same as with placing an order:

    try {
      actual = await avanza.deleteOrder({
        accountId: process.env.AVANZA_ACCOUNT,
        orderId: orderId
      })
dichai1983 commented 1 year ago

Awesome! I'm testing your solution now. will come back.

dichai1983 commented 1 year ago

It works! Thanks 👍