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

droid-rpc

v1.1.0

Published

connection to droid rpc

Readme

droid-rpc

A gRPC client instance as an interface for DROIDv3 server.

Installation

open your project folder and type:

npm install droid-rpc

Usage

This is an example on how to use the client

// we import the client
import { DroidClient } from "droid-rpc";

// initialise the client
// replace `localhost` with existing droidv3 server url
const client = new DroidClient('localhost',50065);

// prepare the payload
let payload ={
    ticker:"0005.HK",
    spot_date: "2021-01-01",
    investment_amount:100000,
    price:156.5,
    bot_id:"CLASSIC_classic_015384",
    margin:1,
    fraction:false
}

// and send it through the client instance
client.createBot(payload,(res) =>{
    console.log(res);
});

Parametres

  • client

    /**
     * @constructor
     * @param {String} url - DROIDv3 server URL
     * @param {Number} port - DROIDv3 server port 
     */
  • payload:

    • Create

      /**
       * @param {Object} payload - Payload to be sent
       * @param {String} payload.ticker - Ticker name
       * @param {String} payload.spot_date - Spot date
       * @param {Number} payload.investmen_amount - Amount to invest
       * @param {Number} payload.price - The price the investment is put in
       * @param {String} payload.bot_id - The bot id to be used
       * @param {Number} payload.margin - Margin used in the order
       * @param {Boolean} payload.fraction - Whether to allow fraction in share number
       */
    • Hedge

      /**
       * @param {String} bot_id
       * @param {String} ric
       * @param {Number} current_price
       * @param {Number} entry_price
       * @param {Number} last_share_num
       * @param {Number} last_hedge_delta
       * @param {Number} investment_amount
       * @param {Number} bot_cash_balance
       * @param {Number} stop_loss_price
       * @param {Number} take_profit_price
       * @param {String} expiry - date in format yyyy-mm-dd
       * @param {Number} [strike]
       * @param {Number} [strike_2]
       * @param {Number} [margin]
       * @param {Boolean} [fraction]
       * @param {Number} [option_price]
       * @param {Number} [barrier]
       * @param {Number} [current_low_price]
       * @param {Number} [current_high_price]
       * @param {Number} [ask_price]
       * @param {Number} [bid_price]
       * @param {String} [trading_day] - date in format yyyy-mm-dd
       */
    • Stop

      /**
       * @param {String} bot_id
       * @param {String} ric
       * @param {Number} current_price
       * @param {Number} entry_price
       * @param {Number} last_share_num
       * @param {Number} last_hedge_delta
       * @param {Number} investment_amount
       * @param {Number} bot_cash_balance
       * @param {Number} stop_loss_price
       * @param {Number} take_profit_price
       * @param {String} expiry - date in format yyyy-mm-dd
       * @param {Number} [strike]
       * @param {Number} [strike_2]
       * @param {Number} [margin]
       * @param {Boolean} [fraction]
       * @param {Number} [option_price]
       * @param {Number} [barrier]
       * @param {Number} [current_low_price]
       * @param {Number} [current_high_price]
       * @param {Number} [ask_price]
       * @param {Number} [bid_price]
       * @param {String} [trading_day] - date in format yyyy-mm-dd
       */

Client class methods

All of these methods has the same parametres:

/**
 * @param {Object} payload - the payload as described above
 * @param {createCallback|hedgeCallback|stopCallback} callback - the callback function
  • createBot - to create position and start the bot

    returns:

    /**
     * @callback createCallback
     * @param {String} ticker
     * @param {Number} share_num
     * @param {String} expiry
     * @param {String} spot_date
     * @param {String} created
     * @param {Number} total_bot_share_num
     * @param {Number} max_loss_pct
     * @param {Number} max_loss_price
     * @param {Number} max_loss_amount
     * @param {Number} target_profit_pct
     * @param {Number} target_profit_price
     * @param {Number} target_profit_amount
     * @param {Number} entry_price
     * @param {Number} margin
     * @param {String} bot_id
     * @param {Boolean} fraction
     * @param {String} side
     * @param {String} status
     * @param {Number} vol
     * @param {Number} classic_vol
     * @param {Number} strike_2
     * @param {Number} barrier
     * @param {Number} delta
     * @param {Number} option_price
     * @param {Number} q
     * @param {Number} r
     * @param {Number} strike
     * @param {Number} t
     * @param {Number} v1
     * @param {Number} v2
     */
  • hedgeBot - create a hedge position using payload params

    returns

    /**
     * @callback hedgeCallback
     * @param {Number} entry_price
     * @param {Number} current_price
     * @param {Number} share_num
     * @param {Number} total_bot_share_num
     * @param {Number} last_hedge_delta
     * @param {Number} share_change
     * @param {String} side
     * @param {String} status
     * @param {Number} strike_2
     * @param {Number} barrier
     * @param {Number} delta
     * @param {Number} option_price
     * @param {Number} q
     * @param {Number} r
     * @param {Number} strike
     * @param {Number} t
     * @param {Number} v1
     * @param {Number} v2
     */
  • stopBot - stop the bot and close the position

    returns:

    /**
     * @callback stopCallback
     * @param {Number} entry_price
     * @param {Number} current_price
     * @param {Number} share_num
     * @param {Number} total_bot_share_num
     * @param {Number} last_hedge_delta
     * @param {Number} share_change
     * @param {String} side
     * @param {String} status
     * @param {Number} strike_2
     * @param {Number} barrier
     * @param {Number} delta
     * @param {Number} option_price
     * @param {Number} q
     * @param {Number} r
     * @param {Number} strike
     * @param {Number} t
     * @param {Number} v1
     * @param {Number} v2
     */