0.0.7 • Published 5 years ago

counter-market v0.0.7

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Counter market API

The official api library for trading on Counter market.

For more information, please visit Counter api docs

Example of using

import CounterApi from 'counter-market';

(async () => {
    const privateKey = '62537136911bca3a7e2b....';
    const privateKeyClient = new CounterApi.PrivateKeyClient(privateKey);

    const order = await CounterApi.createOrder(privateKeyClient, 'buy', 100, 0.00797, 'OMG/ETH');
})();

CCXT compatible version

Counter market contain wrapper for compatibility with ccxt. For more information about methods see CCXT documentation

import CounterApi from 'counter-market';

(async () => {
    const privateKey = '62537136911bca3a7e2b....';
    const privateKeyClient = new CounterApi.PrivateKeyClient(privateKey);

    const counter = new CounterApi.CCXTCompatible(privateKeyClient);
	const order = await counter.createOrder('OMG/ETH','limit',"buy", 100, 0.00797)
})();

Available clients

PrivateKeyClient

const privateKey = '62537136911bca3a7e2b....';
const privateKeyClient = new CounterApi.PrivateKeyClient(privateKey);
AttributeTypeDescription
privateKeystringyour private key

Available methods

createOrder(client, type, stockAmount, cashPrice, symbol)

CounterApi.createOrder(privateKeyClient, 'buy', 123, 123, 'OMG/ETH');
AttributeTypeDescription
clientClientclient for sign
typestringmaker action, either buy or sell
stockAmountstringcoins count
cashPricestringcash price
symbolstringMarket symbol

Output:

Promise<Order>

cancelOrder(client, id)

CounterApi.cancelOrder(privateKeyClient, '0x00000000000000000000000100001a5078d5831ff28bd6895cdfe450118d37f9');
AttributeTypeDescription
clientClientclient for sign
idstringunique order id

fetchOrders(client)

CounterApi.fetchOrders(privateKeyClient);
AttributeTypeDescription
clientClientclient for sign

Output:

Promise<Order[]>

fetchMyTrades(client)

CounterApi.fetchMyTrades(privateKeyClient);
AttributeTypeDescription
clientClientclient for sign

Output:

Promise<Trade>

getBalance(client)

CounterApi.getBalance(privateKeyClient);
AttributeTypeDescription
clientClientclient for sign

Output:

Promise<Balance>

withdraw(client)

CounterApi.withdraw(privateKeyClient, 'ETH');
AttributeTypeDescription
clientClientclient for sign
symbolstringToken symbol