Open rockwoodquant opened 1 year ago
I tried to use account_id instead of accountIdKey, i also tried to add in resp_type = "xml" in the function call. every time so far got to the same error...
Same issue here.
edit I figured it out, the expiry date format needs to be month-day-year
@xabaddonx1 I tried your suggestion, same error...
You must have another issue. I think the client order id needs to be unique for each order, i generate it with clientOrderId = dt.datetime.timestamp(presentDate) * 1000000 maybe that's it.
Again, same error with this change... @xabaddonx1
Any update on this?
Running into the identical issue and have taken identical steps with no luck. Is this a bug in PyEtrade or picky E*Trade request formatting?
Odd that it works for some... @xabaddonx1 would you mind sharing your working request code and param formatting for option orders? Would be a large help.
Here's mine, a couple things I thought of:
It could be the clientOrderId needs to be an int.
resp = orders.place_option_order(
resp_format='xml',
accountId=brokerageAccountIdKey,
symbol=symbol,
callPut=callPut,
expiryDate=expiryDate,
strikePrice=formatNumber(strikePrice),
orderAction=action,
clientOrderId=int(clientOrderId),
priceType=priceType,
limitPrice=limitPrice,
allOrNone=False,
quantity=quantity,
orderTerm="GOOD_FOR_DAY",
marketSession='REGULAR')
i'm running the code below on strikePrice, I ran into an issue where sometimes it would say 12.0 and the api doesn't like that :
def formatNumber(num):
if num % 1 == 0:
return int(num)
else:
return num
The client_order_id
does need to be an int cast as a str. This is what i have working in my code without issue:
from random import randint
client_order_id = str(randint(1000000000, 9999999999))
I am trying to send an options order using pyetrade and got bad url error. Other modules seem to work fine - e.g. market / accounts etc.
Can someone please help? I'm out of ideas now - thanks!
here is what I was trying to do:
-----------------code below----------------
------------end of code---------------
This gets the following error --
-----------start of error---------------
------------end of error------------
Thanks in advance...
-RQ