Skip to content

Commit 1ad6baa

Browse files
authored
Kraken - Endpoint fixes (DigitalRuby#848)
* Fix Kraken * Set method to "POST" for private methods
1 parent 6148be2 commit 1ad6baa

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/ExchangeSharp/API/Exchanges/Kraken/ExchangeKrakenAPI.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ string path
376376
JToken result = await MakeJsonRequestAsync<JToken>(
377377
path,
378378
null,
379-
await GetNoncePayloadAsync()
379+
await GetNoncePayloadAsync(),
380+
"POST"
380381
);
381382
result = result["open"];
382383
if (exchangeSymbolToNormalizedSymbol.TryGetValue(symbol, out string normalizedSymbol))
@@ -445,7 +446,8 @@ string path
445446
JToken result = await MakeJsonRequestAsync<JToken>(
446447
path,
447448
null,
448-
await GetNoncePayloadAsync()
449+
await GetNoncePayloadAsync(),
450+
"POST"
449451
);
450452
result = result["trades"];
451453
if (exchangeSymbolToNormalizedSymbol.TryGetValue(symbol, out string normalizedSymbol))
@@ -923,7 +925,8 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAsync()
923925
JToken result = await MakeJsonRequestAsync<JToken>(
924926
"/0/private/Balance",
925927
null,
926-
await GetNoncePayloadAsync()
928+
await GetNoncePayloadAsync(),
929+
"POST"
927930
);
928931
Dictionary<string, decimal> balances = new Dictionary<string, decimal>(
929932
StringComparer.OrdinalIgnoreCase
@@ -946,7 +949,8 @@ protected override async Task<
946949
JToken result = await MakeJsonRequestAsync<JToken>(
947950
"/0/private/TradeBalance",
948951
null,
949-
await GetNoncePayloadAsync()
952+
await GetNoncePayloadAsync(),
953+
"POST"
950954
);
951955
Dictionary<string, decimal> balances = new Dictionary<string, decimal>();
952956
foreach (JProperty prop in result)
@@ -978,7 +982,6 @@ ExchangeOrderRequest order
978982
{ "type", (order.IsBuy ? "buy" : "sell") },
979983
{ "ordertype", order.OrderType.ToString().ToLowerInvariant() },
980984
{ "volume", order.RoundAmount().ToStringInvariant() },
981-
{ "trading_agreement", "agree" },
982985
{ "nonce", nonce }
983986
};
984987
if (order.OrderType != OrderType.Market)
@@ -994,7 +997,7 @@ ExchangeOrderRequest order
994997
payload["oflags"] = "post"; // post-only order (available when ordertype = limit)
995998
order.ExtraParameters.CopyTo(payload);
996999

997-
JToken token = await MakeJsonRequestAsync<JToken>("/0/private/AddOrder", null, payload);
1000+
JToken token = await MakeJsonRequestAsync<JToken>("/0/private/AddOrder", null, payload, "POST");
9981001
ExchangeOrderResult result = new ExchangeOrderResult
9991002
{
10001003
OrderDate = CryptoUtility.UtcNow,
@@ -1039,7 +1042,8 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(
10391042
JToken result = await MakeJsonRequestAsync<JToken>(
10401043
"/0/private/QueryOrders",
10411044
null,
1042-
payload
1045+
payload,
1046+
"POST"
10431047
);
10441048
ExchangeOrderResult orderResult = new ExchangeOrderResult { OrderId = orderId };
10451049
if (result == null || result[orderId] == null)
@@ -1115,7 +1119,7 @@ protected override async Task OnCancelOrderAsync(
11151119
{ "txid", orderId },
11161120
{ "nonce", nonce }
11171121
};
1118-
await MakeJsonRequestAsync<JToken>("/0/private/CancelOrder", null, payload);
1122+
await MakeJsonRequestAsync<JToken>("/0/private/CancelOrder", null, payload, "POST");
11191123
}
11201124

11211125
private async Task<string> GetWebsocketToken()
@@ -1132,7 +1136,8 @@ private async Task<string> GetWebsocketToken()
11321136
JToken token = await MakeJsonRequestAsync<JToken>(
11331137
"/0/private/GetWebSocketsToken",
11341138
null,
1135-
payload
1139+
payload,
1140+
"POST"
11361141
);
11371142

11381143
return token["token"].ToString();

0 commit comments

Comments
 (0)