-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get options chains for futures when using a test account. #181
Comments
This is a known limitation of the sandbox account. Technically we could get it working by making some of the fields optional, but some of them like |
Thanks @Graeme22. Has TastyTrade publicly posted any info about this overhaul? If so do you have a link? |
Not that I know of, I've been talking to them directly. Early January is the current date they're shooting for releasing it. Until then I'd recommend staying away from the sandbox accounts though, they're not very useful currently. |
Thanks for the info. Just curious, if you do not use the sandbox accounts, how do you go about "paper trading" or forward testing your strategies? Additionally, I think I may have found a work-around, at least for my particular use-case. I create a prod session and a test session, and use the prod session for fetching options chain info and the test session for placing orders as shown below: from datetime import datetime, timedelta
from tastytrade import Account, Session
from tastytrade.instruments import get_future_option_chain
from tastytrade.order import *
prod_session = Session('prod_user', 'prod_pass', is_test=False)
test_session = Session('test_user', 'test_pass', is_test=True)
prod_account: Account = Account.get_accounts(prod_session)[0]
test_account: Account = Account.get_accounts(test_session)[0]
chain = get_future_option_chain(prod_session, '/ES')
exp = datetime.now().date() + timedelta(days=4)
futopt = chain[exp][10]
order = NewOrder(
time_in_force=OrderTimeInForce.DAY,
order_type=OrderType.MARKET,
legs = [
futopt.build_leg(Decimal(1), OrderAction.BUY_TO_OPEN)
]
)
response = test_account.place_order(test_session, order)
print(response) The code runs, but futures are done trading for the week so the order does not submit. I do get the expected response though (that the trading session is not active). Am I missing any obvious signs of why this approach would be a bad idea? |
I've done something similar and it works ok, however the sandbox sessions have problems in other areas, e.g. their arbitrary rules for fills and a lot of unsupported symbols and instrument types. |
I typically just use production sessions and keep a close eye on the trades, or place them at prices I know they won't fill at for testing. |
Describe the bug
I can use use the
get_future_option_chain
orNestedFutureOptionChain.get_chain
functions to retrieve the options chains for futures when I use my production account, but not when I use a test/sandbox account.How to reproduce
I get the following output when using
get_future_option_chain
with a test account:The text was updated successfully, but these errors were encountered: