Skip to content

fasetto/cex.io-api

Repository files navigation

.NET Wrapper for CEX.IO

Getting started

SetUp

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 balance    = await client.Account.GetBalanceAsync();
decimal btcBalance = balance.BTC.Available;

Last price

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

Place order

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

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're feeling generous, you can donate
Bitcoin Donate Button

Releases

No releases published

Packages

No packages published

Languages