Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
/ Thodex.Net Public archive

Open Source .Net Wrapper for the @thodex-exchange Rest Api and Websockets Api

License

Notifications You must be signed in to change notification settings

burakoner/Thodex.Net

Repository files navigation

Icon Thodex.Net

A .Net wrapper for the Thodex API as described on Thodex, 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

CryptoExchange.Net

Implementation is build upon the CryptoExchange.Net library, make sure to also check out the documentation on that: docs

My CryptoExchange.Net implementations:


OKEx

Chiliz

BitMax

BtcTurk

Paribu

Thodex

Coinzo

Tatum

JKorf CryptoExchange.Net implementations:


Binance

Bitfinex

Bittrex

CoinEx

Huobi

Kraken

Kucoin

Implementations from third parties:


Bitmex

Exante

HitBTC

Liquid

LiveCoin

Switcheo

Exante

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 Thodex.Net

To get started with Thodex.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 'Thodex.Net' and hit enter. The Thodex.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 Thodex.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 Thodex.Net will be installed in. After selecting the correct project type Install-Package Thodex.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 Thodex.Net.

Getting started

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

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

Rest Api Examples

Public Endpoints

ThodexClient api = new ThodexClient();
var server_time = api.ServerTime();
var market_list = api.GetMarkets();
var market_status = api.GetMarketStatus("BTCTRY");
var market_summary = api.GetMarketSummary();
var trade_history_01 = api.GetDealsHistory("BTCTRY");
var trade_history_02 = api.GetDealsHistory("BTCTRY", 9550000);
var order_book_01 = api.GetOrderBook("BTCTRY");
var order_book_02 = api.GetOrderBook("BTCTRY", 20);

Market Endpoints

ThodexClient api = new ThodexClient();
api.SetApiCredentials("XXXXXXXX-API-KEY-XXXXXXXX", "XXXXXXXX-API-SECRET-XXXXXXXX");
var open_orders_01 = api.GetOpenOrders("BTCTRY");
var open_orders_02 = api.GetOpenOrders("BTCTRY", 50);
var open_orders_03 = api.GetOpenOrders("BTCTRY", 20, 5);
var order_history_01 = api.GetOrderHistory("BTCTRY");
var order_history_02 = api.GetOrderHistory("BTCTRY", 50);
var order_history_03 = api.GetOrderHistory("BTCTRY", 50, 5);
var buy_limit = api.BuyLimit("BTCTRY", 0.01m, 180376.99m);
var buy_market = api.BuyMarket("BTCTRY", 0.01m);
var sell_limit = api.BuyLimit("BTCTRY", 0.01m, 180376.99m);
var sell_market = api.BuyMarket("BTCTRY", 0.01m);
var cancel_order = api.CancelOrder("BTCTRY", order_id:1001);

Account Endpoints

ThodexClient api = new ThodexClient();
api.SetApiCredentials("XXXXXXXX-API-KEY-XXXXXXXX", "XXXXXXXX-API-SECRET-XXXXXXXX");
var balances_01 = api.GetBalances();
var balances_02 = api.GetBalances(new List<string> { "BTC", "TRY" });

Websocket Api Examples

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

Core » Public Feeds

var ws = new ThodexSocketClient();
var symbols = new List<string> { "BTCTRY", "ETHTRY", "LTCTRY", "HOTTRY", "HOTUSDT", "DASHTRY", "LINKUSDT", "DOGETRY", "LINKTRY", "BATUSDT", "XRPTRY", "BATTRY", "XLMTRY", "BCHTRY", "EOSTRY", "XEMTRY", "BTGTRY", "ETCTRY", "USDTTRY", "TRXTRY", "BTTTRY", "ADATRY", "XMRTRY", "ZECTRY", "BTCUSDT", "ETHUSDT", "LTCUSDT", "DOGEUSDT", "XRPUSDT", "XLMUSDT", "BCHUSDT", "EOSUSDT", "ETCUSDT", "TRXUSDT", "ETHBTC", "TRXBTC", "XRPBTC", "LTCBTC", "BCHBTC", "XLMBTC" };

var ws01 = ws.SubscribeToState(symbols, (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Ticker Update >> {data.Symbol} >> O:{data.Open} H:{data.High} L:{data.Low} C:{data.Close} SV:{data.StockVolume} MV:{data.MoneyVolume}");
    }
});

// Unsubscribe
var uns = ws.Unsubscribe(ws01.Data);

var ws02 =ws.SubscribeToDeals(symbols, (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Deal Update >> {data.Symbol} >> I:{data.Id} T:{data.UtcTime} S:{data.Side} P:{data.Price} A:{data.Amount}");
    }
});

var ws03 = ws.SubscribeToOrderBook("BTCTRY", (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Book Update >> {data.Symbol} >> Partial:{data.IsPartial} Bids:{data.Bids.Count()} Asks:{data.Asks.Count()}");
    }
});

var ws04 = ws.SubscribeToKlines("BTCTRY",  Enums.ThodexPeriod.TwoHours, (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Kline Update >> {data.Symbol} >> O:{data.Open} H:{data.High} L:{data.Low} C:{data.Close} SV:{data.StockVolume} MV:{data.MoneyVolume}");
    }
});

var ws05 = ws.SubscribeToPrice(symbols, (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Price Update >> {data.Symbol} >> P:{data.Price}");
    }
});

var ws06 = ws.SubscribeToToday(symbols, (data) =>
{
    if (data != null)
    {
        Console.WriteLine($"Today Update >> {data.Symbol} >> O:{data.Open} H:{data.High} L:{data.Low} C:{data.Last} V:{data.Volume} D:{data.Deal}");
    }
});

Release Notes

  • 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.1.3 - 02 Jan 2021

    • Fixed minor bugs
  • Version 1.1.2 - 27 Dec 2020

    • Fixed WS-Api Order Book null value bug
    • Fixed some other bugs
  • Version 1.1.0 - 26 Dec 2020

    • Added Undocumented Public Web-Socket Api Support
  • Version 1.0.0 - 23 Dec 2020

    • First Release

About

Open Source .Net Wrapper for the @thodex-exchange Rest Api and Websockets Api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages