Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Might it make sense to include an example? #90

Open
brandonros opened this issue Jun 19, 2022 · 2 comments
Open

Might it make sense to include an example? #90

brandonros opened this issue Jun 19, 2022 · 2 comments

Comments

@brandonros
Copy link
Contributor

The documentation on this repo is amazing. Really great work, seriously.

import fs from 'fs'
import {
  newAssetWithLength,
  backtest,
  STRATEGY_INFOS
} from 'indicatorts'

const candlesToAsset = (candles) => {
  const asset = newAssetWithLength(candles.length)
  for (let i = 0; i < candles.length; ++i) {
    asset.dates[i] = new Date(candles[i].time * 1000)
    asset.openings[i] = candles[i].open
    asset.closings[i] = candles[i].close
    asset.highs[i] = candles[i].high
    asset.lows[i] = candles[i].low
    asset.volumes[i] = candles[i].volume
  }
  return asset
}

const candles = JSON.parse(fs.readFileSync('/tmp/candles.json'))
const asset = candlesToAsset(candles)
const results = backtest(asset, STRATEGY_INFOS)
results.sort((a, b) => {
  return b.gain - a.gain
})
console.log(results)

Curious if something like this being around in an examples/ folder or something would help somebody?

@cinar
Copy link
Owner

cinar commented Jun 19, 2022

Thank you very much for your kinds words! Please let me know if you see other areas that the package can be further improved. Yes, I didn't include much examples. Having some examples is definitely be helpful. In order to make unit testing easier, I am planning to include some data sets, and also functions to load data from CSV (and also your JSON function), and perhaps then it will be even easier to add some some examples. Let me take a look at it, and please send over any ideas that you have.

@brandonros
Copy link
Contributor Author

Maybe instead of returning lastAction from strategy backtest results you return the entire array of actions?

I see this repo is basically a clone of your Go repo. Has you Go repo gotten more traction?

Repos like this are always nice to have but I never know who actually uses them. In this field, you're typically dominated by TradingView and QuantConnect, right?

How can we bring this repo from "cute" to "can't live without it" in this field, given the steep competition in this field?

It's easy to be overloaded by data in the context of quant/algo stuff. How to make that data more than "useless" (aka lead to some profits, making the data and indicators and strategies useful) is the interesting part.

Not only would some examples be cool, but...

maybe posting a strategy or two that would beat "buy and hold long" or "sell and hold short" based on TA/all of the indicators you have would be cool.

Otherwise it becomes a list of strategies people can point to that... don't beat buy and hold. What are they worth then? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants