-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Phemex: short trade not recognizable (fetchMyTrades) - sides switched #22512
Comments
Hello @egabosh, Just to make sure I understood, are you saying that if you made a |
Moin @carlosmiei, not quite. Sorry, I'll try to describe it again in more detail: If I invest in a short position (buy), then Phemex sets “side”: “2”, which is interpreted by CCXT as “sell”. Short is basically an inverse long. This therefore makes sense in terms of Phemex logic. This does not seem to be taken into account in the CCXT processed output. It would only be important for me to be able to recognize in the CCXT output whether it is a short or long trade, as otherwise misinterpretations would occur. So currently the output of CCXT is incorrect because it is incomplete. |
@egabosh This is confusing me a bit
Upon trading futures, we don't say we bought a short, we say you sold/shorted X amount of the Y contract, so usually we don't mix buy+short terminology |
The posSide in that case can be used for inferring if the trade increased/reduced the exposure of the position, but the side should still be |
Yes, exactly. It would only be important to know whether the trade is a short or a long trade. |
@egabosh I'm afraid that information does not belong to |
@egabosh That information should be available as you intend inside the |
@carlosmiei OK. but then should the the side in CCXT be switched from "buy" to "sell" and "sell" to "buy" if Phemex posSide is 2 I think. |
@egabosh Now that I'm thinking, not sure if even in Besides that, upon placing the order, depending on the positionMode you know in advance if the order will impact the short/long leg, if you're in the one-way mode you can use things like |
@carlosmiei Ah. I'll give it some more thought but the more I think about it, I think you're right. |
@egabosh No problem let us know if anything! |
@carlosmiei: Didn't find the Information in any order got by fetch_orders() interpreted by CCXT too (only information is posSide from Phemex. Example:
|
Operating System
Debian 12
Programming Languages
Python
CCXT Version
4.3.23
Description
Moin,
a “short” trade via fetchMyTrades() is not recognizable for me in the CCXT prepared output.
Compared to “long” trades, only the “side” seems to be reversed.
For a long buy the side is “buy” and for a short buy the side is “sell”
This may be logical if it is a short trade, as the bet is on falling prices
However, it is not obvious that it is a short trade.
In the output from Phemex, a short or long trade seems to be recognizable by the “posSide”. (if posSide is 1= Long-Trade - if posSide is 2 = Short Trade).
However, this information does not appear to be evaluated by CCXT but only side.
Long buy (CCXT-side buy - Phemex: "side": "1"; "posSide": "1")
Short buy (CCXT-side sell - Phemex: "side": "2"; "posSide": "2")
Long sell (CCXT-side sell - Phemex: "side": "2"; "posSide": "1")
Short sell (CCXT-side buy - Phemex: "side": "1"; "posSide": "2")
So for short trades posSide always seems to be 2 and for long trades 1.
Please provide a fix that takes into account whether it is a short or long trade by evaluating posSide from Phemex.
As it currently stands, you get the wrong results if you only pay attention to the CCXT processed output.
Thank you very much
Code
The text was updated successfully, but these errors were encountered: