samjtro / ttrader

algorithmic terminal trading using go-tda

Home Page:https://github.com/samjtro/go-tda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VWAP calculation doesn't seem right

samjtro opened this issue · comments

I am used to the VWAP returning a value +-20% of the stock's Closing price, and yet I'm getting a decimal val 0-0.99. Not sure if this is an indication I am supposed to be doing something with this information. I need to do a bit more research into the calculation I've done, which is fairly straightforward (listed below).

vwap = (Hi + Lo + Close) / Vol

I will try to investigate for this issue, but i think i must start with you https://github.com/samjtro/go-tda, am i right? Because i want to run this repo, but i got 2022/08/09 14:39:13 Config File "tda-config" Not Found in message.

Hmm. That's interesting; it should be working just fine. What platform are you working on?

As well, did you go through the instructions located in the README.md relating to the tda-config.env file? Essentially it's just a .env file for your TD APIKEY as well as your Time Difference for proper Timestamping. Required as the library uses the TDAmeritrade API, which is protected from Unauthorized Requests by said APIKEY.

I am working on MacOS, i will go through README.md, btw, i have PR that updating .gitignore for Goland IDE

Just merged! Appreciate the work on that. Yeah you should quickly run through it; it takes about 5-minutes to get set up and then you get infinite TD-Ameritrade requests through their API.

Basically, just create a file called "tda-config.env"; move it to your home directory; store the following information in it:
APIKEY=YourAPIKEY (found by creating an app at https://developer.tdameritrade.com/)
UTC_DIFF=YourUTCTimeDifference (e.g. for me that is -06:00 in Mountain Standard Time in the US)

Fixed via commit: 9e62836

Thought I was doing something wrong and I was, the calculation for VWAP isn't (Hi + Lo + Close) / 3 it's (((Hi + Lo + Close) / 3) * Volume) / Volume.

@tanryberdi - I ended up just wrapping this one up. I will be opening a few more issues for MACD & Chaikin Indicators. If you want the assignments just let me know, I'd be happy to give them to you.

Let me know when you create issues

Added both of them! The Chaikin issue is definitely more complex, but if you'd like to give a crack at either just leave a comment on the issue. Thanks a ton!