Giter VIP home page Giter VIP logo

Comments (13)

germangar avatar germangar commented on September 23, 2024

Hello,

Are the positions being opened in the exchange despite the warning?

This is probably nothing. Some exchanges send error messages when things didn't need to be changed. I silence them, but they change the error code from time to time and I need to silence them again.

I'll check it out later today.

from whook.

iZnogoude avatar iZnogoude commented on September 23, 2024

It you look the log, on the first lines it creates correctly the positions in the exchange of my broker => short.

[2024/05/15][16:15:02] ALERT: [[email protected]](mailto:[email protected]) ONDOUSDT sell 195.84@ x5
[2024/05/15][16:15:02] ----------------------------
[2024/05/15][16:15:02]
[2024/05/15][16:15:02] ALERT: [[email protected]](mailto:[email protected]) STXUSDT sell 66@ x5
[2024/05/15][16:15:02] ----------------------------
[2024/05/15][16:15:07] * Order successful: ONDO/USDT:USDT sell 195.84 5x at price 0.8166 id 1790777936443559936
[2024/05/15][16:15:09] * Order successful: STX/USDT:USDT sell 66.0 5x at price 2.1012 id 1790777949856944128

The issue happens when the bot send a new alert to buy. I was not in front of it when the alerts happens, but when the alerts creates some news positions => long.
So at the end I had 4 positions, 2 short and 2 long.


[2024/05/15][21:15:00] ALERT: [[email protected]](mailto:[email protected]) ONDOUSDT buy 14.2@ x5
[2024/05/15][21:15:00] ----------------------------
[2024/05/15][21:15:01] * W: Cannot change position mode while a position is open
[2024/05/15][21:15:03] * Order successful: ONDO/USDT:USDT buy 14.2 5x at price 0.828 id 1790853417855569920
[2024/05/16][00:45:01]
[2024/05/16][00:45:01] ALERT: [[email protected]](mailto:[email protected]) STXUSDT buy 5@ x5
[2024/05/16][00:45:01] ----------------------------
[2024/05/16][00:45:01] * W: Cannot change position mode while a position is open
[2024/05/16][00:45:02] * Order successful: STX/USDT:USDT buy 5.0 5x at price 2.1528 id 1790906265645568000

The thing that is incomprehensible for me is that even on sell the message in the log is the same. It shouldn't be because the position are short.


[2024/05/15][16:45:04] ALERT: [[email protected]](mailto:[email protected]) ONDOUSDT sell 15.61@ x5
[2024/05/15][16:45:04] ----------------------------
[2024/05/15][16:45:05] * W: Cannot change position mode while a position is open
[2024/05/15][16:45:06] * Order successful: ONDO/USDT:USDT sell 15.61 5x at price 0.8245 id 1790785485511282688
[2024/05/15][17:15:01]
[2024/05/15][17:15:01] ALERT: [[email protected]](mailto:[email protected]) ONDOUSDT sell 14.2@ x5
[2024/05/15][17:15:01] ----------------------------
[2024/05/15][17:15:03] * W: Cannot change position mode while a position is open
[2024/05/15][17:15:05] * Order successful: ONDO/USDT:USDT sell 14.2 5x at price 0.8376 id 1790793029382262784

Maybe I should try to reproduce the issue and screen what happens exactly.
Don't hesitate if you need more input (I'm not an expert).

from whook.

germangar avatar germangar commented on September 23, 2024

Yes the error is saying it can't set the position mode to oneway when a position is opened. It shouldn't be trying to do it. It should already know it's in oneway and not even try.

You can get this warning if you had a position opened manually in hedged before you start the script, but if there was none or if it was already in oneway it shouldn't be saying anything.

In any case it shouldn't affect the behavior.

from whook.

germangar avatar germangar commented on September 23, 2024

I'm unable to reproduce this one. The warning is not showing up:

 * Listening
 * Serving Flask app 'main'   
 * Debug mode: off
02:40:11 [bingx/bingx]  
02:40:11 [bingx/bingx]  ALERT: ATOMUSDT bingx pos -3$ x20
02:40:11 [bingx/bingx] ----------------------------      
02:40:14 [bingx/bingx]  * Order successful: ATOM/USDT:USDT sell 6.9 20x at price 8.686 id 1795253714899124224
------------------------------
  1 positions found.
  ATOM/USDT:USDT * isolated:20x * short * 6.9 * 2.9974[$] * 0.01[$] * 0.32%
------------------------------
02:40:38 [bingx/bingx]  
02:40:38 [bingx/bingx]  ALERT: ATOMUSDT bingx pos -6$ x20
02:40:38 [bingx/bingx] ----------------------------      
02:40:41 [bingx/bingx]  * Order successful: ATOM/USDT:USDT sell 6.92 20x at price 8.682 id 1795253824613728256
------------------------------
  1 positions found.
  ATOM/USDT:USDT * isolated:20x * short * 13.82 * 5.9996[$] * 0.02[$] * 0.30%
------------------------------
02:42:11 [bingx/bingx]  
02:42:11 [bingx/bingx]  ALERT: ATOMUSDT bingx sell 3$ x20
02:42:11 [bingx/bingx] ----------------------------      
02:42:13 [bingx/bingx]  * Order successful: ATOM/USDT:USDT sell 6.9 20x at price 8.687 id 1795254211156590592
------------------------------
  1 positions found.
  ATOM/USDT:USDT * isolated:20x * short * 20.72 * 8.9966[$] * -0.07[$] * -0.73%
------------------------------
02:44:05 [bingx/bingx]  
02:44:05 [bingx/bingx]  ALERT: ATOMUSDT bingx buy 3$ x20
02:44:05 [bingx/bingx] ----------------------------
02:44:07 [bingx/bingx]  * Order successful: ATOM/USDT:USDT buy 6.91 20x at price 8.678 id 1795254692478140416
------------------------------
  1 positions found.
  ATOM/USDT:USDT * isolated:20x * short * 13.81 * 5.9963[$] * 0.09[$] * 1.42%
------------------------------
02:48:51 [bingx/bingx]  
02:48:51 [bingx/bingx]  ALERT: ATOMUSDT bingx buy 3$ x20
02:48:51 [bingx/bingx] ----------------------------     
02:48:53 [bingx/bingx]  * Order successful: ATOM/USDT:USDT buy 6.92 20x at price 8.66 id 1795255891818397696
------------------------------
  1 positions found.
  ATOM/USDT:USDT * isolated:20x * short * 6.89 * 2.9916[$] * 0.17[$] * 5.61%
------------------------------

I tested it with the lastest version of ccxt. Maybe try updating the module.

from whook.

iZnogoude avatar iZnogoude commented on September 23, 2024

Hello there !
I had the issue again, but I have noticed something.
first, I start my bot when the margin mode was set up to crossed in my exange interface and I din't had the issue because, I think, the whook margin mode was set up to crossed aswell.

Then, I close this position and restart the bot but the difference is that on my exange interface it's set up on limited now. And I had the message again. So maby it's an issue with bingx with one the latest release of the whook.

I'm struggling a little bit with the update of ccxt, but I will let you know when done.

from whook.

iZnogoude avatar iZnogoude commented on September 23, 2024

I had the issue again even if the martgin mode is the same on the exange interface :

The first order is ok
The two buy orders hapens next had the correct behavior on the exange.
The the five sell order has created a new position "short" instead selling on my long position.

So in result I have a long an a short
image

This is the order history (there is 2 hours difference of my whook server)
image
he should close long instead of opening short

[2024/06/03][15:15:01]  ALERT: [email protected] ONDO/USDT:USDT buy 158.4@ x4
[2024/06/03][15:15:01] ----------------------------
[2024/06/03][15:15:03]  * Order successful: ONDO/USDT:USDT buy 158.4 4x at price 1.377 id 1797648193619709953
[2024/06/03][16:45:00]  
[2024/06/03][16:45:00]  ALERT: [email protected] ONDO/USDT:USDT buy 10.52@ x4
[2024/06/03][16:45:00] ----------------------------
[2024/06/03][16:45:01]  * W: Cannot change position mode while a position is open
[2024/06/03][16:45:03]  * Order successful: ONDO/USDT:USDT buy 10.52 4x at price 1.3713 id 1797670844341899264
[2024/06/03][19:30:03]  
[2024/06/03][19:30:03]  ALERT: [email protected] ONDO/USDT:USDT buy 10.39@ x4
[2024/06/03][19:30:03] ----------------------------
[2024/06/03][19:30:05]  * W: Cannot change position mode while a position is open
[2024/06/03][19:30:06]  * Order successful: ONDO/USDT:USDT buy 10.39 4x at price 1.3548 id 1797712378013634560
[2024/06/04][00:15:00]  
[2024/06/04][00:15:00]  ALERT: [email protected] ONDO/USDT:USDT sell 10.39@ x4
[2024/06/04][00:15:00] ----------------------------
[2024/06/04][00:15:01]  * W: Cannot change position mode while a position is open
[2024/06/04][00:15:02]  * Order successful: ONDO/USDT:USDT sell 10.39 4x at price 1.3792 id 1797784083792875520
[2024/06/04][00:30:01]  
[2024/06/04][00:30:01]  ALERT: [email protected] ONDO/USDT:USDT sell 10.52@ x4
[2024/06/04][00:30:01] ----------------------------
[2024/06/04][00:30:03]  * W: Cannot change position mode while a position is open
[2024/06/04][00:30:04]  * Order successful: ONDO/USDT:USDT sell 10.52 4x at price 1.3859 id 1797787867529039872
[2024/06/04][01:00:07]  
[2024/06/04][01:00:07]  ALERT: [email protected] ONDO/USDT:USDT sell 10.56@ x4
[2024/06/04][01:00:07] ----------------------------
[2024/06/04][01:00:07]  * W: Cannot change position mode while a position is open
[2024/06/04][01:00:08]  * Order successful: ONDO/USDT:USDT sell 10.56 4x at price 1.4014 id 1797795435961864192
[2024/06/04][01:15:00]  
[2024/06/04][01:15:00]  ALERT: [email protected] ONDO/USDT:USDT sell 10.56@ x4
[2024/06/04][01:15:00] ----------------------------
[2024/06/04][01:15:00]  * W: Cannot change position mode while a position is open
[2024/06/04][01:15:02]  * Order successful: ONDO/USDT:USDT sell 10.56 4x at price 1.4198 id 1797799182863650816
[2024/06/04][01:45:00]  
[2024/06/04][01:45:00]  ALERT: [email protected] ONDO/USDT:USDT sell 10.56@ x4
[2024/06/04][01:45:00] ----------------------------
[2024/06/04][01:45:01]  * W: Cannot change position mode while a position is open
[2024/06/04][01:45:02]  * Order successful: ONDO/USDT:USDT sell 10.56 4x at price 1.432 id 1797806735655915520

First of all I will try to update to last release of whook, if it's not good, I will reinstall previous release that was working.
If you have any idea, please let me know :-)

from whook.

iZnogoude avatar iZnogoude commented on September 23, 2024

Last update!
A friend of mine tell me to check is my exange was not set up to hedge mode.... and he was right. But I never change to hedge mode....So, I will change to one-dide mode and check again.
Maby there is something in the main.py that's tell the exange to switch to hedge mode? That would be curious.

from whook.

germangar avatar germangar commented on September 23, 2024

Hmm... whook should change it to oneway mode as long as a position wasn't previously open in hedge mode. Something is misbehaving, but I can't figure out what.

I'll test setting the website to hedge and checking if whook fails to set it to oneway when I have a moment. But I'd swear I already did this the other day.

from whook.

germangar avatar germangar commented on September 23, 2024

Oh. ok. In Bingx (from the website) I can't change the position mode for only one coin. I have to close all positions on every coin to change it to hedged. So, I can't test it right now. I have a couple of positions open and it will take a couple of days to close them all.

from whook.

germangar avatar germangar commented on September 23, 2024

Ok. Having no position open in any symbol I tested it. I set the website to this:

image

And I place the order:

20:40:22 [bingx/bingx]  
20:40:22 [bingx/bingx]  ALERT: bingx BTCUSDT pos -3$ x30
20:40:22 [bingx/bingx] ----------------------------     
20:40:25 [bingx/bingx]  * Order successful: BTC/USDT:USDT sell 0.0012 30x at price 69454.2 id 1799511821602996224
------------------------------
  1 positions found.
  BTC/USDT:USDT * isolated:30x * short * 0.0012 * 2.7782[$] * 0.00[$] * 0.02%
------------------------------

This hasn't changed in the website. It's saying the same
image

But on the position it's looking correct:
image

So I added a second sell on top, and opened a second position in another coin:

20:46:00 [bingx/bingx]  
20:46:00 [bingx/bingx]  ALERT: bingx BTCUSDT pos -4$ x30
20:46:00 [bingx/bingx] ----------------------------
20:46:02 [bingx/bingx]  * Order successful: BTC/USDT:USDT sell 0.0005 30x at price 69446.3 id 1799513234609487872
------------------------------
  1 positions found.
  BTC/USDT:USDT * isolated:30x * short * 0.0017 * 3.9356[$] * 0.01[$] * 0.25%
------------------------------
20:58:16 [bingx/bingx]  
20:58:16 [bingx/bingx]  ALERT: bingx LDOUSDT pos -2$ x20
20:58:16 [bingx/bingx] ----------------------------
20:58:18 [bingx/bingx]  * Order successful: LDO/USDT:USDT sell 20.6 20x at price 1.933 id 1799516323311730688
------------------------------
  2 positions found.
  LDO/USDT:USDT * isolated:20x * short * 20.0 * 1.9325[$] * -0.01[$] * -0.48%
  BTC/USDT:USDT * isolated:30x * short * 0.0017 * 3.9356[$] * -0.01[$] * -0.26%
------------------------------

And it's still looking fine.

So I refreshed the website and it is now showing the correct position mode
image

Everything seems to be working correctly.

from whook.

germangar avatar germangar commented on September 23, 2024

I'm thinking a possible reason for the issue is this:

Whook only refreshes the position information when making an order or every 5 minutes. If you close a position from the website whook may spend the next 4 or 5 minutes thinking the position still exists. So if you had a position in hedged, closed it and quickly made a new order through Whook, it may still think it can't change position mode because it still has the information of the closed position.

The solution is to restart the script or to wait the 5 minutes.

Edit: Another solution is to open the webhook address (the same one you use for the alerts) from a web browser. It will show the positions in the browser which will force a refresh.

from whook.

iZnogoude avatar iZnogoude commented on September 23, 2024

I guess I think the issue was that I had a position opened on hedge mode when I start the bot. That's why I had the error message. I have to try without any opened positions.
I will keep you updated.

from whook.

germangar avatar germangar commented on September 23, 2024

What I do is to create a subaccount for the bots. That way I have the main account for my manual operations.

But Bingx has the creation of subaccounts temporary disabled, so no luck with this one.

from whook.

Related Issues (15)

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.