⚙️ Scalpyh v1.0: Creating a trading bot on the internal HIVE market

Good day everyone, I hope all is well.

Scalpyh (scalpy-hive) is a small open-source trading bot that operates on the internal Hive market. This bot uses the concept from candle-maker but now acts upon the data collected.
Written in Javacript.

❗Important notes❗:

  • Scalpy requires the Private Active Key in order to place market orders. Please be careful where you copy & paste this key.
  • Scalpyh currently only uses 2 basic indicators (ema + macd) to determine buy & sell flags. You are not guaranteed to make any profit using this script.
  • USE AT OWN RISK

Trading logic + strategy:

As indicated in the name, the bot uses the concept of scalping to try and make small profits on each trade (Minimum 0.001 HBD / HIVE).

Trading seems as simple as "Buy low -> sell high", but in reality, this concept is very hard to implement on any market. So to try and "predict" the movement of the market, scalpy (currently) uses the EMA(100) + MACD(12, 26, 9) technical indicators to determine ideal Buy / Sell opportunities.

buyHive() signal algo:

const tradingAlgo = (prevEma, prevmacd, prev2macd, preCandle) => {
    if ( parseFloat(preCandle.close) > parseFloat(prevEma)
        && parseFloat(prevmacd.MACD) > parseFloat(prevmacd.signal)
        && parseFloat(prev2macd.MACD) < parseFloat(prev2macd.signal) && parseFloat(prev2macd.MACD) < 0
        ) {
        return true;
    }
    return false
}



buyHbd() signal algo:

const tradingAlgoSell = (prevEma, prevmacd, prev2macd, preCandle) => {
    if ( parseFloat(preCandle.close) < parseFloat(prevEma)
        && parseFloat(prevmacd.MACD) < parseFloat(prevmacd.signal)
        && parseFloat(prev2macd.MACD) > parseFloat(prev2macd.signal) && parseFloat(prev2macd.MACD) > 0
        ) {
        return true;
    }
    return false
}

Buying one asset will automatically calculate the minimum profit & place an order (+ profit ) for the other asset.

Installation & Execution:
  • Clone this repo & cd into it
    git clone https://github.com/louis23412/scalpy-hive.git && cd scalpy-hive

  • Install dependencies
    npm install

  • Open settings.json & change as needed.

{
   "updateRate" : 3,
   "candleSize" : 1,
   "candleLimit" : 2000,

   "tradeSize" : 0.999,
   "username" : "usernameHere",
   "pKey" : "privateActiveKeyHere",
   "bKey" : "privatePostingKeyHere"
}

updateRate => The time interval in seconds at which the script will fetch the latest price data
candleSize => The time interval in minutes of each candle.
candleLimit => The max number of latest candles to keep in memory & local copy.

tradeSize => The quantity used to buy HBD / HIVE
username => The account name used to place market orders
pKey => The PRIVATE ACTIVE key used to place market orders
bKey => The PRIVATE POSTING key used to broadcast bot status every 30 candles

  • Save the config file, then run the bot
    npm start

That's all I have, for now, more updates coming soon.

--------------------------------------------------------------------------

Add me on Discord if you'd like to talk: CreepyPastaZ ψ(`∇´)ψ#1729

--------------------------------------------------------------------------