Skip to content
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

Options endpoint updated on ally api #74

Open
james1627 opened this issue Apr 14, 2022 · 2 comments
Open

Options endpoint updated on ally api #74

james1627 opened this issue Apr 14, 2022 · 2 comments

Comments

@james1627
Copy link

The fixml changed for options orders and I have been getting the error:
ally.exception.ExecutionException: This symbol is not valid for this request
when submitting with py ally the fixml should be:

<FIXML xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2">
  <Order TmInForce="0" Typ="2" Side="1" Px="21.00" PosEfct="O" Acct="12345678">
    <Instrmt CFI="OC" SecTyp="OPT" MatDt="2014-01-18T00:00:00.000-05:00" StrkPx="190" Sym="IBM"/>
    <OrdQty Qty="4"/>
  </Order>
</FIXML>

instead of the given:

<FIXML xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2">
  <Order AcctTyp="5" Typ="2" Px="8.5" Side="1" TmInForce="0">
     <Instrmt SecTyp="CS" Sym="NFLX220422C00300000" />
     <OrdQty Qty="1" />
  </Order>
</FIXML>

according to the link:
[https://www.ally.com/api/invest/documentation/trading/]

@james1627
Copy link
Author

james1627 commented Apr 21, 2022

`
def set_symbol(self, symbol: str):
"""Sets the orders instrument.
Can be viewed at obj.instrument
"""
if len(symbol) > 15:
# Almost certainly an option, if not unintelligible

        try:

            # Extract the symbol
            underlying = option_symbol(symbol)

            # Extract strike price
            strike = option_strike(symbol)

            # Extract expiration date
            exp_date = option_maturity(symbol)

            # Extract
            callput = option_callput(symbol)

            # Wrap it up and spank it on the bottom!
            self.instrument = Option(
                direction=callput,
                underlying=underlying,
                exp_date=exp_date,
                strike=strike,
            )

        except:
            raise
    else:
        self.instrument = Stock(symbol=symbol)`

found it just a missing else. should be a simple push for you guys

@james1627
Copy link
Author

It does however look like the PosEfct="O" is missing, might just need to update convert_buysell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant