Schwab API Python Tutorial (Authentication and Requests)

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ •

  • @tylerebowers
    @tylerebowers  7 місяців тому +6

    The Github is now a pypi package, the installation is detailed in the readme. The next video on streaming also shows a short introduction on the usage of the new package: ua-cam.com/video/t7F2dUecgWc/v-deo.html

  • @Branden_R
    @Branden_R 9 місяців тому +24

    Downloaded your Git files, installed Python 3.12 and Visual Studio Code, got my app approved by Schwab, and was able to make the connection to Account Details

  • @ydailydrip
    @ydailydrip 9 місяців тому +7

    your the goat I was frustrated couldn't find a tut for schwab api

  • @tonyasprinkle
    @tonyasprinkle 4 місяці тому +3

    There are many people teaching programming on youtube, you are by far, the most comprehensive when making sure the listener understands where lines of code go back to or functions. We need websockets for RTD :)

  • @carsten7551
    @carsten7551 9 місяців тому +3

    Awesome, thank you very much Tyler. Great stuff. Longtime Schwab user and glad they’re making the APIs publicly available.

  • @keithandtammywetter5267
    @keithandtammywetter5267 8 місяців тому +5

    Thank you for creating this video! I was needing to switch my python code from my TDA api app to Schwab and the authentication is much different. I also use pycharm. This is great as I had several formatting issues I found. Your video helped me fix them and now I was able to get price histories. Now I need to look at implementing the refresh token so I can extend the use time.

  • @Controler_gaming
    @Controler_gaming 5 місяців тому +2

    thanks Tyler for making this transition from TD Ameritrade a lot easier

  • @luis_naar
    @luis_naar 9 місяців тому +1

    I had been waiting for this for months, I found out thanks to your video, I look forward to the continuation, thanks for the content

  • @cameronburnham4536
    @cameronburnham4536 5 місяців тому +2

    Love what you’re doing Tyler, very undervalued content. Thank you 🙂

    • @tylerebowers
      @tylerebowers  5 місяців тому

      @@cameronburnham4536 thanks!😊

  • @Scherle
    @Scherle Місяць тому

    Thank you for creating this vid, helped me get set up on Schwab after they bought TD

  • @MathPhDTrading-sv2024
    @MathPhDTrading-sv2024 6 місяців тому +2

    Thank you so much, Tyler for this video and extra help on Discord. I am one step closer to my auto trading, yeah!

  • @shwekhine5836
    @shwekhine5836 3 місяці тому +2

    Thank you for posting this instruction video.

  • @carsten7551
    @carsten7551 9 місяців тому

    Thank you for the Github repo as well. One suggestion I have is to use a Python code formatter like black to reformat your code. That way your code will be much more readable and easier to follow.

  • @michaelschneider4362
    @michaelschneider4362 6 місяців тому +3

    Thanks Tyler. Your video was helpful.

    • @tylerebowers
      @tylerebowers  6 місяців тому +1

      I also have another video on streaming that I recently published

  • @diwang
    @diwang 9 місяців тому +2

    Thanks a lot! They should have put this in their user guide...

  • @BlackDiamondProdz
    @BlackDiamondProdz 8 місяців тому +1

    Let’s go!!! thanks Tyler!

  • @paullopez_ai
    @paullopez_ai 8 місяців тому +1

    Tyler - this is awesome! Especially with the change from TD to Schwab. Our TD apps will stop working.

  • @muzehack
    @muzehack 9 місяців тому +2

    Ok, I have been using the TDA API in Google Sheets to pull option prices, and to do that I only had to add a parameter to my request url for an apikey. I cannot figure out how to do that simple thing with the Schwab api. Any suggestions? Why do they make you jump through all the oAuth crap just to pull market data? I am not creating a trading bot or entering orders. I just want to analyze option price data in Google Sheets.

  • @shawncherry6676
    @shawncherry6676 8 місяців тому +2

    Thank you for posting this, very helpful! Do you have to re-authentic every 7 days if just getting market data or is that just for account specific data? Do you have Git files for one that just goes after market data? Thanks again for putting this out here. I’ve subscribed and look forward to more videos.

  • @CooleraNet
    @CooleraNet 9 місяців тому +3

    Tyler,
    First, thank you, thank you, thank you -- very helpful information.
    Second, when you login (you pull your login screen off to the side - which I appreciate) are you logging into a Schwab account or a TDA account?
    Thank you, Paul Gundersen

    • @tylerebowers
      @tylerebowers  8 місяців тому

      I am using a Schwab account.

  • @ricomajestic
    @ricomajestic 18 днів тому

    I wish Schwab itself would do tutorials on this stuff for its customers.

  • @QuantEdgeHub
    @QuantEdgeHub 7 місяців тому +1

    Thank you. This is very helpful. You're a genius.

  • @Branden_R
    @Branden_R 9 місяців тому +3

    Great stuff - Please keep it coming - When you have time, please provide fully automated syntax examples on things like getting account balance, placing trades based on percentage of account balance, looping and getting a stock price every second, and a couple basic trading strategy examples on things like buying/selling based on sma

    • @robertcameron4288
      @robertcameron4288 8 місяців тому +2

      😂😂life isn’t about spoon feeding pal do your own due diligence

    • @ricomajestic
      @ricomajestic 18 днів тому

      @@robertcameron4288 Life is about getting views though so he would be dumb not to do what his viewers are requesting. If not him than I or someone else will do it and get all the big bucks from youtube!

  • @wuxiang3608
    @wuxiang3608 8 місяців тому +1

    Great video, thanks a lot! Could you give an example about place order? Specifically what should the orderObject look like when call the POST API?

  • @antonlogunov1936
    @antonlogunov1936 8 місяців тому +1

    Great work! Thanks for doing this!

  • @sickegg2000
    @sickegg2000 8 місяців тому

    Thank you very much, that's excellent work!. I completely agreed with the very annoying change for the refresh token expiration from 90 days down to 7.... We now have no choice but to automate this process, hopefully Schwab can fix that. Logging in manually is just NOT something I enjoy doing weekly while using multiple machines.
    Please let us know if you have follow up on that news or automation for the refresh token. THANKS

    • @tylerebowers
      @tylerebowers  8 місяців тому

      Schwab has said that it will eventually support updating the refresh token from an api call.

    • @sickegg2000
      @sickegg2000 8 місяців тому

      @@tylerebowers hopefully this happen sooner than later. At the mean time, I’ll checkout playwright and see if I can work around it for now. I heard some user have successfully automated this process. I am still waiting for my pending approval… lol

  • @PhoenixSunshin
    @PhoenixSunshin 5 місяців тому

    @tylerbowers I followed the steps and got all the way to the end where you got a link (at 13:34 minutes into the recording) but I got an error saying "we were unable to complete your request. Please contact customer support for further assistance" any thought or any idea who I need to contact?

    • @tylerebowers
      @tylerebowers  5 місяців тому +2

      @@PhoenixSunshin Your app must be “Ready for Use” is there a chance that it says “approved - pending” instead?

  • @hukangping8699
    @hukangping8699 7 місяців тому +1

    Great code, thanks for sharing!

  • @drstrangelove09
    @drstrangelove09 7 місяців тому +2

    I cannot get the authorize request to work. If I use the "AppKey" it fails with "There was an unexpected error (type=Internal Server Error, status=500)."
    I found a client_id when using the app request page and by watching the traffic... it lets me log in and returns back to the test page but at no point do I see the "code"

    • @drstrangelove09
      @drstrangelove09 7 місяців тому

      my app says "Approved - Pending" -> but it behaves like it's not approved...?

    • @tylerebowers
      @tylerebowers  7 місяців тому

      @@drstrangelove09 it’s not approved yet, you need to wait for “Ready For Use”

    • @drstrangelove09
      @drstrangelove09 7 місяців тому

      @@tylerebowers aha!!! thank you!!!

    • @drstrangelove09
      @drstrangelove09 7 місяців тому

      @@tylerebowers aha... I see that I am able to get the tokens if I work very fast... the auth code is only valid for 30 seconds

  • @leassaf1
    @leassaf1 7 місяців тому +1

    Thank you for great video. Do you know when the WebSocket Streaming will be available?

    • @tylerebowers
      @tylerebowers  7 місяців тому +1

      I don't know yet. Schwab is quiet about releases but they do deliver.

  • @mattm5602
    @mattm5602 6 місяців тому

    Hey @tylerebowers - thanks for the video! This is really helpful.
    I am unable to get real time data for index using this API. is there any additional configuration that needs to happen to fetch pull real time data?

    • @tylerebowers
      @tylerebowers  6 місяців тому

      You can try using the video on streaming to get real time data. You may also need to enable thinkorswim

  • @nguyenak730
    @nguyenak730 8 місяців тому

    Great video. Q: are we able to get historical data for stocks on 1 min candle (ohlc)? I want to export 100 stocks and analyze it.

  • @생각의자유-j9i
    @생각의자유-j9i Місяць тому

    Thank you so so so so much. I really love the content!
    Is there a way to send authentication to my phone once the refresh token is about to expire?
    This way, I can authenticate with my phone again using something like face ID and the refresh token is refreshed.

    • @tylerebowers
      @tylerebowers  Місяць тому +1

      Schwab requires manual authentication currently, however they have said that they are going to make the process easier in the future.

    • @생각의자유-j9i
      @생각의자유-j9i Місяць тому

      @ thanks for the comment! Hope authentication via phone can be utilized some day

  • @VictorFaria-ev7jx
    @VictorFaria-ev7jx 8 місяців тому +1

    Hey Tyler I still use the TDA API, but now trying to convert to Schwab
    I am following your tutorial, however i do not understand how do you refresh the access token with the refresh token.
    Do you have the request headers and payload data scheme.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      The GitHub in the description might help.

  • @michaelschneider4362
    @michaelschneider4362 6 місяців тому

    Is there any reason why the account values don't reflect real-time values when the market is open?

  • @davidjohnsonny
    @davidjohnsonny 25 днів тому

    How did you figure this out? is there Schwab documentation somewhere on this? I can't seem to find it.

  • @samc352
    @samc352 7 місяців тому

    This is great! thanks! so how do you refresh the token or use the refresh token? It seems like once the original token expires, you have to do the whole login thing again

    • @tylerebowers
      @tylerebowers  7 місяців тому

      Access token expires in 30 mins, refresh in 7 days. The GitHub program refreshes automatically. Schwab is working on a way to make it easier to deal with the refresh token so that you don’t have to manually authenticate every 7 days.

  • @prakashparasuram7088
    @prakashparasuram7088 3 місяці тому

    hello sir!! on the Schwab API, I could not find API to get a list of my current open positions, for example the list of stocks and options that i currently hold, am I missing something?

    • @tylerebowers
      @tylerebowers  3 місяці тому +1

      client.account_details(account_hash, fields="positions")

    • @prakashparasuram7088
      @prakashparasuram7088 3 місяці тому

      @tylerebowers incredible kindness is appreciated, sorry I missed the obvious thing I should have tried out

    • @tylerebowers
      @tylerebowers  3 місяці тому +1

      @@prakashparasuram7088 in the GitHub docs/ folder I have every api call possible documented as well as additional documentation for the client and streamer etc…

  • @variXD
    @variXD 3 місяці тому

    Can the initial authentication (login, check the box give consent blahbalh) be automated to? It is kind of lame to do it every time it expires

    • @tylerebowers
      @tylerebowers  3 місяці тому +1

      For the refresh token there is currently no way to automate it that wouldn’t go against Schwab’s policy. Since I have a public package I do not want to implement anything that would do that. I have also heard that their login page blocks attempts at automated logins and I believe that someone have gotten banned. So it’s quite the risk to do so.

  • @felixbrydenielsen6319
    @felixbrydenielsen6319 Місяць тому

    great stuff :)

  • @SP-qv9rt
    @SP-qv9rt 8 місяців тому

    Tyler, thanks a lot for the video. Question - when logging in to get the redirect url, do you log in with the developer ID? If I remember it correctly, they forced that to be an email address. I tried that ID but it says invalid ID/password. My TD brokerage accounts are not migrated to Schwab yet. However, I have created the developer account and registered an app in Schwab and I was hoping I could test the authentication. Do I need to wait for the accounts to migrate over?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      Yes, the redirect url is used to connect your Schwab account to the developer app.

  • @sidhantsatapathy8603
    @sidhantsatapathy8603 6 місяців тому +1

    Hello tyler,Can you please tell how much time it takes to move from status pending-approved to ready for use.

    • @tylerebowers
      @tylerebowers  6 місяців тому

      They run an approval process twice per week

    • @sidhantsatapathy8603
      @sidhantsatapathy8603 6 місяців тому

      ​@@tylerebowersbut i think it's been over a 10 days,no update in status of api

    • @tylerebowers
      @tylerebowers  6 місяців тому

      @@sidhantsatapathy8603 email them.

  • @Fitznicelyy
    @Fitznicelyy 8 місяців тому

    Hey Tyler, great tutorial, thanks for making it! It was a lot of help. Quick question - have you received any real data from the order requests? I'm sending the correct parameters like to/from entered time, status, etc..., and the status_code is coming back 200, but the array is empty even though I have order data of status and in time frame on my Schwab account.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      You can get the order ID of the successful order like this: "orderID = resp.headers.get('location', '/').split('/')[-1]" This example is also in the github main.py.

    • @Fitznicelyy
      @Fitznicelyy 8 місяців тому +1

      @@tylerebowers I'm just wondering if you're getting actual data back from like a simple '/orders' request. I'm able to get data from '/accounts' requests, but 'orders' and 'transactions' data returns an empty array, even though I know I have data in my Schwab account in my specified parameters.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@Fitznicelyy you only get the code and order id, it shouldn’t return anything else (unless there is an error).

  • @amirmn7
    @amirmn7 9 місяців тому

    Thanks for the video. It is very annoying to do authentications every 7 days, hope they change it.

  • @ahujapankaj
    @ahujapankaj 4 місяці тому

    Anyone knows if the developer account can be different than the Schwab account with Trading Accounts ? I have developer login that is different than trading account logins and when I try to get the initial token and have the code open. browser, I can't login using developer account there. But when I log in using credentials for Schwab account with Trading accounts, then I can sign in and select the accounts but it stops short of giving me the token/access_token and fails.

    • @tylerebowers
      @tylerebowers  4 місяці тому

      Yes, as far as I am aware they can be different. The developer account is for the app, and the broker account is the one that you link to the app when you sign in.

    • @ahujapankaj
      @ahujapankaj 4 місяці тому

      @@tylerebowers Thank you !! Great Video and explanation. Appreciate your time and effort tin sharing your code.

  • @jnotara
    @jnotara 8 місяців тому

    Great video Tyler- thank you. Your IDE seems clairvoyant. Is that Copilot?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      It’s Codeium, there is also jetbrains ai and GitHub copilot but I don’t use those.

    • @jnotara
      @jnotara 8 місяців тому

      @@tylerebowerswow, and it’s free?!? Jeesh, you’re a wealth of great information- Thank you!

  • @carlfee568
    @carlfee568 8 місяців тому

    Hi! Thanks so much for posting this! Did you ever get the refresh token to auto refresh?

    • @tylerebowers
      @tylerebowers  8 місяців тому +1

      Schwab is going to implement a system to make that easier in the future

    • @carlfee568
      @carlfee568 8 місяців тому

      @@tylerebowers Got it - thanks!

  • @danielfutterweit4182
    @danielfutterweit4182 8 місяців тому

    Thank you Tyler. This and the github helps a lot.
    I am using now for the access to ameritrade api session instead of requests. I am not sure if this difference impacts performance. What do you think?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      I am not entirely sure what you mean here.

    • @danielfutterweit4182
      @danielfutterweit4182 8 місяців тому

      @@tylerebowers Apparently YT blocks my response if it includes links.
      I access TDAmeritrade api hundreds of times a day. So, I use sessions. I copy the comment I wanted to show to you:
      "The Session object allows you to persist certain parameters across requests. It also persists cookies across all requests made from the Session instance, and will use urllib3‘s connection pooling. So if you’re making several requests to the same host, the underlying TCP connection will be reused, which can result in a significant performance increase"

    • @tylerebowers
      @tylerebowers  8 місяців тому +1

      @@danielfutterweit4182 I see, I’m not sure how well that would work with Schwab. I think using sessions does violate REST but it really depends on the implementation. You shouldn’t really need to make a ton of api calls once websocket streaming comes out from Schwab.

  • @bsoverns
    @bsoverns 7 місяців тому +1

    I wish I could double thumbs up.

    • @tylerebowers
      @tylerebowers  7 місяців тому

      If you liked this video then you might like the video I released on streaming. I think that would count. 😄

  • @TheDiverJim
    @TheDiverJim 7 місяців тому +1

    nice work!!

  • @ericjensen4497
    @ericjensen4497 8 місяців тому

    Many thanks for this. I wonder whether anyone else is having the same login problem I'm having.
    I created the app on the Schwab developer site so I have the app key and app secret. When I execute the code I go to the login page, then the page where I accept the agreements. Up to that point it's just as it appears in the video.
    However, the next page that comes up in the video is a page where the user selects which account to link to, which then goes to a blank page with the URL to be copied. For me, after I accept the agreements the next page is just the generic Schwab login page. If I enter the login information again, it just keeps going through the same loop.
    I'm using a Schwab account, not a TD account.
    Any thoughts on what might be happening and how I can correct it would be greatly appreciated.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      You might not have an account type that can be linked to

    • @ericjensen4497
      @ericjensen4497 8 місяців тому

      @@tylerebowers I hadn't thought of that. It's a 401k. Does anyone here know whether that disqualifies it?

    • @amrit0975
      @amrit0975 7 місяців тому

      @@ericjensen4497 401k's still not allowed, i have requested schwab for it

  • @John_Shi305
    @John_Shi305 8 місяців тому +1

    Thank you very much

  • @Ux10125
    @Ux10125 8 місяців тому

    Hi Tyler, is there a way to grab candle level data using the Schwab api?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      I believe price history returns candles.

  • @James-ip5gz
    @James-ip5gz 3 місяці тому

    Hey Tyler, would this work for my Schwab Roth IRA account?

    • @tylerebowers
      @tylerebowers  3 місяці тому

      Roth IRA accounts are supported!

  • @ydailydrip
    @ydailydrip 9 місяців тому

    It would be great if you make more apis for other brokerages also

    • @tylerebowers
      @tylerebowers  9 місяців тому

      I only have an account at schwab.

  • @fma3487
    @fma3487 7 місяців тому

    When I try to create the token, it says: access denied. what is the reason? My application status: ready for use.

    • @tylerebowers
      @tylerebowers  7 місяців тому

      Did you link an account? That should not be happening.

  • @jcenmiami
    @jcenmiami 6 місяців тому

    Hello, can you automatically re-authenticate like TD Ameritrade? Thanks for the video.

    • @tylerebowers
      @tylerebowers  6 місяців тому

      Just the access token for now, waiting on a solution for the refresh token from Schwab.

  • @sramasam2
    @sramasam2 8 місяців тому

    Good work on this. really helped me a lot in converting from td to schwab. but place trade isn't working for me. As soon as it is placed it is getting cancelled. any params missing on it?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      No other errors? Are you using the GitHub code? What the return code? There are some examples on Schwab, but the main.py code should work too.

    • @sramasam2
      @sramasam2 8 місяців тому

      @@tylerebowers yeah. i am using the github code # place an order (uncomment to test)
      i am getting 201 response but schwab immediately cancel the trade.

  • @lahirys2809
    @lahirys2809 7 місяців тому

    Hi Tyler, Thanks for the great video. I am having issue with "from modules import terminal". I have just the same project structure as your git version, but can't recognize 'terminal'. What I'm doing wrong? Thanks

    • @tylerebowers
      @tylerebowers  7 місяців тому

      Is the terminal.py file missing?

    • @lahirys2809
      @lahirys2809 7 місяців тому

      @@tylerebowers terminal.py is there, still getting unresolved reference for modules and terminal
      Sorry. After reviewing this, I think it may be because I included your project as a directory into an existing project. I just want to use your re-authentication part in my project. Can I just add those functions?

    • @tylerebowers
      @tylerebowers  7 місяців тому

      @@lahirys2809 which file are you running from? - you should be running from main.py

    • @lahirys2809
      @lahirys2809 7 місяців тому

      @@tylerebowers Now, I'm using your original git version, running from main.py. Its only authenticated first time. Subsequent run an gives me errors like below:
      [INFO]: Access token last updated: 2024-05-17 21:26:53 (expires in -41562 seconds)
      [INFO]: Refresh token last updated: 2024-05-17 21:26:53 (expires in 7 days)
      [INFO]: The access token has expired, updating automatically.
      [ERROR]: Could not get new access token.
      [INFO]: Filling account number and account hash -> Error
      [ERROR]: Could not get account numbers and account hash.
      [ERROR]: Please make sure that your app status is "Ready For Use" and that the app key and app secret are valid.
      [ERROR]: {'errors': [{'id': 'd0d9----- ....', 'status': 401, 'title': 'Unauthorized', 'detail': 'Client not authorized'}]}
      ... ...
      What I'm doing wrong? Thanks so much for your time.

    • @ronen.azachi
      @ronen.azachi 7 місяців тому

      i had the same problem on windows. i just renamed the modules folder to "utilities" and in the code.
      my python was resolving to another package that had the same name.

  • @enriquehoja9767
    @enriquehoja9767 8 місяців тому

    Thanks for posting, as official Schwab documentation is clearly lacking. In your code, I see an orderObject, but can't find the class. What is the format for placing orders? Also do you know if you can use a virtual/paper account?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      orderObject is a dictionary which schwab has some documentation for. Currently schwab does not have paper trading access

    • @enriquehoja9767
      @enriquehoja9767 8 місяців тому

      @@tylerebowers thanks. I was unable to find this documentation. Could you please post a link?

    • @enriquehoja9767
      @enriquehoja9767 8 місяців тому

      All of the schemas I saw are incomplete

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@enriquehoja9767 I believe they are all complete, you don’t need everything filled out.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@enriquehoja9767 The tab is currently missing from the dev website, normally you would go here: API Products -> Accounts and Trading Production -> Documentation tab

  • @dtconsultations
    @dtconsultations 7 місяців тому

    Hello Tyler, I need your help modifying my TD connections to Shwab. Can you help, please? Thank.

    • @dtconsultations
      @dtconsultations 7 місяців тому

      from td.client import TDClient
      class DataApp:
      def __init__(self,symbol,expiry,expiry_for_title):
      self.TDSession = TDClient(
      client_id = 'client IT',
      redirect_uri = '127.0.0.1/',
      credentials_path = 'jsonConfig1.json'
      )
      self.TDSession.login()
      self.symbol=symbol

  • @bh.rajveersinghsisodiya
    @bh.rajveersinghsisodiya 8 місяців тому

    Hi
    how would i get the login credential which will be add after clicking on authURL,
    could you please help here ?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      The description contains the demo file.

  • @tylerh3526
    @tylerh3526 9 місяців тому

    [ERROR]: Error in reading/writing token file, creating new token file. Any ideas on how to fix this? I don't know what it is supposed to contain, but it isn't creating/can't find it.

    • @tylerebowers
      @tylerebowers  9 місяців тому

      Are you on a Mac? Someone else with an arm-based Mac was having issues with the token file.

    • @tylerh3526
      @tylerh3526 9 місяців тому

      @@tylerebowers yes. Mac m1.

    • @tylerebowers
      @tylerebowers  9 місяців тому

      @@tylerh3526 The issue will likely be in the _TokenManager() function in api.py

    • @tylerh3526
      @tylerh3526 9 місяців тому

      @@tylerebowers Thanks! Mac seems to need one less folder or one more. For anyone else, the fix was just remove the folder. Instead of modules/tokens.txt, it looks like taking out modules, and just having tokens.txt allows it to run.

  • @amrit0975
    @amrit0975 8 місяців тому

    I am trying to place the order, order does get through with success code 201 but if I go to Schwab UI, I see it as cancelled. Do you know why? It never gets executed.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      Using the GitHub code?

    • @amrit0975
      @amrit0975 8 місяців тому

      @@tylerebowers Yes that's correct Tyler.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@amrit0975 is there a chance that you also uncommented the code that cancels it? I see no reason why it should be canceled

    • @amrit0975
      @amrit0975 8 місяців тому

      @@tylerebowers No I checked exactly for what you are saying, I do not have cancelOrder commented out.

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@amrit0975 It should be commented out if you don't want to cancel the order. If you mistyped that then the order could also be canceled because it is in an invalid format, you could try placing it within market hours.

  • @captainshekels
    @captainshekels 8 місяців тому

    mine hasn't been approved and its been over a week. Is there anything I could do?

  • @IamTheLiquidity
    @IamTheLiquidity 8 місяців тому

    is there any way to fully automate the authentication process?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      Schwab will eventually make something so you only have to authenticate once. I am looking into a quick solution for now, but paused on significant development until next Friday since I am busy.

  • @chrisruberg1491
    @chrisruberg1491 7 місяців тому

    Thanks Tyler, I am swithching from TDA to Schwab. When I use this code I get a "Bad Request" error. any clues to correct?

    • @tylerebowers
      @tylerebowers  7 місяців тому

      Is your app "Ready For Use"?

    • @chrisruberg1491
      @chrisruberg1491 7 місяців тому

      @@tylerebowers yes it is

    • @tylerebowers
      @tylerebowers  7 місяців тому

      @@chrisruberg1491 is the redirect url: "127.0.0.1" (no slash at the end)

    • @chrisruberg1491
      @chrisruberg1491 7 місяців тому

      @@tylerebowers yes. is there a limit to the number of times you can request tokens?

    • @tylerebowers
      @tylerebowers  7 місяців тому

      @@chrisruberg1491 Not one that I am aware of. I have never hit it. What code are you using? Demo code?

  • @rajv739
    @rajv739 7 місяців тому

    Excellent video! Discord link has expired - Can I get the invite please?

    • @tylerebowers
      @tylerebowers  7 місяців тому

      I tried it again, it is still working.

  • @MrJSplash
    @MrJSplash 5 місяців тому

    Anyone else getting a "Whitelabel Error Page" message?

    • @tylerebowers
      @tylerebowers  5 місяців тому

      @@MrJSplash Callback url might be incompatible? And app status must be “Ready for Use”.

  • @qihwang
    @qihwang 9 місяців тому

    schwab api available for paper trading?

    • @tylerebowers
      @tylerebowers  9 місяців тому

      You could make your own version of paper trading, no actual api for that.

  • @user-wr4yl7tx3w
    @user-wr4yl7tx3w 7 місяців тому

    fonts are hard to see

    • @tylerebowers
      @tylerebowers  7 місяців тому

      That was as much as I could zoom in the ide, trust me it is better than my series on the TD ameritrade api.

  • @rameshm1585
    @rameshm1585 8 місяців тому

    Is you streamer working, I am not receiving all streamer info needed. please respond

    • @tylerebowers
      @tylerebowers  8 місяців тому

      Streaming is not officially supported by schwab yet.

    • @FabrizioGiordano
      @FabrizioGiordano 8 місяців тому

      @@tylerebowers Do you think they will add websockets for stock data by the time TD will switch to Schwab?

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@FabrizioGiordano I know as much as you so I cannot be sure about anything. I hope they will release it soon. There are currently ways to get the stream working but it’s not official yet. I will post a video when they release it.

    • @FabrizioGiordano
      @FabrizioGiordano 8 місяців тому

      ​@@tylerebowers thank you for the quick response. can you elaborate or give hint on "There are currently ways to get the stream working but it’s not official yet. " :)

    • @tylerebowers
      @tylerebowers  8 місяців тому

      @@FabrizioGiordano There isn’t anything to subscribe to yet, so all you can do is connect.

  • @nolannosike
    @nolannosike 8 місяців тому

    Hi Tyler. Thank you so much for this. running into an issue when i try and get movers if you can help:
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 3 column 9 (char 22)
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "/Users/nolannosike/projects.nosike/Wager/Schwab-API-Python-main/main.py", line 92, in
    main() #call the user code above
    ^^^^^^
    File "/Users/nolannosike/projects.nosike/Wager/Schwab-API-Python-main/main.py", line 70, in main
    print(api.movers.getMovers("$DIJ").json())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 3 column 9 (char 22)
    nolannosike@nolans-mbp projects.nosike %
    I added the .json() to your print(api.movers.getMovers("$DIJ"), lmk if that was incorrect, I get a 404 when its not there.
    Not sure what the issue is, when i try schwabs website it seems to be working. the decoder is too complex for my nooby brain to understand, not sure how to see the raw data either so i'm not sure what exactly its saying

    • @tylerebowers
      @tylerebowers  8 місяців тому +1

      The 404 code means there was some error in what you sent in the call. (A code around 200 is good). Because of the 404 error no json data is returned. 404 may indicate that the api link is invalid.

  • @kyawp
    @kyawp 9 місяців тому

    Hi Tyler, thank you very much for posting this. This is really helpful. I am trying this with R on mac m1. I have been receiving this error code. Would you happen to know what's causing this?
    $error
    [1] "unsupported_token_type"
    $error_description
    [1] "400 Bad Request: \"{\"error_description\":\"Bad authorization code: AuthorizationCode has expired,expiration=1712366963920,now=1712366966062 \",\"error\":\"invalid_request\"}\""

    • @kyawp
      @kyawp 9 місяців тому

      It says authorizationcode has expired but I just got the code in the browser address bar and it expired within the few seconds I transferred it from the address bar to RStudio?

    • @shingcheung
      @shingcheung 9 місяців тому +1

      @@kyawp i had the same error. It was because I didn't URL decode prior to making the request. However, this error seems to their genetic error repones even when it is the server error.

  • @nateking7477
    @nateking7477 8 місяців тому

    thank you!!