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 🙏

© 2024 – Pkg Stats / Ryan Hefner

renko-updater

v0.0.111

Published

given ohlcv candles, produce a stream of 'permanent' renko bricks with a callback

Downloads

8

Readme

renko-updater

given ohlcv candles, produce renko bricks with a callback

note this is different than the way most renko charts are plotted because here each brick is 'set in stone', whereas renko charts normally are re-plotted based on the ATR of the last candle

experimental, use at your own risk

Installation

npm i renko-updater

Usage

var candles = require('candles-sample-aapl').loadNMinuteCandles(60).slice(50);

var drawRenko = require('renko-chart-ascii').drawRenko;
var RenkoUpdater = require('renko-updater').RenkoUpdater;

var onBrickEmitted=function(brick, candle){
    // console.log('got brick', brick, candle);
    // {
    //     direction: 'down',
    //     size: 0.9779076923076935,
    //     isLastBrickForThisCandle: true //because some candles can spawn more than 1 brick!
    // }
}
var atrLen = 14;

//new RenkoUpdater(candles, onBrickEmitted=function(){}, upChar="/",downChar="\\", atrLen=14, MAX_BRICKS_PER_CANDLE=20, lastBrickPerCandleOnly=false, fixedBrickSize=0) //MAX_BRICKS_PER_CANDLE prevent inf loop from weird edge cases like zero atr
var RU = new RenkoUpdater(candles.slice(0,100),onBrickEmitted,"/","\\",atrLen);
var restOfCandles = candles.slice(100);

var i = 0;
var graphString = "";
var interval = setInterval(function(){
    if(i<restOfCandles.length){
        //addCandle(candle, doAddTrail=false, renkoTrailLength=10, doAddMarkov=false, markovLength=renkoTrailLength, markovRetrainNow=candles.length%100==0, markovDists = [1])
        RU.addCandle(restOfCandles[i]);
        var newGraphString = drawRenko(RU.renkoString.slice(-20),"/","\\",true);
        if(newGraphString!==graphString){
            graphString = newGraphString;
            console.log(graphString);
        }
        i++;
    }else{
        clearInterval(interval);
        console.log('end of candles');
    }
},100);

// \
//  \            /\     
//   \          /  \  / 
//    \        /    \/  
//     \      /         
//      \    /          
//       \  /           
//        \/            
//
// end of candles

//example of augmented candle with "renko trail" + markov expectation 

{
  date: '2022-10-03T16:38:00.000Z',
  open: 141.195,
  high: 141.295,
  low: 141.195,
  close: 141.295,
  bid: 141.19,
  ask: 141.2,
  volume: 299019,
  nSrcCandles: 2,
  renkoTrail: '///\\\\\\////',
  renkoMarkovProbsUp: [ 0.6842105263157895 ], //arr of results based on n-periods-to-predict-into-future specified in markovDists [warning -- values beyond [1] produce weird results]
  renkoMarkovProbsDown: [ 0.3157894736842105 ],
  renkoMarkovTransitions: { '/': 52, '\\': 24 } //transitions from current context
}

stonks