1.0.0 • Published 7 years ago

bb-trade v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

Bitbutter Trading API

API credentials that have permissions to trigger trades need to be stored on the client and sent directly to the exchange to minimize risk. This library is a client side library that interfaces with multiple exchanges but with a unified experience.

Creation

Bittrex

const bittrex = new bb.bittrex({
    apiKey: process.env.BITTREX_TRADE_API_KEY,
    secret: process.env.BITTREX_TRADE_SECRET,
})

Kucoin

const kucoin = new bb.kucoin({
    apiKey: process.env.KUCOIN_TRADE_API_KEY,
    secret: process.env.KUCOIN_TRADE_SECRET,
});

Binance

const binance = new bb.binance({
    apiKey: process.env.BINANCE_TRADE_API_KEY,
    secret: process.env.BINANCE_TRADE_SECRET,
});

Limit sell

const opts = {
    amount: 0.7,
    base: "BTG",
    price: 0.0098,
    quote: "BTC",
};

await bittrex.limitSell(opts);

Limit buy

const opts = {
    amount: 0.7,
    base: "BTG",
    price: 0.0093,
    quote: "BTC",
};

await bittrex.limitBuy(opts);

Open orders

const opts = {
    base: "BTG",
    quote: "BTC",
};

await bittrex.openOrders(opts);

Cancel all orders

const opts = {
    base: "BTG",
    quote: "BTC",
};

await bittrex.cancelAllOrders(opts);

Cancel specific order

const openOrders = await bittrex.openOrders(options);

for (const order of openOrders) {
    await bittrex.cancelOrder(order.id);
}
1.0.0

7 years ago