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

Order flag issue #347

Open
fotto412 opened this issue Apr 17, 2024 · 2 comments
Open

Order flag issue #347

fotto412 opened this issue Apr 17, 2024 · 2 comments

Comments

@fotto412
Copy link

I get following error when trying to creat LIMIT ORDER with POS_CLOSE flag:

01:33:16.742 [ tyrus-jdk-client-52] ERROR com.github.jnidzwetzki.bitfinex.v2.callback.channel.AccountInfoHandler - Got error message: [1713393193690,"on-req",null,null,[null,4711,1713393194482,"tNEOUSD",null,null,-4.45419698554374,null,"LIMIT",null,null,null,512,null,null,null,17.748,null,0,17.872236,null,null,null,0,0,null,null,null,null,null,null,null],null,"ERROR","pos_close: invalid"]
01:33:16.743 [ tyrus-jdk-client-52] ERROR com.github.jnidzwetzki.bitfinex.v2.callback.channel.account.info.NotificationHandler - State for order null is ERROR, reason is pos_close: invalid

@wgolyakov
Copy link
Contributor

I experimented a bit with the POS_CLOSE flag.

  1. The error "pos_close: invalid" occurs if there is no position or the amount is wrong.
    Amount should be the same as in the position, but with the opposite sign.

  2. LIMIT order causes error "RSN_ORD_TYPE was: ACTIVE (note:POSCLOSE)".
    Apparently POS_CLOSE is not supported by LIMIT orders. But MARKET order works.

Working example:

BitfinexOrder order = BitfinexOrderBuilder.create(pair, BitfinexOrderType.MARKET, -amount).
        withOrderFlag(BitfinexOrderFlag.POS_CLOSE).build();
client.getOrderManager().placeOrder(order);

@fotto412
Copy link
Author

fotto412 commented Apr 21, 2024 via email

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

No branches or pull requests

2 participants