alienbrett / PyAlly

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

Market orde doesn't work? #52

Closed john8988 closed 4 years ago

john8988 commented 4 years ago

HELP! First time using this and tried it with market order and had the following error

The code: (just use as the example in your document): allyO is the ally object that has been verified to work for many other functions like balances, quote and timesales

o = ally.Order.Order(buysell = 'buy', symbol='AAPL', price = ally.Order.Market(), time='day', qty=1) allyO.submit(o,preview=False)

The error message:

allyO.submit(o,preview=False)

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\Submit.py", line 159, in submit block = block File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Api.py", line 206, in init super().init(auth,kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Api.py", line 171, in init send_params, send_data = self.req_body (kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\Submit.py", line 92, in req_body data = self._order.fixml File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\order.py", line 190, in fixml d.update(self.pricing.fixml) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\classes.py", line 99, in fixml return self._tag AttributeError: 'Market' object has no attribute '_tag'

john8988 commented 4 years ago

Turns out it has errors on other order types like limit too. Some gross usage error?

o1 = ally.Order.Order(buysell = 'buy', symbol='RMD', price=ally.Order.Limit(173), time='day', qty=1) print(o1) (OType.Order) Side.Buy 1 units of "RMD" TimeInForce.Day, Limit $173.000 a.submit(o1, preview=False) Traceback (most recent call last): File "", line 1, in File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\Submit.py", line 159, in submit block = block File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Api.py", line 206, in init super().init(auth,kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Api.py", line 171, in init send_params, send_data = self.req_body (kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\Submit.py", line 92, in req_body data = self._order.fixml File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\order.py", line 190, in fixml d.update(self.pricing.fixml) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ally\Order\classes.py", line 99, in fixml return self._tag AttributeError: 'Limit' object has no attribute '_tag'