Options endpoint updated on ally api
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/]
`
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
It does however look like the PosEfct="O" is missing, might just need to update convert_buysell