CexCore 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CexCore --version 1.2.1
NuGet\Install-Package CexCore -Version 1.2.1
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="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
#r "nuget: CexCore, 1.2.1"
#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 CexCore as a Cake Addin
#addin nuget:?package=CexCore&version=1.2.1

// Install CexCore as a Cake Tool
#tool nuget:?package=CexCore&version=1.2.1

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

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 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 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
3.0.0 517 3/12/2021
2.3.0 534 4/19/2020
2.2.0 798 2/22/2020
2.1.0 698 7/11/2019
2.0.0 627 6/14/2019
1.6.2 672 6/7/2019
1.4.1 653 6/6/2019
1.3.1 723 5/21/2019
1.2.1 711 4/22/2019
1.1.0 748 12/29/2018
1.0.0 829 9/25/2018