Skip to content

ridicoulous/LiquidQuoine.Net

Repository files navigation

Icon LiquidQuoine.Net

build-nuget

LiquidQuoine.Net is a .Net wrapper for the liquid.com (by Quoine) API as described on documentation. It includes all features the API provides using clear and readable C# objects including

  • Reading market info
  • Placing and managing orders
  • Reading accounts, balances and funds

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


Also check out other exchange API wrappers based on JKorf's abstraction CryptoExchange.Net:

Donations

Donations are greatly appreciated and a motivation to keep improving.

Btc: 1KhYc4yQUHpj6tjpjh64KQ9Ki77N4srCxj
Eth: 0x84f892FaBCE99e3429a4318948B9bBe1434Bbe4A

Installation

Nuget version Nuget downloads

Available on NuGet:

PM> Install-Package LiquidQuoine.Net

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

Getting started

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

LiquidQuoine.Net provides client to interact with the Liquid.com API. The LiquidQuoineClient provides all rest API calls.

Most API methods are available in two flavors, sync and async:

public void NonAsyncMethod()
{
    using(var client = new LiquidQuoineClient())
    {
        var result = client.GetAllProducts();
    }
}

public async Task AsyncMethod()
{
    using(var client = new LiquidQuoineClient())
    {
        var result2 = await client.GetAllProductsAsync();
    }
}

Response handling

All API requests will respond with an CallResult object. This object contains whether the call was successful, the data returned from the call and an error if the call wasn't successful. As such, one should always check the Success flag when processing a response. For example:

using(var client = new LiquidQuoineClient())
{
	var orderBookByProductId = client.GetOrderBook(5);
	if (priceResult.Success)
		Console.WriteLine($"OrderBook: {orderBookByProductId.Data.BuyPriceLevels[0].Price}");
	else
		Console.WriteLine($"Error: {orderBookByProductId.Error.Message}");
}

Options & Authentication

The default behavior of the clients can be changed by providing options to the constructor, or using the SetDefaultOptions before creating a new client to set options for all new clients. Api credentials can be provided in the options.

Release notes

  • Version 0.0.2 - 04 feb 2019
    • Orders implemented
  • Version 0.0.1 - 03 feb 2019
    • Initial release