All Projects → cryptomkt → cryptomkt-node

cryptomkt / cryptomkt-node

Licence: Apache-2.0 license
CryptoMarket Node SDK

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cryptomkt-node

every-eos
Decentralized exchange based on eos.io
Stars: ✭ 20 (-4.76%)
Mutual labels:  exchange, eos
py-etherdelta
Python client for interacting with the EtherDelta API and Smart Contracts.
Stars: ✭ 22 (+4.76%)
Mutual labels:  exchange
geos
golang implementation of the EOS protocol
Stars: ✭ 67 (+219.05%)
Mutual labels:  eos
simple blockchain
Blockchain code made simple.
Stars: ✭ 24 (+14.29%)
Mutual labels:  ether
EosProxyServer
A full-functional backend server of EOS wallet.
Stars: ✭ 36 (+71.43%)
Mutual labels:  eos
hurtrade
An Open Source Forex Trading Platform
Stars: ✭ 22 (+4.76%)
Mutual labels:  exchange
ping-eos
Implementing ping between EOS / React.js
Stars: ✭ 86 (+309.52%)
Mutual labels:  eos
binance-client-websocket
🛠️ C# client for Binance websocket API
Stars: ✭ 41 (+95.24%)
Mutual labels:  exchange
alpha-interface
✨ Token Exchange App for Arweave Profit Sharing Tokens
Stars: ✭ 34 (+61.9%)
Mutual labels:  exchange
solidstate-solidity
💠 Upgradeable-first Solidity smart contract development library 💠
Stars: ✭ 264 (+1157.14%)
Mutual labels:  ether
node-ews
A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API.
Stars: ✭ 114 (+442.86%)
Mutual labels:  exchange
vbo365-rest
Unofficial Self-Service Web Portal for Veeam Backup for Microsoft Office 365
Stars: ✭ 44 (+109.52%)
Mutual labels:  exchange
metapay-chrome
A Chrome extension wallet for Stellar that simplifies payment.
Stars: ✭ 21 (+0%)
Mutual labels:  stellar-lumens
coincube
A Python/Vue.js crypto portfolio management and trade automation program with support for 10 exchanges.
Stars: ✭ 85 (+304.76%)
Mutual labels:  exchange
eosdart
EOS API Client in Dart Language
Stars: ✭ 33 (+57.14%)
Mutual labels:  eos
SmartHold-contracts
Ethereum Smart Contracts for locking your Ether and ERC20 tokens based on time and price conditions
Stars: ✭ 23 (+9.52%)
Mutual labels:  ether
huobi Cpp
C++ SDK for Huobi Spot API
Stars: ✭ 56 (+166.67%)
Mutual labels:  exchange
sanic-currency-exchange-rates-api
This is a self hosted, free, open source Python Currency Exchange Rate API fork.
Stars: ✭ 20 (-4.76%)
Mutual labels:  exchange
EOS-Proxy-Token
Proxy token to allow mitigating EOSIO Ram exploit
Stars: ✭ 22 (+4.76%)
Mutual labels:  eos
binance-signature-examples
Examples of generating HMAC and RSA signature for Binance API
Stars: ✭ 170 (+709.52%)
Mutual labels:  exchange

CryptoMarket-javascript

main page

sign up in CryptoMarket.

Installation

To install Cryptomarket use npm

npm install cryptomarket

Documentation

This sdk makes use of the api version 2 of cryptomarket.

Quick Start

rest client

const { Client } = require('cryptomarket')

// instance a client
let apiKey='AB32B3201'
let api_secret='21b12401'
let client = new Client(apiKey, api_secret)

// get currencies
let currencies = await client.getCurrencies()

// get order books
let orderBook = await client.getOrderBook('EOSETH')

// get your account balances
let accountBalance = await client.getAccountBalance()

// get your trading balances
let tradingBalance = await client.getTradingBalance()

// move balance from account to trading
let result = await client.transferMoneyFromAccountBalanceToTradingBalance('ETH', '3.2')

// get your active orders
let orders = await client.getActiveOrders('EOSETH')

// create a new order
let newOrder = await client.createOrder({'symbol':'EOSETH', 'side':'buy', 'quantity':'10', 'price':'10'})

websocket client

There are three websocket clients, one for public request (WSPublicClient), one for trading request (WSTradingClient) and one for the account requests (WSAccountClient).

Clients work with promises

Clients must be connected before any request. Authentication for WSTradingClient and WSAccountClient is automatic.

const { WSPublicClient, WSTradingClient, WSAccountClient} = require('cryptomarket')

let publicClient = new WSPublicClient()
await publicClient.connect()

// get currencies
await publicClient.getCurrencies()

let apiKey='AB32B3201'
let apiSecret='21b12401'
let tradingClient = new WSTradingClient(apiKey, apiSecret)

await tradingClient.connect()

// get your trading balance
let balance = await tradingClient.getTradingBalance()

// get your active orders
let activeOrders = await tradingClient.getActiveOrders()

await tradingClient.createOrder({
    clientOrderId:"qqwe123qwe", 
    symbol:'EOSETH', 
    side:'buy', 
    quantity:'10',
    price:'10'
})

let accountClient = new WSAccountClient(apiKey, apiSecret)
await accountClient.connect()

// get your account balance
let accBalance = await accountCilent.getAccountBalance()

subscriptions

all subscriptions take a callback argument to call with each feed of the subscription

// callback is for the subscription feed
function callback(feed) {
    // handle feed
    console.log(feed)
}

await publicClient.subscribeToOrderBook('EOSETH', callabck)


await accountClient.subscribeToTransactions(callback)

error handling

{ CryptomarketSDKException, Client, WSPublicClient } = require('cryptomarket')
// exceptions derive from the CryptomarketSDKException class.

client = new Client()
// catch a failed transaction
try {
    order = client.createOrder({
        'symbol':'EOSETHH',  // non existant symbol
        'side':'sell',
        'quantity':'10', 
        'price':'10'})
} catch (error) {
    console.log(error)
}

wsclient = new WSPublicClient()
await wsclient.connect()

// catch a missing argument
try {
    await wsclient.subscribeToOrderbook('ETHBTC') // needs a callback
} catch (error) {
    console.log(error)
}

// also catches forwarded errors from the cryptomarket exchange server
try {
    let trades = await wsclient.getTrades("abcde", myCallback) // not a real symbol
} catch (err) {
    console.log(err)
}

Checkout our other SDKs

python sdk

java sdk

go sdk

ruby sdk

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].