Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BingX | edit_order, i need help #22284

Closed
xerno0om opened this issue Apr 26, 2024 · 6 comments
Closed

BingX | edit_order, i need help #22284

xerno0om opened this issue Apr 26, 2024 · 6 comments
Assignees
Labels

Comments

@xerno0om
Copy link

xerno0om commented Apr 26, 2024

Operating System

Windows 11

Programming Languages

Python

CCXT Version

Last

Description

I try to do edit_order to edit, change my Take Profit, but when I run the script it tells me that :

Code

import ccxt

bingx_exchange = ccxt.bingx({
    'apiKey': '--',
    'secret': '--',
    'options': {
        'adjustForTimeDifference': True,
        'defaultType': 'swap',
    },
})

  order = bingx_exchange.edit_order(
    id='Yours', 
    symbol='BTC/USDT', 
    type='market', 
    side='sell', 
    amount='0.0200', 
    params={"takeProfit": {"triggerPrice": take_profit}}
)
print(order)


Traceback (most recent call last):
  File "c:\Users\gabri\OneDrive\Documents\za.py", line 14, in <module>
    trader = bingx_exchange.edit_order(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\bingx.py", line 4088, in edit_order
    response = self.spotV1PrivatePostTradeOrderCancelReplace(self.extend(request, params))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\base\types.py", line 35, in unbound_method
    return _self.request(self.path, self.api, self.method, params, config=self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\base\exchange.py", line 3654, in request
    return self.fetch2(path, api, method, params, headers, body, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\base\exchange.py", line 3651, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\base\exchange.py", line 673, in fetch
    self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
  File "C:\Users\gabri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ccxt\bingx.py", line 4228, in handle_errors
    raise ExchangeError(feedback)  # unknown message
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ccxt.base.errors.ExchangeError: bingx {"code":100004,"msg":"Permission denied as the API key was created without the permission","timestamp":1714126674957}

@carlosmiei carlosmiei self-assigned this Apr 26, 2024
@carlosmiei
Copy link
Collaborator

Hello @xerno0om, we will take a look and let you know shortly.

@carlosmiei
Copy link
Collaborator

@xerno0om I found indeed some issues with tp/sl orders on spot markets, they will be fixed and released in a few hours.

Nonetheless, you're using the wrong syntax to place independent tp/sl orders, it should be something like this:

spot_tp_order = await bingx.create_order('LTC/USDT', 'market', 'sell', 0.1, None, {'takeProfitPrice': 150})

spot_limit_sl_order = await bingx.create_order('LTC/USDT', 'limit', 'sell', 0.1, 30, {'stopLossPrice': 35})

After the release the syntax above ⬆️ should work for placing spot tp/sl orders.

@xerno0om
Copy link
Author

@carlosmiei no, that's not exactly my problem, is that: I have already opened my position with my take profit, but my problem is that I want to move my take profit from this position a little higher, that's what I can't do it, what should I use? edit_order ?

@carlosmiei
Copy link
Collaborator

@xerno0om Oh ok the symbol confused me because BTC/USDT represents a spot market.

Well, in that case I'm not sure if it is possible to edit the sl/tp of a currently opened position (I'm not finding an API endpoint for that).

@carlosmiei
Copy link
Collaborator

We will ask bingx about it

@carlosmiei
Copy link
Collaborator

@xerno0om Bingx just confirmed that at the moment you can't edit it, you have to close + open a new position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants