burakoner / BtcTurk.Net

Open source .Net API wrapper for the BtcTurk web API and websockets API
MIT License
24 stars 9 forks source link

Unauthorized error #1

Closed blobgamestudio closed 4 years ago

blobgamestudio commented 4 years ago

It gives Unauthorized error, I set default options before create client. I checked my ip adress from btcTurk and permissions.Everything seems alright but it gives error. Did I forget something before get account balance ?

`using BtcTurk.Net; using CryptoExchange.Net.Authentication;

public class BtcTurkController { private BtcTurkClient client;

public void Initialize()
{
    Authenticate();
    client = new BtcTurkClient();
    var ping = client.Ping();
    Debug.Log($"BtcTurk Ping: {ping.Success}");
}

private void Authenticate()
{
    BtcTurkClient.SetDefaultOptions(new BtcTurkClientOptions()
    {
        ApiCredentials = new ApiCredentials(Constants.BtcTurkApiKey, Constants.BtcTurkApiSecret),
    });
}

public async void GetAccountInfo()
{
    try
    {
        var accountInfo = await client.GetBalancesAsync();
        if (accountInfo.Success)
        {
            string text = $"BtcTurk account info: {accountInfo.Data.Length}";
            foreach (var balance in accountInfo.Data)
            {
                if (balance.Balance > 0)
                {
                    text += $"\n{balance.Asset} -> {balance.Balance}";
                }
            }

            Debug.Log(text);
        }
        else
        {
            Debug.Log($"error {accountInfo.ResponseStatusCode}");
        }

    }
    catch
    {
        Debug.Log("An error occurred");
    }
}

}`

burakoner commented 4 years ago

I am inspecting and will answer soon

burakoner commented 4 years ago

I fixed https://github.com/burakoner/BtcTurk.Net/blob/master/BtcTurk.Net/BtcTurkAuthenticationProvider.cs both in github and nuget. Unfortunatelly there is not documentation for v2.

blobgamestudio commented 4 years ago

Thank you so much. They are going to disable v1 but they haven't well documentation for v2. I tested and it works well. You saved my time thanks.

burakoner commented 4 years ago

I have only a swagger file for v2. I asked for authentication rules and they said there is no document for auth for v2

blobgamestudio commented 4 years ago

Is it possible to subscribe to models for example order book , balance updated etc (https://docs.btcturk.com/#models) from BtcTurkSocketClient.cs ? I could't find method for subscription other than subscribetoKlineStream.

burakoner commented 4 years ago

Not yet. I added to next version jobs

blobgamestudio commented 4 years ago

What is your release estimation date for next version ?

burakoner commented 4 years ago

Give me two days. I will write it for you

blobgamestudio commented 4 years ago

Thank you , I will wait your new release.

burakoner commented 4 years ago

I've just committed new version. https://github.com/burakoner/BtcTurk.Net/commit/fca382d54ce51c94aa5806c430c7d7a4c358a453

I added all WSS public endpoints but private ones. Because there isnt any documentation how to create login token. I've written to BtcTurk, If I get answer I can add private endpoints later.

You can clone my repo or download from nuget for the new version

blobgamestudio commented 4 years ago

Thank you so much , I tested. Looks good.