Open fotto412 opened 4 months ago
I experimented a bit with the POS_CLOSE flag.
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.
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);
Great! But if there is already a buy(long) position as market order, your req supposed to close it. In api documentation it says that that flag closes any existing position of that pair. Your case looks exactly like closing a buy position with a post only order. May be I am wrong. Cheers, Devrim
On Sun, Apr 21, 2024 at 12:27 PM Vladimir Golyakov @.***> wrote:
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);
— Reply to this email directly, view it on GitHub https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/issues/347#issuecomment-2067976211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG4QU5LIAYSZQCGC7IFU5P3Y6OBABAVCNFSM6AAAAABGMFCCL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXHE3TMMRRGE . You are receiving this because you authored the thread.Message ID: @.***>
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