Successful webwrite, but empty response/output?

7 views (last 30 days)
Hey everyone,
I'm using webwrite to POST stock orders to TD Ameritrade using their API. For this to work, I need to define an authorization token in the header and provide the order details in json format. I'm able to successfully POST the order so that's not the issue. The problem I'm having is that I'd like to get the order number back from TD Ameritrade, but unfortunately webwrite--though successful--is returning an empty array (0x1 uint8). If I make this exact same request on TD Ameritrade's API web interface (i.e. using a browser), it shows a return like the one in the screenshot below.
The above info would be very useful in the webwrite output. The order number, which is what I'm looking for, is returned at the end of the "Location" line, in this example "2269145847." (Note that I've covered my account number on the "Location" line, hence the blank white space.)
My question is, how do I call webwrite or some other alternative such that information like that shown above is actually returned in Matlab instead of an empty response like I am getting right now?
Obviously, I don't want to have to manually use the TDA API via a web browser interface since that would defeat the purpose of automating in Matlab.
Thanks,
Paul S

Accepted Answer

Paul Shoemaker
Paul Shoemaker on 24 Aug 2019
Hey all,
Seems like I stumbled into an echo chamber on this topic. I figured out how to get this to work. The solution can be found on this Matlab Answers entry (yes, I authored and answered that one, too!).
Paul S

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!