Tradier API examples using Python

Discussion in 'App Development' started by aphexcoil, Oct 3, 2017.

  1. If there is interest, I'll continue to build on these code examples and perhaps eventually create a full featured library for Tradier.

    This is a basic example of connecting to Tradier's stream API and following one ticker and all associated options.

    https://github.com/pushshift/tradier/blob/master/stream.py

    There is no error correction or reconnection logic, but the purpose is to show how to connect to their API using Python. This will print activity to STDOUT when the market is open (running it outside market hours will get all the most recent quotes).

    What this script does:

    1) Uses a ticker symbol and gets all expiration dates for all available options.
    2) Queries for all option symbols using expiration dates.
    3) Initiates a stream connection passing the ticker and all option symbols associated with the ticker during stream init.

    (I've programmed in C, GoLang, Perl and Python and have ~ 25 years of programming experience.)
     
    jonahern, claud9, KeLo and 2 others like this.
  2. This has been great. Really helpful
     
  3. djames

    djames

    just wondering why you use Tradier rather than IB, costs seem to be higher for Tradier
     
  4. claud9

    claud9

    This is really useful, especially the stream so thank you! It would be nice to build a real client since it seems like their example is not updated anymore.

    Have you tried out the stream yet? I was wondering how it actually is and how it would work with reconnection logic.

    side note: how long did it take for them to give you access to the Brokerage API? I would love to test it out but have just been using the Sandbox testing and waiting for them to respond to the email I sent.