I'm having problems updating a Stop Market Order on GDAX,

The sequence I have for cancelling an order is in essence:

  1. Use Transactions.CancelOpenOrders()
  2. Use WaitForOrder() for order cancellation.
  3. If Order is not invalidated, then we can place a new SMO (Stop Market Order)
  4. place the order again at new price: StopMarketOrder(Symbol, -Portfolio[Symbol].Quantity, StopPrice);
The problem is I'm receiving sometimes "ERROR: Insufficient Funds" when I try to update this order, despite I did ok the first 4, 5, 6 attempts, My guess is: Despite I'm waiting for order cancellation response, GDAX has still not released these funds to place a new order, maybe it's checking too fast from the moment it cancels a trade to the moment it places a new one, so I get that message, here's an example where I did it right for 4 times and then it failed (same quantity): I think I can solve it if I get the funds on hold at that moment: From https://docs.pro.coinbase.com/#accountsACCOUNT FIELDSFieldDescriptionidAccount IDcurrencythe currency of the accountbalancetotal funds in the accountholdsfunds on hold (not available for use)availablefunds available to withdraw or trade
I've been looking at the documentation but I think there's no method or property for this, if so, is there any method I can use to prevent this issue?
 Thanks for your support.

Author