npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coinexams

v1.0.0

Published

CoinExams Enterprise gives you access to the Crypto Portfolio Builder and other CoinExams services. Seamless integration with minimal implementation effort.

Downloads

4

Readme

CoinExams Enterprise

Setup

CoinExams Enterprise APIs uses HMAC authentication to protect the data in transit. Thus, it is required to include the API key in request body and sign all requests with HMAC key. All requests are using POST method for ease, reliability, and security.

Base URL

const baseURL = `https://api.coinexams.com/v1/`;

Request Signed

import { createHmac } from "node:crypto";
import fetch from "node-fetch";

const
    baseURL: string = `https://api.coinexams.com/v1/`,
    key: string = `API Key`,
    hmacKey: string = `API HMAC Key`,
    requestFunction = async (
        endPoint: string,
        reqParm?: any
    ) => {
        const
            body = {
                key,
                ...reqParm || {}
            },
            signature = createHmac(`sha256`, hmacKey)
                .update(JSON.stringify(body))
                .digest(`hex`),
            res = await fetch(
                baseURL + endPoint,
                {
                    method: "POST",
                    headers: { "Content-Type": "application/json" },
                    body: JSON.stringify({
                        ...body,
                        signature
                    })
                }
            ),
            result: any = await res.json();

        // request error
        if (result?.e) console.log(`error`, result.e);

        // request success
        else return await result;
    };

Data Types

Exchange Ids

type exchIds = `bin`

Portfolio Settings

interface portSettings {
	/** 1 trade on | 0 trade off */
	rb?: 1 | 0,

	/** coins included list */
	lst?: string[],

	/** wallets holdings outside exchange, example { BTC: 0.01 } */
	wal?: { [sy: string]: number },

	/** manual distribution percentage, example for 50% { BTC: 50 } */
	man?: { [sy: string]: number },

	/** coinset Id */
	coinSetId?: string,

	/** exchange Id */
	exchId?: exchIds,
}

Exchange Data

interface exchData {
	/** holdings on exchange */
	holdings: { [sy: string]: number },

	/** positive numbers for buy, negative for sell */
	trades?: { [sy: string]: number },

	/** Time traded last ms */
	lastTraded?: number,
	
	/** Next trade check ms */
	nextCheck: number,
	
	/** exchange Id */
   	exchId?: exchIds,
}

Endpoints

Manage all portfolios created using API in your managing account

Portfolios Settings

Latest settings for all portfolios

endPoint portfolios/all

body: {
	/** Portfolio Id String */
	portId?: string
}

response: {
	users: {
		[portId: string]: JSON.stringify(portSettings)
	}
}

Portfolios Trades

Latest trades for all portfolios

endPoint portfolios/trades

body: {
	/** Portfolio Id String */
	portId?: string
}

response: {
	exchanges: {
		[portId: string]: exchData
	}
}

error: { e: `no_trades` }

Portfolio New

Create a new portfolio and get portfolio ID

endPoint portfolios/add

body: {
	/** Portfolio Settings Stringified */
	settings?: JSON.stringify(portSettings),
}

response: {
	/** Portfolio Id String */
	portId: string,
}

Portfolio Update

Update an existing portfolio using portfolio ID

endPoint portfolios/update

body: {
	/** Portfolio Id String */
	portId: string,

	/** Portfolio Settings Stringified */
	settings: JSON.stringify(portSettings),
}

response: {
	/** Portfolio Id String */
	portId: string,
}

Portfolio Exchange APIs

Add or update exchange API keys for a given exchange

endPoint portfolios/api

body: {
	/** Portfolio Id String */
	portId: string,

	/** exchange Id */
	exchId: exchIds,

	/** exchange API key 1 */
	k1: Exchange_API_Key,

	/** exchange API key 2 */
	k2: Exchange_API_Secret,
}

response: {
	/** Portfolio Id String */
	portId: string,

	/** holdings on exchange */
	holdings: { [sy: string]: number }
}

error: { e: `api_renew` | `api_invalid` }

Portfolio Delete

Delete an existing portfolio using portfolio ID

endPoint portfolios/delete

body: {
	/** Portfolio Id String */
	portId: string,
}

response: {
	/** Portfolio Id String */
	portId: string,
}

Coin Sets

All coin sets created

endPoint coinsets/all

body: {
	/** exchange Id */
	exchId: exchIds
}

response: {
	[exchId: exchIds]: {
		[coinSetId: string]: string[] // example [`BTC`,`ETH`]
	}
}

Coin Set Options

Get a list of all possible token symbols

endPoint coinsets/options

body: {
	/** exchange Id */
	exchId: exchIds
}

response: {
	options: string[], // example [`BTC`,`ETH`]
}

Coin Set New

Create a new coin set and get coin set ID

endPoint coinsets/add

body: {
	/** exchange Id */
	exchId: exchIds,

	/** example [`BTC`,`ETH`], minimum two symbols */
	coinSet: string[],
}

response: {
	/** Coin Set Id String */
	coinSetId: string,
}

error: { e: `symbols_insufficient` | `${symbol} symbol_invalid` }

Coin Set Update

Update an existing coin set using coin set ID

endPoint coinsets/update

body: {
	/** exchange Id */
	exchId: exchIds,

	/** Coin Set Id String */
	coinSetId: string,

	/** example [`BTC`,`ETH`], minimum two symbols */
	coinSet: string[],
}

response: {
	/** Coin Set Id String */
	coinSetId: string,
}

error: { e: `symbols_insufficient` | `${symbol} symbol_invalid` }

Coin Set Delete

Delete an existing coin set using coin set ID

endPoint coinsets/delete

body: {
	/** exchange Id */
	exchId: exchIds,

	/** Coin Set Id String */
	coinSetId: string,
}

response: {
	/** Coin Set Id String */
	coinSetId: string,
}