CexCore 1.3.1
See the version list below for details.
dotnet add package CexCore --version 1.3.1
NuGet\Install-Package CexCore -Version 1.3.1
<PackageReference Include="CexCore" Version="1.3.1" />
paket add CexCore --version 1.3.1
#r "nuget: CexCore, 1.3.1"
// Install CexCore as a Cake Addin
#addin nuget:?package=CexCore&version=1.3.1
// Install CexCore as a Cake Tool
#tool nuget:?package=CexCore&version=1.3.1
INFO!
On June 6, 2019, the QASH/BTC and QASH/ETH pairs will be delisted from CEX.IO. More information on CEX.IO blog
.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
- For both public and private REST methods:
private ApiCredentials credentials = new ApiCredentials("userId","apiKey","apiSecret");
private CexClient client = new CexClient(credentials);
- 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> <img src="https://blockchain.info/qr?data=322SRqTS3EeKGaVFuo6xsw8e5Xji4QcJR6&size=200" alt=""/> <br/> <a href="https://blockchain.info/address/322SRqTS3EeKGaVFuo6xsw8e5Xji4QcJR6"> Click to see my BTC address </a> </div>
Product | Versions 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. |
-
.NETCoreApp 2.0
- Newtonsoft.Json (>= 11.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
I have added support for MHC currency in this version..
MHC currency is linked to BTC and ETH..
For those changes check CexCore.MarketEntities.Symbols and CexCore.MarketEntities.SymbolPairs enumerations.