mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

OHLCV data challenge with mplfinance

Open manniokim opened this issue 2 years ago • 21 comments

Ask anything you want about mplfinance usage, project philosophy and/or priorities, or anything else related to mplfinance.

hello, I am new to data processing with pandas and python programming generally, I am working with a large crypto ohlcv dataset from a database. I need to answer some questions from the dataset, questions like

1)which day of the week shows the greatest change in price? 2)which hour of the day shows the greatest change in price? 3)looking at weekly data, to what extent can the Thursday - Sunday price change be predicted based on the movements from Monday - Wednesday? 4)looking at weekly data, does the weekday pricing data provide any predictive clues to what will happen by the end of the weekend?

so far, I've been able to extract the data, set timestamp as index and tried to resample the data,plot the data in mplfinance but I have two challenges, I can't present the data as days of the week eg. Thursday and the picture from the plot doesn't answer my questions.is there a way for me to aswer this questions using the timestamp as it is? I tried the alternative of creating a new data frame with just the variables I need (open, high,low,close,volume,date, time, day of the week) but this data won't plot in mplfinance. I would appreciate any help with this issue . Thank you

manniokim avatar Jul 23 '21 06:07 manniokim

@manniokim Hi. Thank you for contributing your issue to mplfinance. I have some idea what you are trying to accomplish, but it is not entirely clear to me. Also, while helpful, it is very tedious to go through in detail all of the images of your notebook.

Would you be willing to post your notebook, as it is in these pictures (that is, with both inputs and outputs) to a github repository or gist and give me access to it? That way I can possibly clone it and see if I can solve the issue you are having.

Thanks again. All the best. --Daniel

DanielGoldfarb avatar Jul 23 '21 13:07 DanielGoldfarb

@manniokim Hi. Thank you for contributing your issue to mplfinance. I have some idea what you are trying to accomplish, but it is not entirely clear to me. Also, while helpful, it is very tedious to go through in detail all of the images of your notebook.

Would you be willing to post your notebook, as it is in these pictures (that is, with both inputs and outputs) to a github repository or gist and give me access to it? That way I can possibly clone it and see if I can solve the issue you are having.

Thanks again. All the best. --Daniel

manniokim avatar Jul 23 '21 18:07 manniokim

@DanielGoldfarb I have posted the notebook and given you access to it. thank you.

manniokim avatar Jul 23 '21 18:07 manniokim

@manniokim Thanks. I see the notebook now. I will try to take a look in the next day or two. All the best. --D.

DanielGoldfarb avatar Jul 23 '21 19:07 DanielGoldfarb

@manniokim ... Can you please add please add the file list.csv to the repository? Thanks.

DanielGoldfarb avatar Jul 23 '21 19:07 DanielGoldfarb

@DanielGoldfarb done, thank you

manniokim avatar Jul 24 '21 00:07 manniokim

Hi @DanielGoldfarb checking in

manniokim avatar Jul 26 '21 10:07 manniokim

@manniokim
I still don't see list.csv in the repository. I can see the results of it in the notebook, which is helpful. And I believe that I can give you some ideas as to how to answer your questions. But I think I may be able to give you a more complete answer if I run your notebook and play around with the data some. However if I clone the repository and run your notebook, I think it will fail on pd.read_csv('list.csv') because I don't see the csv file in the repository. (You need to git add list.csv and then git commit).

I am hoping later today (a few hours from now) to have some time to look into this and respond.

DanielGoldfarb avatar Jul 26 '21 11:07 DanielGoldfarb

@DanielGoldfarb I'm sorry for the oversight. I have now added it

manniokim avatar Jul 26 '21 12:07 manniokim

@DanielGoldfarb checking in

manniokim avatar Jul 27 '21 01:07 manniokim

I have access to the csv file, everything I need ... I just haven't had time with other projects. Hope to look at this early next week.

DanielGoldfarb avatar Jul 30 '21 21:07 DanielGoldfarb

Thank you

manniokim avatar Aug 02 '21 21:08 manniokim

@DanielGoldfarb Hi, I was able to find way around using Vlines. I was also able to answer the questions , however I still need help answering the question with the data as an aggregate not singly. I appreciate if you can spare some time to guide me.

manniokim avatar Aug 06 '21 04:08 manniokim

@DanielGoldfarb I have invited you as collaborator on the new repo

manniokim avatar Aug 06 '21 04:08 manniokim

@DanielGoldfarb I have invited you as collaborator on the new repo

@manniokim Okim, very nice job on the notebook, very organized and clear.


@DanielGoldfarb Hi, I was able to find way around using Vlines. I was also able to answer the questions , however I still need help answering the question with the data as an aggregate not singly. I appreciate if you can spare some time to guide me.

So just to clarify what you mean by "answering the question with the data as an aggregate not singly" ... I see, for example, your first question "Which day of the week shows the greatest change in price?" you have answered "The day that shows the greatest change in price is the 9th of June which is a Wednesday with an opening price of 37500 and a closing price of 36,200."

Based on this, I would assume by "as an aggregate not singly" you mean that you want to compare all Mondays in aggregate, to all Tuesdays in aggregate, to all Wednesdays, in aggregate, etc. Is this correct?

If so, then the question becomes, how best to aggregate them to make sense of the answer? For example, we see that one particular Wednesday has the absolute largest change, but maybe there are two or three Tuesdays that have then 2nd, 3rd, and 4th largest changes. If that were the case, then even though one Wednesday has the largest change of all, we see that large changes are more common on Tuesdays. Is that the type of "aggregate" question you are trying to answer?

DanielGoldfarb avatar Aug 06 '21 23:08 DanielGoldfarb

@DanielGoldfarb thank you. yes please, that is the type of aggregate question I'm trying to answer. eg. is it more profitable to trade on say Tuesdays than on Thursdays ? apologies for not framing the question clearly.

manniokim avatar Aug 06 '21 23:08 manniokim

@DanielGoldfarb Hi, checking in

manniokim avatar Aug 10 '21 09:08 manniokim

@manniokim Okim, the ohlcdata repository that contained "list.csv" is gone. Can you please add "list.csv" to the new "bitcoin_analysis" repository? Thanks. --Daniel

DanielGoldfarb avatar Aug 16 '21 16:08 DanielGoldfarb

@manniokim Okim, the ohlcdata repository that contained "list.csv" is gone. Can you please add "list.csv" to the new "bitcoin_analysis" repository? Thanks. --Daniel

so sorry about that, I have just done that

manniokim avatar Aug 16 '21 17:08 manniokim

@manniokim ... Thanks

DanielGoldfarb avatar Aug 16 '21 17:08 DanielGoldfarb

The issue raised by @manniokim is extremely relevant and very important to forex, options , commodity and stock traders. The additional time intervals required by intraday traders are: 3m, 5m, 10m, 15m, 30m, 1Hr, 2Hr, 4Hr. This is required for time frame analysis. Rather if the out put of time interval display and live 1m display can be in a single chart frame, it will be an icing on the cake!

I am not sure if the issue is completely answered and settled. If settled, I shall be glad to go through the solution.

The possible way is to find the date on which the swing in price is greatest or smallest and then by using calendar module, find the day of that date; though I am not completely sure! This requires additional coding.

Dr. Sai

Blessvskp avatar May 26 '23 15:05 Blessvskp