bitfinex-node-api
v3.0.0
Published
Bitfinex Node.js client
Downloads
4
Readme
bitfinex-node-api
Bitfinex Node.js library
Installation
npm install bitfinex-node-api
Usage
PublicClient1
import { PublicClient1 } from "bitfinex-node-api";
const client = new PublicClient1();
const symbol = "btcusd";
const ticker = await client.getTicker({ symbol });
const symbol = "btcusd";
const stats = await client.getStats({ symbol });
const currency = "usd";
const limit_bids = 10;
const limit_asks = 5;
const book = await client.getFundingBook({ currency, limit_bids, limit_asks });
const symbol = "btcusd";
const limit_bids = 20;
const limit_asks = 10;
const group = 1;
const book = await client.getOrderBook({
symbol,
limit_bids,
limit_asks,
group,
});
const symbol = "btcusd";
const timestamp = 1444266681;
const limit_trades = 10;
const trades = await client.getTrades({ symbol, timestamp, limit_trades });
const currency = "usd";
const timestamp = 1444266681;
const limit_lends = 10;
const lends = await client.getLends({ currency, timestamp, limit_lends });
const symbols = await client.getSymbols();
const symbolDetails = await client.getSymbolDetails();
AuthenticatedClient1
import { AuthenticatedClient1 } from "bitfinex-node-api";
const key = "BitfinexAPIKey";
const secret = "BitfinexAPISecret";
const client = new AuthenticatedClient1({ key, secret });
const info = await client.getAccountInfo();
const fees = await client.getAccountFees();
const summary = await client.getSummary();
const method = "zcash";
const wallet_name = "trading";
const renew = 1;
const result = await client.getDepositAddress({ method, wallet_name, renew });
const permissions = await client.getKeyPermissions();
const marginInformation = await client.getMarginInformation();
const balances = await client.getWalletBalances();
const amount = "1.00954735";
const currency = "BAB";
const walletfrom = "trading";
const walletto = "exchange";
const result = await client.transfer({
amount,
currency,
walletfrom,
walletto,
});
const amount = "1.0";
const address = "1DKwqRhDmVyHJDL4FUYpDmQMYA3Rsxtvur";
const walletselected = "exchange";
const withdraw_type = "bitcoin";
const result = await client.withdraw({
amount,
withdraw_type,
address,
walletselected,
});
const amount = "1";
const price = "3";
const type = "limit";
const exchange = "bitfinex";
const symbol = "ETCUSD";
const side = "buy";
const is_postonly = true;
const order = await client.newOrder({
amount,
price,
type,
exchange,
symbol,
side,
is_postonly,
});
const order1 = {
amount: "1",
price: "3",
type: "limit",
exchange: "bitfinex",
symbol: "ETCUSD",
side: "buy",
is_postonly: true,
};
const order2 = {
amount: "2",
price: "2",
type: "limit",
symbol: "ETCUSD",
side: "buy",
};
const orders = [order1, order2];
const result = await client.newOrders({ orders });
const order_id = 446915287;
const order = await client.cancelOrder({ order_id });
const order_id1 = 446915287;
const order_id2 = 446915287;
const order_ids = [order_id1, order_id2];
const { result } = await client.cancelOrders({ order_ids });
const { result } = await client.cancelAllOrders();
const amount = "3";
const price = "101";
const type = "limit";
const exchange = "bitfinex";
const side = "sell";
const is_postonly = true;
const symbol = "ETCUSD";
const order_id = 1;
const order = await client.replaceOrder({
amount,
price,
type,
exchange,
symbol,
side,
is_postonly,
});
const order_id = 448411153;
const order = await client.getOrder({ order_id });
const orders = await client.getOrders();
const limit = 50;
const orders = await client.getOrderHistory({ limit });
const positions = await client.getPositions();
const position_id = 943715;
const amount = "1.0";
const position = await client.claimPosition({ position_id, amount });
const currency = "USD";
const since = "1444277602.0";
const history = await client.getBalanceHistory({ currency, since });
const currency = "BTC";
const since = "1444277602.0";
const limit = 10;
const history = await client.getDepositsWithdrawals({ currency, since, limit });
const symbol = "BTCEUR";
const limit_trades = 25;
const reverse = 1;
const trades = await client.getPastTrades({ symbol, limit_trades, reverse });
const currency = "USD";
const amount = "50.0";
const rate = "20.0";
const period = 2;
const direction = "lend";
const offer = await client.newOffer({
currency,
amount,
rate,
period,
direction,
});
const offer_id = 13800585;
const offer = await client.cancelOffer({ offer_id });
const offer_id = 13800585;
const offer = await client.offerStatus({ offer_id });
const credits = await client.activeCredits();
const offers = await client.getOffers();
const limit = 25;
const offers = await client.offersHistory({ limit });
const symbol = "USD";
const limit_trades = 1;
const until = "1444141858.0";
const trades = await client.getFundingTrades({ limit_trades, symbol, until });
const funds = await client.getTakenFunds();
const funds = await client.getUnusedFunds();
const funds = await client.getTotalFunds();
const swap_id = 11576737;
const funding = await client.closeFunding({ swap_id });
const position_id = 943715;
const response = await client.closePosition({ position_id });