question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bybit limit close/sell/tp order creates short order

See original GitHub issue

Hi,

This code created a close/sell order a few days ago but with the latest ccxt version it creates a short order:

exchange.createOrder({
            symbol,
            'limit',
            'sell',
            position,
            price
})

Maybe this is bybit related issue. A change in their API ? How to place a short vs a sell with createOrder ?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
fliekscommented, Jun 11, 2022

@carlosmiei hmm thanks for the explanation.

It seems indeed that the reduce_only did the trick. Putting it to true creates a limit close instead of a limit short. I wonder if other exchanges will work to with this setup but this i will test later.

Thanks for the help

1reaction
carlosmieicommented, Jun 10, 2022

@flieks It is not a TP limit order, it is a “limit order” only. TP/SL orders are a different thing but I think I get what you meant, by closing the current position you might have a profit or a loss.

If you have an open long position and want to close it yes you should issue an order in the opposite direction (sell in this case) and you should also provide the ‘reduce_only’ flag as true.

Please check out this example that demontrastes precisely that: https://github.com/ccxt/ccxt/blob/master/examples/py/bybit-updated.py#L54

Read more comments on GitHub >

github_iconTop Results From Across the Web

Limit Order - Bybit Learn
A limit order is a function in cryptocurrency trading that allows you to establish the exact price range for selling or buying your...
Read more >
Market , Limit and Conditional Order - Bybit Official Help
Limit Order allows traders to set the order price, and the order will be filled at the order price or an executed price...
Read more >
Explained: What Are Stop-Loss and Stop-Limit Orders?
A stop-loss order is a universal risk management technique applicable in stocks or even crypto trading to effectively limit potential losses.
Read more >
Quick trading functions - Bybit Official Help
The Quick Open limit order is located on the price scale of the trading chart. By clicking the + button, you can set...
Read more >
How to Close a Trade on Bybit
Would you like to close a position in order to realize a profit or a loss ... by clicking on either the Close...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found