counter-market
v0.0.7
Published
Package for working with counter market
Readme
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);Attribute | Type | Description --------- | ---- | ----------- privateKey| string | your private key
Available methods
createOrder(client, type, stockAmount, cashPrice, symbol)
CounterApi.createOrder(privateKeyClient, 'buy', 123, 123, 'OMG/ETH');Attribute | Type | Description
--------- | ---- | -----------
client | Client | client for sign
type | string | maker action, either buy or sell
stockAmount | string | coins count
cashPrice | string | cash price
symbol | string | Market symbol
Output:
Promise<Order>cancelOrder(client, id)
CounterApi.cancelOrder(privateKeyClient, '0x00000000000000000000000100001a5078d5831ff28bd6895cdfe450118d37f9');Attribute | Type | Description --------- | ---- | ----------- client | Client | client for sign id | string | unique order id
fetchOrders(client)
CounterApi.fetchOrders(privateKeyClient);Attribute | Type | Description --------- | ---- | ----------- client | Client | client for sign
Output:
Promise<Order[]>fetchMyTrades(client)
CounterApi.fetchMyTrades(privateKeyClient);Attribute | Type | Description --------- | ---- | ----------- client | Client | client for sign
Output:
Promise<Trade>getBalance(client)
CounterApi.getBalance(privateKeyClient);Attribute | Type | Description --------- | ---- | ----------- client | Client | client for sign
Output:
Promise<Balance>withdraw(client)
CounterApi.withdraw(privateKeyClient, 'ETH');Attribute | Type | Description --------- | ---- | ----------- client | Client | client for sign symbol | string | Token symbol
