Sessions

Creating a session

A session object is required to authenticate your requests to the Tastytrade API. To create a production (real) session using your normal login:

from tastytrade import Session
session = Session('username', 'password')

A certification (test) account can be created here, then used to create a session.

from tastytrade import Session
session = Session('username', 'password', is_test=True)

You can make a session persistent by generating a remember token, which is valid for 24 hours:

session = Session('username', 'password', remember_me=True)
remember_token = session.remember_token
# remember token replaces the password for the next login
new_session = Session('username', remember_token=remember_token)

Note

If you used a certification (test) account to create the session associated with the remember_token, you must set is_test=True when creating subsequent sessions.