alienbrett / PyAlly

Ally Invest API Module for Python3
https://alienbrett.github.io/PyAlly/
MIT License
57 stars 28 forks source link

Error XXXX is not a valid symbol for trading for option trading #60

Closed yidea closed 3 years ago

yidea commented 3 years ago

I'm on PyAlly 1.1.2, buy call option api is giving me errors, other api seems ok

The example code below keeps giving me errors of 500 error MOS210226C00032000 is not a valid symbol for trading., but I know this symbol is correct because I hold this option currently so has the symbol for it (print out from .holding() method), and I have tried to open order on the website seems working also fine (no permission or site issue) I was wondering if u might know what might be wrong w the API call or something else like a regression? or anyone has been able to place a successful option call order.

Thanks in advance!

call = ally.utils.option_format(
    symbol='mos',
    exp_date='2021-02-26',
    strike=32,
    direction='call'
)
buyOptionOrder = ally.Order.Order(
    buysell='buy',
    symbol=call,
    price=ally.Order.Limit(limpx=0.51),  # or  None || Market()
    qty=1,
    time='day'
)
try:
    orderIDoption = a.submit(buyOptionOrder, preview=False)
except Exception as e:
    print('\n', e)
yidea commented 3 years ago

More detail here, I think this is a regression, I'm able to see the order & rejection from Ally web, it seems the API we use here is now transformed to a stock buy w symbol= MOS210226C00032000 instead of being recognized as option by Ally api, some part is falling apart between the 2 api

alienbrett commented 3 years ago

What is the exact output from a.submit(..., preview=True) vs for preview=False? If it fails on one and not the other, this might be a problem with the upstream API.

alienbrett commented 3 years ago

The symbol "MOS210226C00032000" is working as valid symbol, and I can receive quotes for this from the pyally api on my end. I'm closing the thread, and I assume this was a bug upstream.