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

Cannot add TrailingStopLimit Order #114

Open
Toradar opened this issue Aug 25, 2024 · 1 comment
Open

Cannot add TrailingStopLimit Order #114

Toradar opened this issue Aug 25, 2024 · 1 comment

Comments

@Toradar
Copy link

Toradar commented Aug 25, 2024

Describe the bug
The price/secondaryPrice can only be passed as decimal, but Kraken requires a prefix in the price field input for Trailing Stop/Trailing Stop Limit orders, which is optional for other order types. Although the Trailing Stop/Trailing Stop Limit orders are supported, there is no no option to set a prefix.

To Reproduce
Place an Order of type TrailingStop or TrailingStopLimit, e.g.

var order = await _krakenRestClient.SpotApi.Trading.PlaceOrderAsync(
symbol: "XETHZEUR",
type: OrderType.TrailingStopLimit,
side: OrderSide.Buy,
quantity: 0.04,
price: 24.78, // Trailing offset, Kraken expects the "+" or "%" prefix
secondaryPrice: 23.544 // Trailing Limit order offset, Kraken expects the "+" or "%" prefix
);

Expected behavior
The Order can be placed.

Debug logging
Request Body: nonce=638602247173715770&ordertype=trailing-stop-limit&pair=ETH%2fEUR&price=24.78&price2=23.544&trading_agreement=agree&type=buy&volume=0.04

ErrorMessage: EGeneral:Invalid arguments:price

According to https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder:

Trailing Stops: Must use a relative price for this field, namely the + prefix, from which the direction will be automatic based on if the original order is a buy or sell (no need to use - or #). The % suffix also works for these order types to use a relative percentage price.

Repository owner deleted a comment Aug 27, 2024
@JKorf
Copy link
Owner

JKorf commented Aug 28, 2024

Hi, you're right. It a bit of a pain as I'd like to take the price field types a decimal type, but then you can't specify the '+' or '%' signs as you found.
In the latest version I've added the pricePrefixOperator, priceSuffixOperator, secondaryPricePrefixOperator and secondaryPriceSuffixOperator parameters to PlaceOrderAsync so you can specify them manually as sort of a workaround.

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