bitfinexcom / bitfinex-api-py

Apache License 2.0
201 stars 125 forks source link

unexpected argument from bitfinex-api-py library #249

Open RomeoVir opened 1 month ago

RomeoVir commented 1 month ago

I get an error of unexpected argument when i'm trying to submit an order. The code i used (as readme example).

from bfxapi import Client, REST_HOST

from bfxapi.types import Notification, Order

bfx = Client(
    rest_host=REST_HOST,
    api_key="<YOUR BFX API-KEY>",
    api_secret="<YOUR BFX API-SECRET>"
)

notification: Notification[Order] = bfx.rest.auth.submit_order(
    type="EXCHANGE LIMIT", symbol="tBTCUSD", amount=0.165212, price=30264.0)

order: Order = notification.data

if notification.status == "SUCCESS":
    print(f"Successful new order for {order.symbol} at {order.price}$.")

if notification.status == "ERROR":
    raise Exception(f"Something went wrong: {notification.text}")

Error:

Traceback (most recent call last): File "...\main_2.py", line 77, in notification: Notification[Order] = bfx.rest.auth.submit_order( File "...\lib\site-packages\bfxapi\rest_interfaces\rest_auth_endpoints.py", line 120, in submit_order self._m.post("auth/w/order/submit", body=body) File "...\lib\site-packages\bfxapi\rest_interface\middleware.py", line 82, in post data = request.json(cls=JSONDecoder) File "...\lib\site-packages\requests\models.py", line 974, in json return complexjson.loads(self.text, kwargs) File "...\lib\site-packages\simplejson__init__.py", line 533, in loads return cls(encoding=encoding, kw).decode(s) File "...\lib\site-packages\bfxapi_utils\json_decoder.py", line 16, in init super().init(args, **kwargs, object_hook=_object_hook) TypeError: JSONDecoder.init() got an unexpected keyword argument 'encoding'

Python version

Python 3.10.14

Davi0kProgramsThings commented 1 week ago

Hi @RomeoVir.

Unfortunately, I am unable to replicate the issue (even using python 3.10.14). I think the issue might be caused by a conflict with one of your project's dependencies. Could you please attach your project's requirements.txt?

You can generate it with the following command:

pip freeze > requirements.txt