GithubHelp home page GithubHelp logo

Comments (7)

Shimoli avatar Shimoli commented on September 23, 2024

It used to work good with me but for now it has same error

from bybit-market-maker.

verata-veritatis avatar verata-veritatis commented on September 23, 2024

I first get a fill, then moments later I get this error:

2021-07-03 01:28:11.796893 - INFO - Awaiting position.
Traceback (most recent call last):
File "mm.py", line 191, in
s.set_trading_stop(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pybit/init.py", line 909, in set_trading_stop
return self._submit_request(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pybit/init.py", line 1497, in _submit_request
raise InvalidRequestError(
pybit.exceptions.InvalidRequestError: Not modified (ErrCode: 34040) (ErrTime: 01:28:14).
Request → POST https://api.bybit.com/v2/private/position/trading-stop: {'api_key': '', 'recv_window': 5000, 'stop_loss': 2194, 'symbol': 'ETHUSD', 'timestamp': 1625275694488, 'sign': ''}.

This suggests that you've already placed a stop and are trying to modify your trading stop, but the stop loss hasn't changed. For example, if you place a limit order with a stop of 2194, then after filling try to modify the trading stop to the same price (2194), you will get this error. Is this your situation?

from bybit-market-maker.

projenix avatar projenix commented on September 23, 2024

This suggests that you've already placed a stop and are trying to modify your trading stop, but the stop loss hasn't changed. For example, if you place a limit order with a stop of 2194, then after filling try to modify the trading stop to the same price (2194), you will get this error. Is this your situation?

No I had actually not placed any stops at all.

from bybit-market-maker.

gone-bad-steel-pipe avatar gone-bad-steel-pipe commented on September 23, 2024

Oh No!!!
It used to work good with me but for now it has same error now!
Besides, it is ignored by the bybit support.
Dose anyone know a solution ErrCode: 34040?

from bybit-market-maker.

Jessika-Art avatar Jessika-Art commented on September 23, 2024

Hi guys here's a solution.

Let's say you opened a 'Buy' position (the position must be already open),
here's a simple function to add then a SL.

from pybit import HTTP # version: pybit==1.3.6 USE THIS VERSION

def STOP_LOSS_for_LONG_POSITION():
    session = HTTP('https://api-testnet.bybit.com', api_key=KEY, api_secret=SECRET)
    session.set_trading_stop(
        symbol="SOLUSDT",
        side="Buy", # I opened a position at 38.70
        stop_loss = 38.00) # I set the stop at 38.00

STOP_LOSS_for_LONG_POSITION() # Execute it.

from bybit-market-maker.

kamilkuczynski avatar kamilkuczynski commented on September 23, 2024

@Jessika-Art thank you for your response but it doesn't work.

Any another idea?

from bybit-market-maker.

Jessika-Art avatar Jessika-Art commented on September 23, 2024

@Kamkuczpol my friend, I just created a simple repo just for you so you can copy the code that works.
To make easier your research the functions you need are in lines 163 and 177 for stop loss for buy and sell and both are called in lines 199 for buy and 210 for sell.
I make them easy to read and highly customizable.

https://github.com/Jessika-Art/ByBit-useful-functions/blob/aff18bcbf3d0d81ebad2efcdaffdbbc5ec30d957/ByBit%20usefull%20functions.py

from bybit-market-maker.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.