BtcTurk.Net 2.6.0

Suggested Alternatives

BtcTurk.Api

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package BtcTurk.Net --version 2.6.0                
NuGet\Install-Package BtcTurk.Net -Version 2.6.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BtcTurk.Net" Version="2.6.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BtcTurk.Net --version 2.6.0                
#r "nuget: BtcTurk.Net, 2.6.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BtcTurk.Net as a Cake Addin
#addin nuget:?package=BtcTurk.Net&version=2.6.0

// Install BtcTurk.Net as a Cake Tool
#tool nuget:?package=BtcTurk.Net&version=2.6.0                

BtcTurk.Net

A .Net wrapper for the BtcTurk API as described on BtcTurk, including all features the API provides using clear and readable objects.

If you think something is broken, something is missing or have any questions, please open an Issue

Donations

Donations are greatly appreciated and a motivation to keep improving.

BTC: 33WbRKqt7wXARVdAJSu1G1x3QnbyPtZ2bH
ETH: 0x65b02db9b67b73f5f1e983ae10796f91ded57b64

Installation

Nuget version Nuget downloads Available on Nuget.

PM> Install-Package BtcTurk.Net

To get started with BtcTurk.Net first you will need to get the library itself. The easiest way to do this is to install the package into your project using NuGet. Using Visual Studio this can be done in two ways.

Using the package manager

In Visual Studio right click on your solution and select 'Manage NuGet Packages for solution...'. A screen will appear which initially shows the currently installed packages. In the top bit select 'Browse'. This will let you download net package from the NuGet server. In the search box type 'BtcTurk.Net' and hit enter. The BtcTurk.Net package should come up in the results. After selecting the package you can then on the right hand side select in which projects in your solution the package should install. After you've selected all project you wish to install and use BtcTurk.Net in hit 'Install' and the package will be downloaded and added to you projects.

Using the package manager console

In Visual Studio in the top menu select 'Tools' → 'NuGet Package Manager' → 'Package Manager Console'. This should open up a command line interface. On top of the interface there is a dropdown menu where you can select the Default Project. This is the project that BtcTurk.Net will be installed in. After selecting the correct project type Install-Package BtcTurk.Net in the command line interface. This should install the latest version of the package in your project.

After doing either of above steps you should now be ready to actually start using BtcTurk.Net.

Getting started

After installing it's time to actually use it. To get started we have to add the BtcTurk.Net namespace: using BtcTurk.Net;.

BtcTurk.Net provides two clients to interact with the BtcTurk API. The BtcTurkClient provides all rest API calls. The BtcTurkSocketClient provides functions to interact with the websocket provided by the BtcTurk API. Both clients are disposable and as such can be used in a usingstatement.

Examples

Public Api Endpoints:

BtcTurkClient apiClient = new BtcTurkClient();
var btc00 = apiClient.GetServerVersion();
var btc01 = apiClient.GetServerTime();
var btc02 = apiClient.GetServerMobileVersion();
var btc03 = apiClient.GetServerExchangeInfo();
var btc04 = apiClient.GetServerPing();
var btc05 = apiClient.GetTicker("BTCTRY");
var btc06 = apiClient.GetTradesV2("BTCTRY");
var btc07 = apiClient.GetPriceGraphHistory("BTCTRY", Net.Objects.BtcTurkPeriod.OneHour);
... etc

Private Api Endpoints:

var apiClient = new BtcTurkClient();
apiClient.SetApiCredentials("XXXXXXXX-API-KEY-XXXXXXXX", "XXXXXXXX-API-SECRET-XXXXXXXX");
var btc11 = apiClient.GetBalances();
var btc12 = apiClient.PlaceOrder("BTCTRY", 1.0m, Net.Objects.BtcTurkOrderSide.Buy, Net.Objects.BtcTurkOrderMethod.Market);
... etc

Websockets

The BtcTurk.Net socket client provides several socket endpoint to which can be subscribed.

Public Socket Endpoints:

var pairs = new List<string> {
    "ATOMTRY","BTCTRY","DASHTRY","EOSTRY","ETHTRY","LINKTRY","LTCTRY","NEOTRY","USDTTRY","XLMTRY","XRPTRY","XTZTRY",
    "ATOMUSDT","BTCUSDT","DASHUSDT","EOSUSDT","ETHUSDT","LINKUSDT","LTCUSDT","NEOUSDT","XLMUSDT","XRPUSDT","XTZUSDT",
    "ATOMBTC","DASHBTC","EOSBTC","ETHBTC","LINKBTC","LTCBTC","NEOBTC","XLMBTC","XRPBTC","XTZBTC"
};

/* BtcTurkSocketClient Object */
var sock = new BtcTurkSocketClient(new BtcTurkSocketClientOptions { LogVerbosity = CryptoExchange.Net.Logging.LogVerbosity.Debug);

/* Public Socket Endpoints: */
var subs = new List<UpdateSubscription>();

// Single Ticker
{
    var subscription = sock.SubscribeToTicker("BTCTRY", (ticker) =>
    {
        if (ticker != null)
        {
            Console.WriteLine($"Channel: {ticker.Channel} Event:{ticker.Event} Type:{ticker.Type} >> " +
            $"B:{ticker.Bid} A:{ticker.Ask} PS:{ticker.PairSymbol} NS:{ticker.NumeratorSymbol} DS:{ticker.DenominatorSymbol} " +
            $"O:{ticker.Open} H:{ticker.High} L:{ticker.Low} LA:{ticker.Close} V:{ticker.Volume} " +
            $"AV:{ticker.AveragePrice} D:{ticker.DailyChange} DP:{ticker.DailyChangePercent} PId:{ticker.PairId} Ord:{ticker.OrderNum} ");
        }
    });
    subs.Add(subscription.Data);
}

// All Tickers
{
    var subscription = sock.SubscribeToTickers((data) =>
    {
        if (data != null)
        {
            foreach (var ticker in data.Items)
            {
                Console.WriteLine($"Channel: {data.Channel} Event:{data.Event} Type:{data.Type} >> " +
                    $"B:{ticker.Bid} A:{ticker.Ask} PS:{ticker.PairSymbol} NS:{ticker.NumeratorSymbol} DS:{ticker.DenominatorSymbol} " +
                    $"O:{ticker.Open} H:{ticker.High} L:{ticker.Low} LA:{ticker.Close} V:{ticker.Volume} " +
                    $"AV:{ticker.AveragePrice} D:{ticker.DailyChange} DP:{ticker.DailyChangePercent} PId:{ticker.PairId} Ord:{ticker.OrderNum} ");
            }
        }
    });
    subs.Add(subscription.Data);
}

// Klines
foreach (var pair in pairs)
{
    var subscription = sock.SubscribeToKlines(pair, Net.Objects.BtcTurkPeriod.OneMinute, (data) =>
    {
        if (data != null)
        {
            Console.WriteLine($"Channel: {data.Channel} Event:{data.Event} Type:{data.Type} >> D:{data.Date} S:{data.Pair} P:{data.Period} O:{data.Open} H:{data.High} L:{data.Low} V:{data.Close} V:{data.Volume}");
        }
    });
    subs.Add(subscription.Data);
}

// Single Trade
{
    var subscription = sock.SubscribeToTrades("BTCTRY", (trades) =>
    {
        if (trades != null)
        {
            foreach (var trade in trades.Items)
            {
                Console.WriteLine($"Channel: {trades.Channel} [List] Event:{trades.Event} Type:{trades.Type} PairSymbol:{trades.PairSymbol} >> " +
                    $"D:{trade.Time} I:{trade.TradeId} A:{trade.Amount} A:{trade.Price} PS:{trade.PairSymbol} S:{trade.S} ");
            }
        }
    }, (trade) =>
    {
        if (trade != null)
        {
            Console.WriteLine($"Channel: {trade.Channel} [Row] Event:{trade.Event} Type:{trade.Type} PairSymbol:{trade.PairSymbol} >> " +
            $"D:{trade.Time} I:{trade.TradeId} A:{trade.Amount} A:{trade.Price} PS:{trade.PairSymbol} S:{trade.S} ");
        }
    });
    subs.Add(subscription.Data);
}

// All Pairs Trades
foreach (var pair in pairs)
{
    var subscription = sock.SubscribeToTrades(pair, (trades) =>
    {
        if (trades != null)
        {
            foreach (var trade in trades.Items)
            {
                Console.WriteLine($"Channel: {trades.Channel} [List] Event:{trades.Event} Type:{trades.Type} PairSymbol:{trades.PairSymbol} >> " +
                    $"D:{trade.Time} I:{trade.TradeId} A:{trade.Amount} A:{trade.Price} PS:{trade.PairSymbol} S:{trade.S} ");
            }
        }
    }, (trade) =>
    {
        if (trade != null)
        {
            Console.WriteLine($"Channel: {trade.Channel} [Row] Event:{trade.Event} Type:{trade.Type} PairSymbol:{trade.PairSymbol} >> " +
                $"D:{trade.Time} I:{trade.TradeId} A:{trade.Amount} A:{trade.Price} PS:{trade.PairSymbol} S:{trade.S} ");
        }
    });
    subs.Add(subscription.Data);
}

// Order Book Full
foreach (var pair in pairs)
{
    var subscription = sock.SubscribeToOrderBookFull(pair, (data) =>
    {
        if (data != null)
        {
            Console.WriteLine($"Channel: {data.Channel} [Full] Event:{data.Event} Type:{data.Type} PairSymbol:{data.PairSymbol} >> ");
            for (var i = 0; i < Math.Min(data.Asks.Count(), 5); i++)
            {
                Console.WriteLine($"Ask {i + 1} -> Price: {data.Asks[i].Price} Amount:{data.Asks[i].Amount}");
            }
            for (var i = 0; i < Math.Min(data.Bids.Count(), 5); i++)
            {
                Console.WriteLine($"Bid {i + 1} -> Price: {data.Bids[i].Price} Amount:{data.Bids[i].Amount}");
            }
        }
    });
    subs.Add(subscription.Data);
}

// Order Book Difference
foreach (var pair in pairs)
{
    var subscription = sock.SubscribeToOrderBookDiff("BTCTRY", (data) =>
    {
        if (data != null)
        {
            Console.WriteLine($"Channel: {data.Channel} [Full] Event:{data.Event} Type:{data.Type} PairSymbol:{data.PairSymbol} >> ");
            for (var i = 0; i < Math.Min(data.Asks.Count(), 5); i++)
            {
                Console.WriteLine($"Ask {i + 1} -> Price: {data.Asks[i].Price} Amount:{data.Asks[i].Amount}");
            }
            for (var i = 0; i < Math.Min(data.Bids.Count(), 5); i++)
            {
                Console.WriteLine($"Bid {i + 1} -> Price: {data.Bids[i].Price} Amount:{data.Bids[i].Amount}");
            }
        }
    }, (data) =>
    {
        if (data != null)
        {
            Console.WriteLine($"Channel: {data.Channel} [Diff] Event:{data.Event} Type:{data.Type} PairSymbol:{data.PairSymbol} >> ");
            for (var i = 0; i < Math.Min(data.Asks.Count(), 5); i++)
            {
                Console.WriteLine($"Ask {i + 1} -> Price: {data.Asks[i].Price} Amount:{data.Asks[i].Amount}");
            }
            for (var i = 0; i < Math.Min(data.Bids.Count(), 5); i++)
            {
                Console.WriteLine($"Bid {i + 1} -> Price: {data.Bids[i].Price} Amount:{data.Bids[i].Amount}");
            }
        }
    });
    subs.Add(subscription.Data);
}

Private Socket Endpoints:

/* Not supported yet because there isnt any guide how to create login token */

Release Notes

  • Version 2.6.0 - 23 Aug 2022

    • Synced with CryptoExchange.Net v5.2.4
  • Version 2.5.0 - 18 Sep 2021

    • Synced with CryptoExchange.Net v4.1.0
  • Version 2.1.0 - 31 Mar 2021

    • Updated dependencies
  • Version 2.0.1 - 01 Feb 2021

    • Updated CryptoExchange.Net to 3.6.0
  • Version 2.0.0 - 17 Jan 2021

    • All methods are virtual now. You can customize methods by overriding.
    • Fixed several minor bugs
  • Version 1.2.8 - 12 Jan 2021

    • Updated CryptoExchange.Net to 3.5.0
  • Version 1.2.6 - 02 Jan 2021

    • Fixed minor bugs
  • Version 1.2.5 - 23 Dec 2020

    • CryptoExchange version updated to 3.4.0
  • Version 1.2.4 - 12 Dec 2020

    • CryptoExchange version updated to 3.3.0
    • Added v1 v2 v3 Swagger documents and Web Socket manual
  • Version 1.2.3 - 08 Nov 2020

    • Fixed duplicate slashes on BaseAddress caused by CryptoExchange
  • Version 1.2.1 - 08 Nov 2020

    • CryptoExchange version updated to 3.1.0
  • Version 1.2.0 - 21 Sep 2020

    • CryptoExchange version updated to 3.0.14
  • Version 1.0.5 - 14 Jun 2020

    • Added Websocket Endpoints
    • Added Api Authendication
  • Version 1.0.0 - 01 Feb 2020

    • First Release
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

Version 2.6.0 - 23 Aug 2022
- Synced with CryptoExchange.Net v5.2.4