{"id":19630976,"url":"https://github.com/cryptomkt/cryptomkt-node","last_synced_at":"2025-04-28T06:32:37.420Z","repository":{"id":29096934,"uuid":"104391298","full_name":"cryptomkt/cryptomkt-node","owner":"cryptomkt","description":"CryptoMarket Node SDK","archived":false,"fork":false,"pushed_at":"2024-07-01T14:24:29.000Z","size":338,"stargazers_count":22,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-03T06:56:02.852Z","etag":null,"topics":["bitcoin","cryptomkt","crytocurrency","eos","ether","ethereum","exchange","node","stellar-lumens"],"latest_commit_sha":null,"homepage":"https://developers.cryptomkt.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cryptomkt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-21T19:42:33.000Z","updated_at":"2024-07-01T14:20:53.000Z","dependencies_parsed_at":"2024-03-13T19:46:27.937Z","dependency_job_id":"0c95af5b-fb58-48ac-984b-62cccac2aef5","html_url":"https://github.com/cryptomkt/cryptomkt-node","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptomkt%2Fcryptomkt-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryptomkt","download_url":"https://codeload.github.com/cryptomkt/cryptomkt-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224045708,"owners_count":17246542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","cryptomkt","crytocurrency","eos","ether","ethereum","exchange","node","stellar-lumens"],"created_at":"2024-11-11T12:07:17.377Z","updated_at":"2025-04-28T06:32:37.415Z","avatar_url":"https://github.com/cryptomkt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CryptoMarket-javascript\n\n[main page](https://www.cryptomkt.com/)\n\n[sign up in CryptoMarket](https://www.cryptomkt.com/account/register).\n\n## Installation\n\nTo install Cryptomarket use npm\n\n```bash\nnpm install cryptomarket@3.3.0\n```\n\n## Documentation\n\nThis sdk makes use of the [api version 3](https://api.exchange.cryptomkt.com) of cryptomarket.\n\n## Quick Start\n\n### Rest client\n\n```typescript\nconst { Client } = require(\"cryptomarket\");\n\n// instance a client\nconst apiKey = \"AB32B3201\";\nconst apiSecret = \"21b12401\";\nconst client = new Client(apiKey, apiSecret);\n\n// get currencies\nconst currencies = await client.getCurrencies();\n\n// get order books\nconst orderBook = await client.getOrderBook(\"EOSETH\");\n\n// get your account balances\nconst accountBalances = await client.getWalletBalances();\n\n// get your trading balances\nconst tradingBalances = await client.getSpotTradingBalances();\n\n// move balance from wallet to spot trading\nconst result = await client.transferBetweenWalletAndExchange({\n  currency: \"EOS\",\n  amount: \"3.2\",\n  source: Account.Wallet,\n  destination: Account.Spot,\n});\n\n// get your active orders\nconst activeOrders = await client.getAllActiveSpotOrders(\"EOSETH\");\n\n// create a new order\nconst newOrder = await client.createOrder({\n  symbol: \"EOSETH\",\n  side: \"buy\",\n  quantity: \"10\",\n  price: \"10\",\n});\n```\n\n### Websocket client\n\nThere are three websocket clients, the market data client, the spot trading client and the wallet client.\nThe market data client requires no authentication, while the spot trading client and the wallet client do require it.\n\nAll websocket methods return promises. Subscriptions also take in a function of two parameters, the notification data, and the notification type. The notification type is of type NOTIFICATION_TYPE, and is either SNAPSHOT, NOTIFICATION or DATA.\n\nThe documentation of a specific subscriptions explains with of this types of\nnotification uses.\n\n#### MarketDataClient\n\nExample of use of the market data client\n\n```typescript\n// instantiate a market data client\nconst wsclient = new WSMarketDataClient();\n\n// make a partial orderbook subscription\n\n//    make subscription\nawait marketDataClient.subscribeToPartialOrderBook(\n  callback:(notification, type) =\u003e {\n    if (type === NOTIFICATION_TYPE.DATA) {\n      System.out.println(\"this subscription only recieves data notifications\");\n    }\n    for (const symbol in notification) {\n      console.log(symbol);\n      const orderbook = notification[symbol];\n      console.log(orderbook);\n    }\n  },\n  params: {\n    speed: ORDER_BOOK_SPEED._100_MS,\n    depth: DEPTH._5,\n    symbols: [\"EOSETH\", \"ETHBTC\"],\n  }\n);\n\n\n```\n\n#### SpotTradingClient\n\nExample of use of the spot trading client\n\n```typescript\nconst apiKey = \"AB32B3201\";\nconst apiSecret= \"21b12401\";\n\n// instantiate a spot trading websocket client with a window of 10 seconds\nconst wsclient = new WSTradingClient(apiKey, apiSecret, 10_000);\n\n// connect the client (and authenticate it automatically)\nawait wsclient.connect();\n\n// get all the spot trading balances\nconst balanceList = await tradingClient.getSpotTradingBalances()\nconsole.log(balanceList);\n\n\nlet clientOrderID = Math.floor(Date.now() / 1000).toString();\n// make a spot order\nconst report = await tradingClient.createSpotOrder({\n  clientOrderId: clientOrderID,\n  symbol: \"EOSETH\",\n  side: \"sell\",\n  quantity: \"0.01\",\n  price: \"1000\",\n}\nconsole.log(report);\n```\n\n#### WalletClient\n\nExample of use of the wallet client\n\n```typescript\n// instantiate a wallet websocket client with a default window of 10 seconds\nconst wsclient = new WSWalletClient(keys.apiKey, keys.apiSecret);\n\n// get a list of transactions\nconst transactionList = await walletClient.getTransactions({\n  currencies: [\"EOS\"],\n  limit: 3,\n});\nconsole.log(transactionList);\n\n// subscribe to a feed of transactions\nawait walletClient.subscribeToTransactions((notification, type) =\u003e {\n  if (type === NOTIFICATION_TYPE.UPDATE) {\n    console.log(\"this subscription only recieves update notifications\");\n  }\n  console.log(notification);\n});\n```\n\n### Error handling\n\n```typescript\n\n{ CryptomarketSDKException, Client, WSMarketDataClient } = require('cryptomarket')\n// exceptions derive from the CryptomarketSDKException class.\n\nconst client = new Client()\n// catch a failed transaction\ntry {\n    const order = await client.createOrder({\n        'symbol':'EOSETHH',  // non existant symbol\n        'side':'sell',\n        'quantity':'10',\n        'price':'10'})\n} catch (error) {\n    console.log(error)\n}\n\nconst wsclient = new WSMarketDataClient()\nawait wsclient.connect();\n\n// catch missing arguments\ntry {\n    await wsclient.subscribeToMiniTickers()\n} catch (error) {\n    console.log(error)\n}\n```\n\n## Constants\n\nAll constants used for calls are in the `constants` module.\n\n## Checkout our other SDKs\n\n[python sdk](https://github.com/cryptomkt/cryptomkt-python)\n\n[java sdk](https://github.com/cryptomkt/cryptomkt-java)\n\n[go sdk](https://github.com/cryptomkt/cryptomkt-go)\n\n[ruby sdk](https://github.com/cryptomkt/cryptomkt-ruby)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptomkt%2Fcryptomkt-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptomkt%2Fcryptomkt-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptomkt%2Fcryptomkt-node/lists"}