Comments (7)
@lukesneeringer Hi.
This question was already raised in #15 .
I tend to say that we do not need it and close the issue, but I'd like to hear from you what is the necessity to have Decimal support?
from ta-rs.
Decimals important for storing money and making operations with money, I do agree. But this does not apply to technical analysis.
I would argue that precision of f64
is more than needed for TA, and it's not enough, then you're probably fooling yourself, thinking that being super precise gives an advantage to your trading strategy.
As Warren Buffet once said: "It is better to be approximately right than precisely wrong."
meaning if I give my users a f64 in some places and a decimal in others, comparing them or manipulating them is more difficult than it ought to be.
You can implement a wrapper around the existing indactors, that would convert f64 -> Decimal. But generally I would suggest.. just convert the values where you want to do comparison. Moving averages, is probably the only case when you actually want to compare prices with indicator values.
from ta-rs.
@lukesneeringer Hi, thanks for reaching me.
I still hold the same opinion as before (decimal is MUST for prices, money amounts in bookkeeping, but not for TA indicators).
Unfortunately I don't have much spare time at the moment to dedicate to ta
.
I am not sure what to suggest. Maybe you can do it a for 2-3 indicators and ask me to take a look?
from ta-rs.
That's fair. I think I know how this should be done that would work well. I'll send you a PR.
from ta-rs.
My reason is basically the same as the one in #15: I am trying to avoid the use of floats; every number in the project is an integer or a decimal.
I agree that for many of the outputs of ta
, precision is less important, but it is not unimportant. Also, a lot of the folks writing against the API I am writing are less technical and I do not want to give them one sub-integer type consistently. This is also important because decimals support all the arithmetic operators with each other, but not with f64s -- meaning if I give my users a f64 in some places and a decimal in others, comparing them or manipulating them is more difficult than it ought to be.
I also expect this can be done in a reasonably generic way to not add very much code duplication. rust_decimal::Decimal
supports all the arithmetic traits, after all.
from ta-rs.
then you're probably fooling yourself, thinking that being super precise gives an advantage to your trading strategy.
It is not so much that I think the precision of decimals is critical in this case. I am much more interested in API simplicity. I want my folks to work with decimals all the time rather than having to take on converting between decimals and floats.
from ta-rs.
@greyblake Following up on this, because it's still something I am hoping for. I'm willing to implement it myself, but I don't want to do it if you're going to reject the PR. :-)
I'd do it behind a feature gate, so it won't affect anyone who doesn't want it.
from ta-rs.
Related Issues (20)
- Any interest in serde support? HOT 2
- Feature request: Hull moving average HOT 3
- Give to Typical Price his own structure ? HOT 2
- Get rid of error-chain dependency.
- RSI value does NOT match expected values HOT 10
- DataItemIncomplete when trying to unwrap DataItem build HOT 2
- How to use special inputs like ohlc4? HOT 1
- ATR value doesn't match expected values HOT 1
- Would it be possible to limit the number of input values? HOT 2
- Why is a complete DataItem needed? HOT 3
- wonder how to handle big number, like for cryptocurrency HOT 1
- Keeping track of number updates HOT 1
- Change `usize` to `std::num::NonZeroUsize` in `new()` methods
- Add DX/DMI & ADX HOT 2
- VolumeWeightAdjustedPrice (VWAP)
- [help]Test used times. HOT 1
- Failing regression tests from original TA Lib HOT 5
- Request Fractals Pattern Indicator
- Second/subsequent iterations of `EfficiencyRatio` is `NaN` when price is stationary.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ta-rs.