Closed gyias closed 8 months ago
It seems that this only happens to the accounts that were originally opened with TD Ameritrade and have been migrated to Schwab recently. I can place orders without issues on my other Schwab account that was opened with Schwab.
Is there anyway I can debug this from my end? I'd really love to keep using this API to automate my trading.
It's difficult for me to debug this, because I don't have a TD ameritrade-opened account
Is there any way I can help you debug? Like posting sample request and response bodies?
Or I can try to fix it myself if you let me know how you usually handle this kind of problem. I don't even know where to start looking, but with some help, I may be able to debug it. I write programs for a living.
Quick update, I reverse engineered the "new" API for trading by persisting the authentication token obtained through playwright. I don't actively trade on Schwab anymore so I'll have to move some money in and test it over the next few days, but I'm optimistic this will solve the issue (and perhaps make the debugging process less opaque for anyone who wants to contribute in the future)
Awesome! Looking forward to the fix. Thank you so much!
Hi @gyias, I just pushed version 0.3.0, which features a trade_v2
function using the new API. I haven't fully tested it (which is why it's not a replacement of the old trade function), but I did get it to place orders on my regular Schwab brokerage account.
Could you try it out and let me know if it solves your problem?
Sure, will do. Thanks a lot!
Looking good so far. :) The orders didn't go through because the market was closed, but they appeared as pending orders. I'll try to make a real order tomorrow and report back. Thanks!
I was able to test buying but not selling, so I suspect selling might be a problem. Glad to hear the orders went through though, keep me posted!
Confirming both buy and sell orders can be placed and filled without any issue now. Thank you very much!
BTW, the new API supports MOC (Market on close) orders. In case other users of this library want to take advantage of the new order type, the order type number is 53. It might be a good idea to add an order type parameter to the new API? Probably with a default value of "49"
for the backward compatibility?
Thanks again for creating this super helpful API and addressing this issue! With the repeated delays of the official Schwab API launch, this is literally a life saver for those like me who were using the TDA API but were forced to migrate to Schwab.
I've been getting this error message when placing orders recently.
'message not found', 'This account currently holds %1% shares of %SYMBOL%. (AC109)'
I tried logging the responses, and the above message seemed to be coming from the verification response.
The confirmation response looked like this:
I checked the order status just in case, but there were no orders placed.