Git Product home page Git Product logo

jkorf / kraken.net Goto Github PK

View Code? Open in Web Editor NEW
97.0 14.0 51.0 4.61 MB

A C# .netstandard client library for the Kraken REST and Websocket Spot and Futures API focusing on clear usage and models

Home Page: https://jkorf.github.io/Kraken.Net/

License: MIT License

C# 100.00%
crypto cryptocurrencies cryptocurrency cryptocurrency-exchanges cryptocurrency-prices kraken kraken-api kraken-bot kraken-exchange kraken-exchange-api

kraken.net's People

Contributors

burakoner avatar cdesplanches avatar d-ugarov avatar dmytro-his avatar imdbere avatar jkorf avatar jkorf-bloemert avatar jonasbud avatar khanuri avatar la4atld avatar mclean25 avatar michielpost avatar ridicoulous avatar shigengyu avatar tomasmichal avatar tometchy avatar trekco avatar vcsjones avatar viktoroshkalo avatar viktorrr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kraken.net's Issues

Multithreading Support

Describe the bug
When using Kraken.Net with multiple threads the System.AggregateException: One or more errors occurred. (Unknown error (0xc1000008)) error is generated during hashing.

To Reproduce
This can be reproduced by making REST calls to file orders or get order status using the same instance from multiple threads.

Expected behavior
I would have expected these calls to work on independent threads because each thread isn't making calls about the same order.

Debug logging
Narrowed the code to reproduce down to here and found the same use in Kraken.Net: dotnet/runtime#61417 (comment)

WebSocket API "PlaceOrder" : StartTime/ExpireTime parameters are not working

When using WebSocket API "PlaceOrder" with StartTime/ExpireTime parameters, the server returns an error because he is waiting for a string, not a DateTime.
The same parameters with REST API are working well.

Suggestion for correction (maybe there is something more elegant)

In KrakenSocketPlaceOrderRequest, change 2 properties like this :

        [JsonProperty("starttm")]
        public string? StartTime { get; set; }
        [JsonProperty("expiretm")]
        public string? ExpireTime { get; set; }

In KrakenSocketClientSpotStreams.cs, in PlaceOrderAsync method, change the assignation for theses properties :

                StartTime = startTime.HasValue ? ((uint)startTime.Value.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() : null,
                ExpireTime = expireTime.HasValue ? ((uint)expireTime.Value.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() : null,

Invalid Arguments when placing an order

When i'm placing an order using this function:


       static void CreateOrder_SellBTC(decimal sellprice, decimal btc_sellamount)
        {
            KrakenClientOptions APIoptions = new KrakenClientOptions();
            APIoptions.ApiCredentials = new ApiCredentials(ticker_timer.krakenKey, ticker_timer.krakenSecret);
            KrakenClient ApiClient = new KrakenClient(APIoptions);

            string market = "XXBTZEUR";
            var sell = Kraken.Net.Objects.OrderSide.Sell;
            var ordertype = Kraken.Net.Objects.OrderType.Limit;
            uint? orderID = null;
            decimal? secondary_price = null;
            decimal? leverage = null;
            DateTime? start_time = null;
            DateTime? expire_time = null;
            bool? validate_only = null; 

            var placeorder = ApiClient.PlaceOrder(market, sell, ordertype, btc_sellamount, orderID, sellprice, secondary_price, leverage, start_time, expire_time, validate_only);
        }

I'm getting

{3: Server error: EGeneral:Invalid arguments:type}

as an error.

I'm not sure what to change, i'm not sure if it's a bug or i'm in the wrong.

Thanks in advance, and loving your API wrapper.

Unsubscribing Trade and Order updates doesn't work

SubscribeToOwnTradeUpdates
SubscribeToOrderUpdates

The close method on the subscription object returned from the above methods results in a channel not found error. The channel always seems to be 0 as well. Calling close on the price updates subscription works fine (the channel is not 0 on those subscriptions)

GetKLines/GetKLinesAsync doesn't interpret Since parameter

Describe the bug
When I call GetKLines with the current date I get an array of values as expected. If I call GetKLines for the time of an order that has completed I still get an array of values based on the time I made the call, not the date/time passed.

To Reproduce
To reproduce, compare the results of these two calls:

Dim SourceMarketKlinesNow As WebCallResult(Of Converters.KrakenKlinesResult) = pClient.GetKlines("XXBTZUSC", KlineInterval.OneMinute, Now.ToUniversalTime)
Dim SourceMarketKlinesPast As WebCallResult(Of Converters.KrakenKlinesResult) = pClient.GetKlines("XXBTZUSC", KlineInterval.OneMinute, New DateTime(2021, 25, 7, 12, 33, 41))

The results will be the same.

Expected behavior
I expect the call with the Since parameter specified with date/time in the past to return at least one array item for that minute.

SecondaryPrice in PlaceOrderAsync should use CultureInfo.InvariantCulture in ToString conversion

Describe the bug
SecondaryPrice conversion to string is also dependant on regional settings, so we should pass CultureInfo.InvariantCulture for the ToString function parameter

To Reproduce
Code review and every call to PlaceOrderAsync using the secondary price parameter will fail for all country where decimal limiter is not a '.'

Expected behavior
Should not fail and order should be placed.

Receiving messages in wrong handler

When subscribed to a marketdepth update for "ETH/USD", "BTC/USD", "ETC/ETH").
You can receive an update for some market in the wrong handler. (BTC/USD in ETC/ETH handler).
I created a small demo project to reproduce this behavior:
Demo-project

My Thought: Value ChanelId for updating BTC/USD depth [is 0] that is equal to a default of int value.

Invalid Nonce

Ive just started implemting an interface to kraken api using your library.
The public calls to api, ive tried are working. But when I try to call private api functions, ill get invalid Nonce error.

"EAPI:Invalid nonce"

The provided keys are valid, i have also installed Net Time to ensure time synchronisation.

Is it possible to configure the receive window paramater?
Thanks a lot , your help is much appreciated.
Best Marko

Implementation of the new BalanceEx REST request

Hi,

is there a plan to implement the new Kraken BalanceEx REST request ?

i.e. (calling via the cmd line tool)

$ ./krakenapi BalanceEx

{"error":[],"result":{"ZUSD":{"balance":"21.9050","hold_trade":"17.2000"},"ZEUR":{"balance":"0.0203","hold_trade":"0.0000"},"KFEE":{"balance":"7328.19","hold_trade":"0.00"},"XXBT":{"balance":"0.0000000030","hold_trade":"0.0000000000"},"XETH":{"balance":"0.0000000000","hold_trade":"0.0000000000"}}}

Can't subscribe to OrderBook (socket client)

Describe the bug
Hello, following the issue I have with Bitfinex, I tried to perform the same kind of logic with the Kraken implementation.
Unfortunately I can't subscribe to any order book, and two exceptions are thrown Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll (same exception for both).

To Reproduce
Reuse the same code logic as what I did in my Bitfinex issue, i.e. create a KrakenClient (tested with or without api keys/secret), a KrakenSocketClient and a KrakenOrderBookOptions.
Create a KrakenSymbolOrderBook and subscribe to a Symbol (i.e. for instance BTCEUR).
The code is exactly the same as what I provided in the Bitfinex issue, just replacing all the Bitfinex classes by their Kraken equivalent

Expected behavior
The order book should be subscribed

Debug logging
Setting the Verbosity to Trace or Debug provides the same results:

2021/08/20 11:08:49:275 | Information | Kraken | Kraken order book BTCEUR status changed: Disconnected => Connecting
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll

CancelOrder WebSocket doesn't return error message

Actually "CancelOrder" in WebSocket API doesn't return error message, just a boolean (success or not). It could be useful to get the message especially for catching the "Unknown order" error message, and it would be more consistent with REST API.

I suggest the following modification in KrakenSocketClientSpotStreams.cs :


public Task<CallResult<KrakenSocketResponseBase>> CancelOrderAsync(string websocketToken, string orderId)
            => CancelOrdersAsync(websocketToken, new[] { orderId });

public async Task<CallResult<KrakenSocketResponseBase>> CancelOrdersAsync(string websocketToken, IEnumerable<string> orderIds)
        {
            var request = new KrakenSocketCancelOrdersRequest
            {
                Event = "cancelOrder",
                OrderIds = orderIds,
                Token = websocketToken,
                RequestId = _baseClient.NextIdInternal()
            };
            return await _baseClient.QueryInternalAsync<KrakenSocketResponseBase>(this, _authBaseAddress, request, false).ConfigureAwait(false);
        }

Subscribing to a List of Pairs in the socket does not work.

Describe the bug
Subscribing to a List of Pairs in the socket does not work. It strangely gets one callback from the socket then stops to work

To Reproduce

var krakenSymbols = new List<string> { "BTC/USDT", "ETH/USDT", "LTC/USDT", "XRP/USDT" };
_krakenSocketClient.SubscribeToTickerUpdatesAsync(krakenSymbols.ToArray(), onMessage);

Expected behavior
The socket keeps open retrieven the prices updates

Work around
Open as many single sockets for each assets as necessary

missing enum/Ledger type

Describe the bug
Some ledger type are missing in the converter and ledgerentrytype enum, creating the code to crash :
"spend" "receive" "settled"

To Reproduce
Retrieve ledger of any type below. with method : GetLedgerInfoAsync

Expected behavior
handle those new/changed ledger type

Debug logging
GetLedgerInfoAsync

=>update following enum with new Ledger Type and the converter as well.
namespace Kraken.Net.Objects
public enum LedgerEntryType

Error : WaitingForActivation

Since KrakenExchange.Net upgrade to V3.05

when using this Dot.Net VB syntax :

    Dim KrakenClientObj = New KrakenClient(New Objects.KrakenClientOptions)
    KrakenClientObj.ClientOptions.ApiCredentials = ReadKrakenAPIcredentials()

    Dim AssetSymbolList As List(Of String) = New List(Of String)
    AssetSymbolList.Add("EUR")

    Dim AssetsInfo = KrakenClientObj.SpotApi.ExchangeData.GetAssetsAsync(AssetSymbolList)

I get Status = WaitingForActivation and nothing in AssetsInfo.Result.data
instead of expected result

This syntax was working with previous V3 version
Obviously ReadKrakenAPIcredentials function is returning valid Kraken API Credentials in ApiCredentials

Missing enum in Kraken.Net.Objects.LedgerEntryType

Found three missing Ledger "type": transfer, adjustment, and rollover.

I have modified LedgerEntryTypeConverter locally to confirm all 3 types. I have a feeling they do not maintain the documentation very well.

image

Method:
var history = await client.GetLedgerInfoAsync(resultOffset: offset);

Error #1
Cannot map enum. Type: Kraken.Net.Objects.LedgerEntryType, Value: adjustment

"LDSTHP-UO35K-KXKKJM": {
"refid": "LAYP6WA-ECW7A-S3MWLS",
"time": 1549990358.3277,
"type": "adjustment",
"aclass": "currency",
"asset": "XETH",
"amount": "0.0000000054",
"fee": "0.0000000000",
"balance": "0.0000000054"
},

Error #2
Cannot map enum. Type: Kraken.Net.Objects.LedgerEntryType, Value: transfer

"L3NFOL-7ZM44-EUC6HM": {
"refid": "LAAYEYA-ZXI7T-Y6C7TQ",
"time": 1542583842.8385,
"type": "transfer",
"aclass": "currency",
"asset": "BSV",
"amount": "0.0007546220",
"fee": "0.0000000000",
"balance": "0.0007546220"
},

Error #3
Cannot map enum. Type: Kraken.Net.Objects.LedgerEntryType, Value: rollover

"LTXJVD-Z6D4N-OW7VXI": {
"refid": "TX64AJ-X2FFM-22FEQG",
"time": 1484082682.0106,
"type": "rollover",
"aclass": "currency",
"asset": "ZUSD",
"amount": "0.0000",
"fee": "0.4580",
"balance": "657.2565"
}

Missing OrderType in OrderTypeConverter

An order type from Kraken JSON data shows "ordertype": "stop market", which looks to be missing from the converter.

Error:
Cannot map enum. Type: Kraken.Net.Objects.OrderType, Value: stop market
Exception thrown: 'System.NullReferenceException' in Newtonsoft.Json.dll

Method:
var history = await client.GetTradeHistoryAsync(resultOffset: offset);

"TDSUTH-DO3XV-V67G37": {
"ordertxid": "ODBUJA-CTRWB-YJSTLF",
"postxid": "T5XXXZ-KAHYB-W6RQKR",
"pair": "XXBTZUSD",
"time": 1483734622.6224,
"type": "sell",
"ordertype": "stop market",
"price": "877.55000",
"cost": "1652.37592",
"fee": "4.29618",
"vol": "1.88294218",
"margin": "550.79197",
"misc": "closing"
},

I can send full JSON if needed.

update to v3 api?

Hi
I see you use the old api v0. Do you update it to v3? or is this not necessary?

Checksum causes often reconnects

Hello,
While using Kraken.Net to receive depth book, we've observed often reconnects, what can also cause delays on data updates.
But another issue caused by these reconnects is blocking thread with no reason...
So, the question: is there any way to avoid the reconnecting on wrong checksum?
image

Error 'EAPI: Invalid Signature' when making private API calls

When trying to do private calls (in this case, get my trade balance), the following error always occurs:

2019-12-15 12:28:42:697 | Debug | Creating request for https://api.kraken.com/0/private/TradeBalance
2019-12-15 12:28:42:709 | Debug | Sending POST signed request to https://api.kraken.com/0/private/TradeBalance
Server error: EAPI:Invalid signature

I've checked and my private & public keys are set. I'm creating my client with these default options:

 KrakenClient.SetDefaultOptions(new KrakenClientOptions()
{
     ApiCredentials = new ApiCredentials(ApiKey, SecretKey),
}

Then try to get my trade balance:

WebCallResult<KrakenTradeBalance> accountInfo = client.GetTradeBalance(coin);

accountInfo then has the described error and with Success = false.
Maybe it's because I need to send an OTP or master password with it, but I can't see where to implement those. Public API calls work without problems. Not sure if this is a bug, or my clumsy programming.

Thanks in advance. Love the APIs!

Futures API support

Hi there,

I want to ask if you planning to add support for the futures API?

If not, I would do it then and propose a PR. My Idea would be to make this in a separate client class to have a clear separation.

ClientOrderId type inconsistency

Describe the bug
Kraken REST client GetOrderAsync(...) uses clientOrderId as "string?" while PlaceOrderAsync(...) uses clientOrderId as "uint". The KrakenOrder class has ClientOrderId property of yet another type "string" - but in this case it is probably intended as these are received data. But maybe the first two cases (and maybe there are other methods, I haven't check them all) could be unified.

Trading agreement required on german accounts

Hello,
There seems to be a strange policy on Kraken where on accounts in Germany,
an additional parameter is needed when calling the AddOrder endpoint.
See: https://support.kraken.com/hc/en-us/articles/360000920026-Trading-agreement-required-error

I think the only thing necessary to fix this would be to add a static trading_agreement = 'agree'
parameter to the PlaceOrderAsync method since i don't think that this would interfere with non-german accounts.
Thanks

GetTradeVolume throws a JsonSerialization exception

Bug description

GetTradeVolume fails to execute, on the Kraken REST client, throwing a JsonSerialization exception :
Deserialize JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Kraken.Net.Objects.KrakenFeeStruct]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.

To Reproduce

KrakenClient KrakenRestClient = new KrakenClient(clientOptions);
var tradeVolumeResult = KrakenRestClient.GetTradeVolume(null, default, "XXBTZEUR");
if (!tradeVolumeResult.Success)
{
  Console.Write(tradeVolumeResult.Error);
}

Expected behavior

The Fees and MakerFees properties of class KrakenTradeVolume should be serialized in a Dictionary instead of a IEnumerable. That's because a KrakenTradeVolume is returned for each provided pair (string).

public class KrakenTradeVolume
{
    public Dictionary<string, KrakenFeeStruct> Fees { get; set; } = new Dictionary<string, KrakenFeeStruct>();
    [JsonProperty("fees_maker")]
    public Dictionary<string, KrakenFeeStruct> MakerFees { get; set; } = new Dictionary<string, KrakenFeeStruct>();
}

I can contribute and fix the issue. Just let me know if you want my help :)

WebSocket API will implement real time notification of deposits to Kraken account

Hi,

Chad from Kraken support wrote me this :

In addition, our WebSocket API will shortly be upgraded to include an account balance feed, which could be used to receive a real time notification of deposits to your Kraken account, so perhaps this would be a suitable alternative to a web hook or call back. We expect the account balance feed to be released within the next few weeks.

Do you intend to implement this new feature ?

Thanks

Socket Message not handled error

Hello,

Describe the bug
I have a process that harvests Kline data from the Kraken exchange, and it works perfectly unless i try to use the XDG/USD ticker.
For that symbol, and thats symbol only I get the following error for all data returned.

2021/08/25 16:59:13:964 | Warning | Kraken | Socket 4 Message not handled: [
2366,
[
"1629907154.275121",
"1629936000.000000",
"0.303146700",
"0.333809100",
"0.276835600",
"0.292495000",
"0.310190394",
"467775624.66585413",
91917
],
"ohlc-10080",
"XDG/USD"
]

To Reproduce
I'm using the default endpoint, no authentication is required for SubscribeToKlineUpdatesAsync

Expected behavior
I would expect the data to be returned correctly, exactly as it is for all other pairs. I can only assume there is something about the data that is different to the other pairs. I am subscribing to 8 timeframes on 25 pairs. There are no errors returned during the subscription to XDG/USD.

Thanks.

AggregateException for valid T/EUR symbol

Hi,

I'm getting this exception:

System.AggregateException: 'One or more errors occurred. (T/EUR is not a valid Kraken websocket symbol. Should be [BaseAsset]/[QuoteAsset] in ISO 4217-A3 standardized names, e.g. ETH/XBTWebsocket names for pairs are returned in the GetSymbols method in the WebsocketName property.)'

when calling
KrakenClient.SpotStreams.SubscribeToTickerUpdatesAsync

and using the list of symbols retrieved using
KrakenRestClient.SpotApi.ExchangeData.GetSymbolsAsync

T/EUR is the record returned, a BaseAsset of T and a QuoteAsset of ZEUR. I'm guessing that this is a new pair recently added to the Kraken service, so maybe some work is required in the validator?

Many Thanks.

OHLC

Hello!

It looks like Kraken offers a way to get price history data via the following OHLC endpoint:

https://docs.kraken.com/rest/#operation/getOHLCData

Just wondering, is this data also available via this package?

I setup a simple test program with a client. Looking at the available methods on the client object, it wasn't clear to me which of these may be for the OHLC data:

image

Thanks!

Error: EGeneral:Invalid arguments:volume

I'm trying to test placing an order by calling the following code:
var order = kc.PlaceOrder("DOGEUSD", Objects.OrderSide.Buy, Objects.OrderType.Market, quantity: 10);

When I run the above, I get the error: Error: EGeneral:Invalid arguments:volume.

Can anyone help?

Thank you.

Add support for snapshot parameter to SubscribeToOwnTradeUpdatesAsync

Describe the bug
ownTrades socket subscription support a "snapshot" parameter to decide whether a snapshot should be sent on subscription.
Today this parameter is not supported by SubscribeToOwnTradeUpdatesAsync

To Reproduce
Code review

Expected behavior
Ability to decide to receive or not a snapshot on ownTrades subscription

Cannot create Take Profit Limit order

Describe the bug
Take Profit Limit order claims not enough available balance

To Reproduce

var ticker = await api.GetTickersAsync(BTCEUR)();
            var btcAskPrice = ticker.Data[BTCEUR].BestAsks.Price;

            var balances = await api.GetAvailableBalancesAsync()();
            var euros = GetBalance(balances.Data, EURO);
            var volume = euros / btcAskPrice;

            var percent = 1.5M;

            var sellPrice = Math.Round(btcAskPrice * (1 + (percent / 100)), 1);

           var order = await api.PlaceOrderAsync(
                BTCEUR, OrderSide.Buy,
                OrderType.TakeProfitLimit,
                volume,
                price: btcAskPrice,
                secondaryPrice: sellPrice,
                validateOnly: dryRun
                )();

        private static decimal GetBalance(Dictionary<string, KrakenBalanceAvailable> balances, string currency)
        {
            if (balances.TryGetValue(currency, out var balance))
            {
                return balance.Available;
            }

            return 0;
        }

Expected behavior
Order should be placed. When using a TakeProfit order with the same code, it is successful.

KrakenSocketClient, SubscribeToTickerUpdatesAsync doesn't work expected.

SubscribeToTickerUpdatesAsync take only one message.
SubscribeToTickerUpdatesAsync send only one data at all and stoped without any exception.

        KrakenSocketClient.SetDefaultOptions(new KrakenSocketClientOptions()
        {
            ApiCredentials = new ApiCredentials("KEY", "SECRET"),
            LogLevel = LogLevel.Debug,
            LogWriters = new List<ILogger> { new ConsoleLogger() }
        });

        var socketClient = new KrakenSocketClient();

        decimal lastBid = 0m;
        decimal lastAsk = 0m;

        socketClient.SubscribeToTickerUpdatesAsync("XRP/USDT", data =>
        {
            bool print = false;
            if (lastBid != data.Data.BestBids.Price)
            {

                lastBid = data.Data.BestBids.Price;
                print = true;
            }
            if (lastAsk != data.Data.BestAsks.Price)
            {
                lastAsk = data.Data.BestAsks.Price;
                print = true;
            }
            if (print)
                Console.WriteLine($"Ask {lastAsk:N4} - Bid {lastBid:N4}");
        });

        Console.ReadLine();
        socketClient.UnsubscribeAllAsync();

image

SymbolOrderBook does not Synchronize

I am using SymbolOrderBook on Bittrex and Binance but when using the same implementation with Kraken the OrderBook only transitions from Disconnected to Connecting. The trading pair call was successful so connectivity via client is ok (although socketClient used by SymbolOrderBook not proven). Is this a known issue/work in progress?

KrakenOrder traders

Hello,

Little mistake KrakenOrder.cs l.105 :
public IEnumerable < long > TradeIds { get; set; } = new List < long >();
to
public IEnumerable < string > TradeIds { get; set; } = new List < string > ();

Regards, Thanks !

Kraken Quote and Base Asset is reversed in ICommonSymbol

I think the CommonName should be reversed for kraken, or am I wrong?

    string ICommonSymbol.CommonName => QuoteAsset + BaseAsset;

If we take a look at the api:
"ETHUSDT":{"altname":"ETHUSDT","wsname":"ETH\/USDT","aclass_base":"currency","base":"XETH","aclass_quote":"currency","quote":"USDT", ... }

the quote is the second part of the pair.

Make all public methods of client and socketclient virtual

Feature request
Make all public/protected methods of client and socketclient virtual. I would like to override some methods to customize the clients. I can make a new client, but for small changes the inheritance would be preferable.

Edge case: Checksum when Order book update array has 5 elements

When the book feed message includes both asks and bid updates (when the array has 5 elements), it also includes the checksum (within the second object, apparently):

image

So it should be handled here:

Why Kraken's stream service implementation has this weird edge case with 5 elements, instead of merging asks and bids within a single { a?, b?, c } object, remains a mistery to me...

PlaceOrder Websocket method does not have the orderFlags parameter

The PlaceOrderAsync method in websocket does not have the orderFlags parameter, even though it is available in the Kraken websocket API.

The PlaceOrderAsync method in REST have the orderFlags parameter correctly implemented though. I use it as a workaround now, but using websocket would be faster.

'since' parameter in GetRecentTradesAsync not working properly

Hi,
When trying to use the GetRecentTradesAsync() endpoint with a given 'since' parameter, the result from the API doesn't seem to respect this value. I think this is because the parameter is sent to Kraken as a normal Unix timestamp, while according to this article it should be a 'Unix timestamp with nanosecond resolution'
https://support.kraken.com/hc/en-us/articles/218198197-How-to-retrieve-historical-time-and-sales-trading-history-using-the-REST-API-Trades-endpoint-

Thanks in advance

.NET Framework does not work even with Version 2.2.3

Describe the bug
I created a empty .NET console project (.NET Core 2.2) in VS, installed Kraken.Net ("Install-Package KrakenExchange.Net"). The sample code works find.
I created a empty .NET Windows Forms project (.NET Framework 4.6.1, also tried 4.7), installed also Kraken.Net. On running I get the error message "PlatformNotSupportedException: Das WebSocket-Protokoll wird für diese Plattform nicht unterstützt." (PlatformNotSupportedException: the WebSocket-protocol is not supported for this plattform.)

This happened after "var subscribeResult=krakenSocketClient.SubscribeToTickerUpdatesAsync("BTC/USD", data => {});" when then accessing "subscribeResult.Result.Success".

To Reproduce
KrakenClient.SetDefaultOptions(new KrakenClientOptions() {
ApiCredentials=new ApiCredentials(krakenApiKey, krakenSecretKey),
});
KrakenClient krakenClient=new KrakenClient();

var client = new KrakenSocketClient(new KrakenSocketClientOptions()
ApiCredentials =new ApiCredentials(krakenApiKey, krakenSecretKey),
});
var subscribeResult =krakenSocketClient.SubscribeToTickerUpdatesAsync("BTC/USD", data => {
Console.WriteLine("BTC/USD: "+data.Data.LastTrade.Price);
});

if (!subscribeResult.Result.Success) {
// Subscription failed, check callResult.Error for more info
Console.WriteLine("startWebsocketStream: ERROR: SubscribeToTickerUpdatesAsync failed (Error:"+subscribeResult.Result.Error+")!");
}
else {
Console.WriteLine("startWebsocketStream: SubscribeToTickerUpdatesAsync successful.");
}

Expected behavior
It should work on both .NET Core and .NET Framework but it seems it does not. Anyway I use Binance.NET extensively and have no issues at all and pretty happy, now wanted to use the librabry for Kraken.NET but I do not get it to run. It seems a fundamental issue.
Help how to solve that would be great since I need to port a .NET Form App and therefore need .NET Framework!

Debug logging
As shown above.

SubscribeToTickerUpdatesAsync doesn't get new data on best bid / best ask changes

Describe the bug
Using SubscribeToTickerUpdatesAsync, I'm subscribing to "BTC/USD" ticker updates while following the best bid / best ask updates for the same symbol on https://trade.kraken.com/charts/KRAKEN:BTC-USD.
It seems that the action provided on SubscribeToTickerUpdatesAsync doesn't get called when best bid / best ask are updates, only when last trade is updated.

To Reproduce

	var cr = await client.SpotStreams.SubscribeToTickerUpdatesAsync("BTC/USD", d =>
	{
		d.Timestamp.Dump($"BestAsk:{d.Data.BestAsks.Price} BestBid:{d.Data.BestBids.Price}");
	});

	cr.Success.Dump();
	Console.ReadLine();
	client.Dispose();

image

Expected behavior
Expecting updates also on BestAsk/BestBid changes.

KrakenClientObj.GetDepositMethods(AssetDepotSymbol) fails with "EFunding:Unknown withdraw key"

KrakenClientObj.GetDepositMethods(AssetDepotSymbol) ' Fails with "EFunding:Unknown withdraw key"
and returns DepositMethodsInfo.Data with empty value

The message "Unknown withdraw key" have nothing to do GetDepositMethods function called with Asset = "EUR"

Kraken Doc for this function is here :
https://docs.kraken.com/rest/#tag/User-Funding

Please note that this function doc says :
Authorizations: API-Key AND API-Sign

Do you confirm V1.4.3 implement API signature for KrakenClientObj.GetDepositMethods as described here :
https://docs.kraken.com/rest/#section/Authentication/API-Sign

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.