diff --git a/order_submission_example.py b/order_submission_example.py new file mode 100644 index 0000000..8dd1968 --- /dev/null +++ b/order_submission_example.py @@ -0,0 +1,23 @@ +from dotenv import load_dotenv +from os import getenv +from tastytrade.option_type import CALL, PUT +from tastytrade.order import create_credit_spread +from tastytrade.symbology import zero_dte_spx_contract as contract +from tastytrade import Tastytrade + +load_dotenv() +account = getenv("TASTYTRADE_ACCOUNT") +username = getenv("TASTYTRADE_USERNAME") +password = getenv("TASTYTRADE_PASSWORD") + +tastytrade_api = Tastytrade(username, password) +tastytrade_api.login() + +put_credit_spread = create_credit_spread(contract(PUT, 4455), contract(PUT, 4435), 0.35, 1) +call_credit_spread = create_credit_spread(contract(CALL, 4490), contract(CALL, 4505), 0.35, 1) + +put_spread_result = tastytrade_api.submit_order(account, put_credit_spread) +call_spread_result = tastytrade_api.submit_order(account, call_credit_spread) + +print(put_spread_result) +print(call_spread_result) \ No newline at end of file