.NET Wrapper for CEX.IO
private ApiCredentials credentials = new ApiCredentials(
"userId",
"apiKey",
"apiSecret"
);
private CexClient client = new CexClient(credentials);
.. or you can use for public commands without api credentials like this ;
private CexClient client = new CexClient();
Balance balance = await client.Account.GetBalanceAsync();
decimal btcBalance = balance.BTC.Available;
var lastPrice = await client.GetLastPriceAsync(SymbolPairs.BTC_USD);
var order = new Order(SymbolPairs.BTC_USD, 2400.0m, 0.01m, OrderType.Buy);
Order result = await client.Account.PlaceLimitOrder(order);
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);