robinhood-unofficial / pyrh

Python Framework to make trades with the unofficial Robinhood API
https://pyrh.readthedocs.io/en/latest/
MIT License
1.77k stars 603 forks source link

Fix bug in cancel_order due to wrong concatenation syntax #296

Closed Te12944265-AMAHA closed 1 year ago

Te12944265-AMAHA commented 1 year ago

Checklist

Related Issue

Fixes #280, fixes #281

Description

Cancel order throws an error as follows:

----> 1 cancel_order = rh.cancel_order(order_id)

File ~/.local/lib/python3.8/site-packages/pyrh/robinhood.py:1474, in Robinhood.cancel_order(self, order_id)
   1472 if isinstance(order_id, str):
   1473     try:
-> 1474         order = self.get(urls.build_orders() + order_id)
   1475     except (requests.exceptions.HTTPError) as err_msg:
   1476         raise ValueError(
   1477             "Failed to get Order for ID: "
   1478             + order_id
   1479             + "\n Error message: "
   1480             + repr(err_msg)
   1481         )

TypeError: unsupported operand type(s) for +: 'URL' and 'str'

Verification

With the new changes, an order can be canceled successfully.