CexCore 1.2.1

CexCore is .NET Core wrapper over CEX.IO API for trading.

There is a newer version of this package available.
See the version list below for details.
Install-Package CexCore -Version 1.2.1
dotnet add package CexCore --version 1.2.1
<PackageReference Include="CexCore" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CexCore --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

.NET Core Wrapper for CEX.IO

Getting started

This is completed version of original repository by fasetto.
In this fork, I have filled the gap created by original author with adding all crypto currencies available on CEX.IO and fixed a small bug for placing market order.

Getting started

  1. For both public and private REST methods:
private ApiCredentials credentials = new ApiCredentials("userId","apiKey","apiSecret");

private CexClient client = new CexClient(credentials);
  1. For public only REST methods (where you don't need credentials):
private CexClient client = new CexClient();

Balance

You can get your balance information by calling GetBalanceAsync and filter it trough Bitcoin or Altcoin properties:

Balance balance = await client.Account.GetBalanceAsync();
decimal btcBalance = balance.BTC.Available;

Last price

To get the last price for Bitcoin or some Altcoin use GetLastPriceAsync method and give it SymbolPairs enum as argument:

var lastPrice = await client.GetLastPriceAsyn(SymbolPairs.BTC_USD);

Place order (Limit order)

Placing limit order means that it will execute after it reach wanted price. For example if the current price for BTC is 5000$ and you want to sell it when it reach 5500$, you will use limit order.

var order = new Order(SymbolPairs.BTC_USD, 5500.0m, 0.01m, OrderType.Buy);
Order result = await client.Account.PlaceLimitOrder(order);

Place order (Market order)

Placing market order means that it will execute in instant at the current market price. So, for example, if the current BTC price is 5300$, you will sell your BTC for that price.

var order = new Order(SymbolPairs.BTC_USD, null, 0.01m, OrderType.Buy);
Order result = await client.Account.PlaceMarketOrder(order);

Margin trading

Margin trading means borrowing money for trading which is very risky stuff. Please do margin trading with bigger knowledge about margin trading.

var lastPrice = await client.GetLastPriceAsync(SymbolPairs.BTC_USD);

var position = new Position()
{
    Pair = SymbolPairs.BTC_USD,
    Amount = 4.7m,
    Symbol = Symbols.BTC,
    Leverage = 3,
    Type = PositionType.Short,
    EstimatedOpenPrice = lastPrice,
    StopLossPrice = lastPrice + 40.0m
};

// returns position id.
var positionId = await client.Account.OpenPosition(position);

Donations

If you thin this project is good and want to show your support for further development of this repository, you can donate any amount of BTC. If you don't feel with donating, you can be a contributor and help me that way.

<div style="text-align:center">
<a href="https://blockchain.info/address/322SRqTS3EeKGaVFuo6xsw8e5Xji4QcJR6">

Click to see my BTC address

</div>

.NET Core Wrapper for CEX.IO

Getting started

This is completed version of original repository by fasetto.
In this fork, I have filled the gap created by original author with adding all crypto currencies available on CEX.IO and fixed a small bug for placing market order.

Getting started

  1. For both public and private REST methods:
private ApiCredentials credentials = new ApiCredentials("userId","apiKey","apiSecret");

private CexClient client = new CexClient(credentials);
  1. For public only REST methods (where you don't need credentials):
private CexClient client = new CexClient();

Balance

You can get your balance information by calling GetBalanceAsync and filter it trough Bitcoin or Altcoin properties:

Balance balance = await client.Account.GetBalanceAsync();
decimal btcBalance = balance.BTC.Available;

Last price

To get the last price for Bitcoin or some Altcoin use GetLastPriceAsync method and give it SymbolPairs enum as argument:

var lastPrice = await client.GetLastPriceAsyn(SymbolPairs.BTC_USD);

Place order (Limit order)

Placing limit order means that it will execute after it reach wanted price. For example if the current price for BTC is 5000$ and you want to sell it when it reach 5500$, you will use limit order.

var order = new Order(SymbolPairs.BTC_USD, 5500.0m, 0.01m, OrderType.Buy);
Order result = await client.Account.PlaceLimitOrder(order);

Place order (Market order)

Placing market order means that it will execute in instant at the current market price. So, for example, if the current BTC price is 5300$, you will sell your BTC for that price.

var order = new Order(SymbolPairs.BTC_USD, null, 0.01m, OrderType.Buy);
Order result = await client.Account.PlaceMarketOrder(order);

Margin trading

Margin trading means borrowing money for trading which is very risky stuff. Please do margin trading with bigger knowledge about margin trading.

var lastPrice = await client.GetLastPriceAsync(SymbolPairs.BTC_USD);

var position = new Position()
{
    Pair = SymbolPairs.BTC_USD,
    Amount = 4.7m,
    Symbol = Symbols.BTC,
    Leverage = 3,
    Type = PositionType.Short,
    EstimatedOpenPrice = lastPrice,
    StopLossPrice = lastPrice + 40.0m
};

// returns position id.
var positionId = await client.Account.OpenPosition(position);

Donations

If you thin this project is good and want to show your support for further development of this repository, you can donate any amount of BTC. If you don't feel with donating, you can be a contributor and help me that way.

<div style="text-align:center">
<a href="https://blockchain.info/address/322SRqTS3EeKGaVFuo6xsw8e5Xji4QcJR6">

Click to see my BTC address

</div>

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.3.0 146 4/19/2020
2.2.0 315 2/22/2020
2.1.0 249 7/11/2019
2.0.0 239 6/14/2019
1.6.2 251 6/7/2019
1.4.1 255 6/6/2019
1.3.1 264 5/21/2019
1.2.1 320 4/22/2019
1.1.0 315 12/29/2018
1.0.0 330 9/25/2018
Show less