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 🙏

© 2026 – Pkg Stats / Ryan Hefner

thodex-api-node

v1.0.3

Published

Node module for the Thodex API designed to be easy to use.

Readme

thodex-api-node

Node module for the Thodex API designed to be easy to use.

Installation

npm i thodex-api-node

Getting Started

const {Thodex, ThodexSocket} = require('thodex-api-node')

thdx = new Thodex("apikey", 'apisecret');

thdx.serverTime()
    .then((result) => {
        console.log("Server Time\n==============")
        console.log(result)
    }).catch((e) => {
    console.log(e.response.data)
})

ThodexSocket(['BTCTRY', 'ETHTRY', 'LTCTRY'], socketMessageCallbackFunction);
function socketMessageCallbackFunction(data) {
    if(data.method == 'state') {
        console.log("\n\nSocket State Data")
        console.log(data.params)
    }else if(data.method == 'price') {
        console.log("\n\nSocket Price Data")
        console.log(data.params)
    }else if(data.method == 'deals') {
        console.log("\n\nSocket Deals Data")
        console.log(data.params)
    }
}

Public Methods

server_time
Success-Response:
{
    "error": null,
    "result": {
        "time": 1581505952,
        "timestamp": "2020-02-12 11:12:32"
    }
}

markets
Success-Response:
{
    "error": null,
    "result": [
        {
            "keyname": "BTCTRY",
            "stock_keyname": "BTC",
            "money_keyname": "TRY",
            "stock_fullname": "Bitcoin",
            "money_fullname": "Türk Lirası",
            "stock_display": "BTC",
            "money_display": "TRY",
            "stock_prec": 8,
            "money_prec": 2,
            "min_amount": "0.0001",
            "maintenance": "NO",
            "maintenance_note": null
        }
    ]
}

market_status
Success-Response:
{
    "error": null,
    "result": {
        "volume": "0",
        "high": "0",
        "open": "0",
        "period": 86400,
        "low": "0",
        "last": "53030.3",
        "deal": "0",
        "close": "0"
    }
}

market_summary
Success-Response:
{
    "error": null,
    "result": [
        {
            "name": "BTCTRY",
            "ask_count": 1,
            "ask_amount": "1.56666",
            "bid_count": 4,
            "bid_amount": "5.56952"
        }
    ]
}

market_history
Success-Response:
{
    "error": null,
    "result": [
        {
            "type": "sell",
            "id": 215302,
            "amount": "1.04508",
            "time": 1572852982.845166,
            "price": "53030.3"
        },
        {
            "type": "buy",
            "id": 215301,
            "amount": "1",
            "time": 1572608264.622277,
            "price": "40000"
        }
    ]
}

order_depth
Success-Response:
{
    "error": null,
    "result": {
        "asks": [
            [
                "53035.65",
                "1.56666"
            ]
        ],
        "bids": [
            [
                "53030.3",
                "0.21112"
            ],
            [
                "52950.01",
                "1.77865"
            ],
            [
                "52948.24",
                "1.99221"
            ],
            [
                "52814.19",
                "1.58754"
            ]
        ]
    }
}

Authenticated Methods

get_open_orders
Success-Response:
{
    "errors": null,
    "result": {
        "limit": 50,
        "offset": 0,
        "total": 1,
        "records": [
            {
                "id": 703626,
                "market": "BTCTRY",
                "source": "api",
                "type": 1,
                "side": 1,
                "ctime": 1575458715.920797,
                "mtime": 1575458715.920797,
                "price": "12340",
                "amount": "0.3",
                "taker_fee": "0",
                "maker_fee": "0",
                "left": "0.3",
                "deal_stock": "0",
                "deal_money": "0",
                "deal_fee": "0"
            }
        ]
    }
}

get_order_history
Success-Response:
{
    "errors": null,
    "result": {
        "offset": 0,
        "limit": 50,
        "records": [
            {
                "time": 1572432266.2779,
                "id": 215024,
                "side": 2,
                "role": 1,
                "price": "10",
                "amount": "1",
                "deal": "10",
                "fee": "0",
                "deal_order_id": 591041,
                "market": "BTCTRY"
            },
            {
                "time": 1572028345.815899,
                "id": 214827,
                "side": 2,
                "role": 2,
                "price": "20",
                "amount": "0.001",
                "deal": "0.02",
                "fee": "0",
                "deal_order_id": 590464,
                "market": "BTCTRY"
            }
        ]
    }
}

buy_limit
Success-Response:
{
    "errors": null,
    "result": {
        "id": 703619,
        "market": "BTCTRY",
        "source": "api",
        "type": 1,
        "side": 2,
        "ctime": 1575456329.437614,
        "mtime": 1575456329.437624,
        "price": "12340",
        "amount": "0.001",
        "taker_fee": "0",
        "maker_fee": "0",
        "left": "0e-8",
        "deal_stock": "0.001",
        "deal_money": "12.34",
        "deal_fee": "0e-12"
    }
}

buy_market
Success-Response:
{
    "errors": null,
    "result": {
        "id": 703625,
        "market": "BTCTRY",
        "source": "api",
        "type": 2,
        "side": 2,
        "ctime": 1575458371.988324,
        "mtime": 1575458371.988339,
        "price": "0",
        "amount": "100",
        "taker_fee": "0",
        "maker_fee": "0",
        "left": "0.0000952",
        "deal_stock": "0.00810372",
        "deal_money": "99.9999048",
        "deal_fee": "0e-12"
    }
}

sell_limit
Success-Response:
{
    "errors": null,
    "result": {
        "id": 703626,
        "market": "BTCTRY",
        "source": "api",
        "type": 1,
        "side": 1,
        "ctime": 1575458715.920797,
        "mtime": 1575458715.920797,
        "price": "12340",
        "amount": "0.3",
        "taker_fee": "0",
        "maker_fee": "0",
        "left": "0.3",
        "deal_stock": "0",
        "deal_money": "0",
        "deal_fee": "0"
    }
}

sell_market
Success-Response:
{
    "errors": null,
    "result": {
        "id": 703627,
        "market": "BTCTRY",
        "source": "api",
        "type": 2,
        "side": 1,
        "ctime": 1575458989.680405,
        "mtime": 1575458989.681919,
        "price": "0",
        "amount": "0.3",
        "taker_fee": "0",
        "maker_fee": "0",
        "left": "0e-8",
        "deal_stock": "0.3",
        "deal_money": "3645",
        "deal_fee": "0e-14"
    }
}

cancel_order
Success-Response:
{
    "errors": null,
    "result": []
}

get_balance
Success-Response:
{
    "error": null,
    "result": {
        "TRY": {
            "available": "0.0038",
            "freeze": "0"
        },
        "BTC": {
            "available": "0",
            "freeze": "0"
        },
        "ETH": {
            "available": "0",
            "freeze": "0"
        },
    }
}

Errors

Http Errors
HTTP/1.1 404 Not Found
 {
   "error":{
      "code":404,
      "message":null
   },
   "result":null
}
API Errors
HTTP/1.1 406 Not Acceptable
{
   "error":{
      "code":620,
      "message":"registration failed"
   },
   "result":null
}
Validation Errors
HTTP/1.1 406 Not Acceptable
{
   "error":{
      "code":619,
      "message":"The asset field is required."
   },
   "result":{
      "validation":{
         "asset":[
            "The asset field is required."
         ]
      }
   }
}

List of Error Messages

Http Errors:

Code | Message --- | --- 401 | Unauthorized 404 | Not Found 406 | Not Acceptable 500 | Internal Server Error

Api Errors

Code | Message --- | --- 429 | Too many request 600 | Api key required 601 | Api key no valid 604 | User not found 605 | Below min level 606 | Invalid credentials 607 | Account disabled 608 | White list unauthorized ip 609 | Authorization token required 610 | Authorization token mismatch 611 | Invalid tonce 612 | Market limit order creation failed 613 | Market order creation failed 614 | Market order cancelation failed 619 | Parameters validation failed 630 | Amount must exceed transfer fee 634 | Wallet not found 639 | Only https connections allowed 641 | Wallet creation failed 651 | Transfer failed please contact us 652 | The amount must exceed minimum transfer limit 657 | Location lock 658 | Invalid captcha 659 | White list toggle failed 660 | White list add new failed 661 | White list delete failed 673 | Selected nationality denied asset