TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.49k stars 1.74k forks source link

VWAP with Bands #506

Open hhashim1 opened 2 years ago

hhashim1 commented 2 years ago

Any possibility of adding VWAP with Bands to the ta-lib library? If so, can the input for bands be a list of st dev so that we can get multiple bands as outputs in one function call as opposed to running the same function for multiple bands?

mrjbq7 commented 2 years ago

That would be cool, but this is just a wrapper for https://ta-lib.org and so upstream is a better approach.

hhashim1 commented 2 years ago

What do you mean upstream would be a better approach?

mrjbq7 commented 2 years ago

I'm not sure who is the current maintainer of the ta-lib C library, but that would be a good place to contribute this.

hhashim1 commented 2 years ago

I dont think its been updated in the past decade lol but I will try to share my idea there

mrjbq7 commented 2 years ago

Yeah, thats a problem -- we made a fork at https://github.com/ta-lib/ta-lib with the idea that maybe it could be maintained by others, but I don't know who is currently responsible for the ta-lib.org website and making new releases there...

hhashim1 commented 2 years ago

So, since you made a copy/fork of the original ta-lib.org, is your wrapper currently using your fork, and are you able to add new indicators?

mrjbq7 commented 2 years ago

My wrapper uses whatever you have installed, which most frequently is the ta-lib-0.4.0 release on ta-lib.org...

there is another fork that adds some improvements to the streaming / real-time interface (https://github.com/trufanov-nok/ta-lib-rt). It would be really nice to be able to make improvements to TA-Lib...

hhashim1 commented 2 years ago

I have been able to overcome the challenge of RT updates by using another system that has made it possible (it is written in Java however it has Python integration). I was using pandas-ta which has lots of indicators and is constantly updated with new indicators however it uses pandas which does not work with RT data updates as the integration creates a disconnect with the real-time data. When converting to pandas, you have to get a snapshot of the data and create a dataframe from it but then you cannot easily sync the data with the RT dataset and keep it updated.

Hence, I am using your library ta-lib which uses helps me stay synced with RT data. However, there are some indicators that are lacking since TA-Lib.org has not been updated in many years. If we can figure out how to add more indicators to your repo then I can help you with RT data using the other system I am using. I think it would be a great progression of this solution.

What do you think?

trufanov-nok commented 2 years ago

I'm the TA-Lib RT fork maintainer. I don't quite understand what's the problem with its usage with your RT system, but guess there might be some. Anyway it's supposed to be compatible with TA-Lib while keeping in mind that it's based on a most [recent] TA-Lib copy (https://github.com/trufanov-nok/ta-lib-rt/wiki/Compatibility-with-TA-Lib) and contain some bigfixes, so differs a bit. As for addition of a new indicator into TA-Lib (both RT and original) I wrote an article here: https://github.com/trufanov-nok/ta-lib-rt/wiki/Adding-new-TA-function. It's applicable for both original and the forks. But I doubt that VWAP with Bands to the ta-lib library? If so, can the input for bands be a list of st dev so that we can get multiple bands as outputs in one function call as opposed to running the same function for multiple bands? should be into the library. Isn't it too specific usecase? You may fork the lib and implement it on C side if you need a performance or implement the logic on python side it it's feasible.

hhashim1 commented 2 years ago

VWAP is not too specific..It's used very commonly. The only modification I have added to the input is the band/stdev list. usually its a single value like Bollinger bands however people that use multiple bands would need to run this function multiple times thereby slowing down the system unnecessarily. With a list as input, the function would loop through and get you all the st dev bands. I have the logic for it. I just don't know C or even NumPy well enough to convert from pandas to either of the two above languages. For those that just need a single band, they would only pass a single value in the list with no downside to them.

I hope that clarifies.