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

finscript-beta

v0.0.2-alpha

Published

Alpha version

Downloads

13

Readme

This is an npm package for Finscript Library

Finscript

Technical analysis domain specific language for creating reusable indicator calculator

Demo

Doc

Primitive types

  • Number:
a = 1
b = 2.3
  • Boolean
a = true
b = false
  • String
a = 'blah blah'
b = "blah blah"
c = '中文'
  • Object
a = {}
b = { a: 1, b: 2 }
c = { a, b }
d = { c, f: {} }
  • Array
a = [1, 2, 3]
b = [{ open: 10, close: 12 }, { open: 12, close: 14 }]
  • Color
a = #fff
b = #123456
c = #123456ff
  • Null
a = null

Comment

  • Single-line comment
// FIXME
  • Multi-line comment
/*
  blah
  blah
  blah
*/

Operator

  • Assign:=
  • Add:+
  • Subtract:-
  • Multiply:*
  • Divide:/
  • Modulus:%
  • Pow:^
  • Greater than:>
  • Less than:<
  • Greater than or equal:>=
  • Less than or equal:<=
  • Equal:==
  • Not equal:!==
  • And:and
  • Or:or
  • Not:not
  • Conditional operator: condition ? expression : expression

statement

  • if statement:
if a ==1 :
  // do something
else if a == 2:
  // do something
end
  • For loop:
for i in array:
  // do something
end
  • While loop:
while true:
  // do something
end

Function

  • Function declaration:
def print(a):
  Console.log(a)
end
  • Arrow function:
add = (a, b) => a + b
inc = a => a + 1
  • Function call:
Console.log(1)

Indicator operator

  • Open price:OPEN O

  • Close price:CLOSE C

  • High price:HIGH H

  • Low price:LOW L

  • Bar volume:VOLUME V VOL

  • Absolute value:ABS

ABS(O - C)
  • Arctangent:ATAN
ATAN(C)
  • Ceil: CEIL
CEIL(2.3) // 3
  • Constant:CONST
CONST(1)
  • Cosine:COS
COS(C)
  • Count bars if condition is true:COUNT
COUNT(CLOSE > OPEN, 10)
  • Exponentially weighted moving average:EMA
EMA(C, 10)
  • Exponential Function: EXP
EXP(2) // e^2
  • Expmema: EXPMEMA
EXPMEMA(C, 10)
  • Floor: FLOOR
FLOOR(2.5) // 2
  • Max value of n bars:HHV
HHV(MAX(O, C), 60)
  • Min value of n bars:LLV
LLV(MIN(O, C), 60)
  • Natural logarithm:LN
LN(C)
  • Base-10 logarithmic:LOG
LOG(C)
  • Moving average:MA
MA(C, 60)
  • Greater of two or more values:MAX
MAX(O, C)
MAX(O, C, 100)
  • Smaller of two or more values:MIN
MIN(O, C)
MIN(O, C, 100, REF(C, 1))
  • Mathematical power function: POW
POW(C, 2)
  • Round: ROUND
ROUND(C)
  • Previous values :REF
REF(C, 10)
  • Sar:SAR
step = 2
  • Sine:COS
SIN(C)
  • Simple moving average:SMA
SMA(C, 10)
  • Square root :SQRT
SQRT(C)
  • Standard deviation:STD
STD(C, 10)
  • Sliding sum: SUM
SUM(C, 10)
  • Trigonometric tangent:TAN
TAN(C)

Creating new operator

prevClose = REF(C, 1)
prevLow = REF(L, 1)
true_range = MAX(H - L, H - prevLow, L - prevClose)

Indicator

Checkout demo

Built-in funciton

Number

  • Number.parseInt
  • Number.parseFloat
  • Number.prototype.toExponential
  • Number.prototype.toFixed
  • Number.prototype.toPrecision

Console

  • Console.log