-
Notifications
You must be signed in to change notification settings - Fork 4
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
The "fetch" method returns data till the first "None" value in OHLS cande #2
Comments
OK interesting thanks. Seems we could do with a fix to the parse module to pass things through and either return the parsed value or the raw value if the parse fails. Your suggestion is good but i think we can be even a bit smarter and pick up any exceptions. |
Looks good and it depends by your decision. I just want to add some info: I use your module to calculate technical indicators (ema, macd, rsi etc). And for them don't need any None (on Null) values. They need only known values. |
OK here's the solution I am suggesting. Like you say, we can skip candles that have values that cannot be parsed (None values). But doing that silently is probably unhelpful for some people as it can just drop candles without people realising it. So I've added in a warning that is raised when that happens. It doesn't stop the flow but does raise the issue. And of course if someone wants that original info they can still go back and use the Here's the code. I am making the changes now and adding some tests. for time, open, high, low, close, volume in zip(
timestamps,
indicators["open"],
indicators["high"],
indicators["low"],
indicators["close"],
indicators["volume"],
):
try:
candles.append(
{
"datetime": time,
"open": float(open),
"high": float(high),
"low": float(low),
"close": float(close),
"volume": float(volume),
}
)
except TypeError as e:
warnings.warn(
f"Unable to parse some of the candle values at time period {time} - Skipping this candle and continuing."
)
return candles, meta |
OK I have released version Thanks for your help. Closing this issue now |
That sounds good The pandas-ta library is very good for these sorts of
indicators too. Providing you are comfortable with pandas.
…On Thu, 19 May 2022 at 09:58, DmitrySSidorov ***@***.***> wrote:
And I'd like to show, how looks GTX stock in tradingview (picture below):
look at the vertical white lines. It's the trading day borders. Some days
are "narrow". It means that tradingview skips empty values in the graph.
[image: image]
<https://user-images.githubusercontent.com/40357124/169254226-a2977bd7-6f4a-4d87-8949-b34c86d2af4b.png>
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF2ZJETE6KU2UX6676ZASBTVKX7ERANCNFSM5WE7OWFA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
How to check it: try to fetch data by GTX stock with 15m interval and 1 month history. It returns about 30 ohls values.
I propose to skip None values in returning data like this (api.py):
if close != None:
else:
continue
The text was updated successfully, but these errors were encountered: