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

Kraken - Endpoint fixes #848

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/ExchangeSharp/API/Exchanges/Kraken/ExchangeKrakenAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ string path
JToken result = await MakeJsonRequestAsync<JToken>(
path,
null,
await GetNoncePayloadAsync()
await GetNoncePayloadAsync(),
"POST"
);
result = result["open"];
if (exchangeSymbolToNormalizedSymbol.TryGetValue(symbol, out string normalizedSymbol))
Expand Down Expand Up @@ -445,7 +446,8 @@ string path
JToken result = await MakeJsonRequestAsync<JToken>(
path,
null,
await GetNoncePayloadAsync()
await GetNoncePayloadAsync(),
"POST"
);
result = result["trades"];
if (exchangeSymbolToNormalizedSymbol.TryGetValue(symbol, out string normalizedSymbol))
Expand Down Expand Up @@ -923,7 +925,8 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAsync()
JToken result = await MakeJsonRequestAsync<JToken>(
"/0/private/Balance",
null,
await GetNoncePayloadAsync()
await GetNoncePayloadAsync(),
"POST"
);
Dictionary<string, decimal> balances = new Dictionary<string, decimal>(
StringComparer.OrdinalIgnoreCase
Expand All @@ -946,7 +949,8 @@ protected override async Task<
JToken result = await MakeJsonRequestAsync<JToken>(
"/0/private/TradeBalance",
null,
await GetNoncePayloadAsync()
await GetNoncePayloadAsync(),
"POST"
);
Dictionary<string, decimal> balances = new Dictionary<string, decimal>();
foreach (JProperty prop in result)
Expand Down Expand Up @@ -978,7 +982,6 @@ ExchangeOrderRequest order
{ "type", (order.IsBuy ? "buy" : "sell") },
{ "ordertype", order.OrderType.ToString().ToLowerInvariant() },
{ "volume", order.RoundAmount().ToStringInvariant() },
{ "trading_agreement", "agree" },
{ "nonce", nonce }
};
if (order.OrderType != OrderType.Market)
Expand All @@ -994,7 +997,7 @@ ExchangeOrderRequest order
payload["oflags"] = "post"; // post-only order (available when ordertype = limit)
order.ExtraParameters.CopyTo(payload);

JToken token = await MakeJsonRequestAsync<JToken>("/0/private/AddOrder", null, payload);
JToken token = await MakeJsonRequestAsync<JToken>("/0/private/AddOrder", null, payload, "POST");
ExchangeOrderResult result = new ExchangeOrderResult
{
OrderDate = CryptoUtility.UtcNow,
Expand Down Expand Up @@ -1039,7 +1042,8 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(
JToken result = await MakeJsonRequestAsync<JToken>(
"/0/private/QueryOrders",
null,
payload
payload,
"POST"
);
ExchangeOrderResult orderResult = new ExchangeOrderResult { OrderId = orderId };
if (result == null || result[orderId] == null)
Expand Down Expand Up @@ -1115,7 +1119,7 @@ protected override async Task OnCancelOrderAsync(
{ "txid", orderId },
{ "nonce", nonce }
};
await MakeJsonRequestAsync<JToken>("/0/private/CancelOrder", null, payload);
await MakeJsonRequestAsync<JToken>("/0/private/CancelOrder", null, payload, "POST");
}

private async Task<string> GetWebsocketToken()
Expand All @@ -1132,7 +1136,8 @@ private async Task<string> GetWebsocketToken()
JToken token = await MakeJsonRequestAsync<JToken>(
"/0/private/GetWebSocketsToken",
null,
payload
payload,
"POST"
);

return token["token"].ToString();
Expand Down
Loading