Is it possible to indicate custom column names for the OHLC data? I receive some candle data from Oanda as 'o','h','l','c', and volume: 'v'. However when trying to plot it will ask for names with uppercase as "Open","Low",etc.
I would like to know if there is a way I can pass an argument indicating the naming convention I am using so that I don't need to modify the dataframe or saved files.
Thanks for developing this library. It makes plotting financial data so much easier than the old mpl-finance module.
Hi,
you could rename the columns with DataFrame and if you do it in the function call of mpf.plot(), then the changes wouldn't affect the original DataFrame.
import pandas as pd
import numpy as np
def some_fun(my_frame):
print(my_frame)
a_frame = pd.DataFrame(np.random.rand(2, 4),
columns=['o', 'h', 'l', 'c'])
print(a_frame)
some_fun(a_frame.rename(columns={'o': 'Open',
'h': 'High',
'l': 'Low',
'c': 'Close'}))
print(a_frame)
regards
Gregory
Thanks. I will use that solution for now.
In addition to the above solution, would a kwarg to mpf.plot() as colnames=dict(open='o',close='c',...) be ideally preferred to the above solution?
I think that addition would be great and make it more generalized
On Wed, Feb 5, 2020, 1:29 PM Daniel Goldfarb notifications@github.com
wrote:
In addition to the above solution, would a kwarg to mpf.plot() as
colnames=dict(open='o',close='c',...) be ideally preferred to the above
solution?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/matplotlib/mplfinance/issues/23?email_source=notifications&email_token=AED77II3LXMVG5QGFXPYAFTRBLZOPA5CNFSM4KPHEWLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK4JADA#issuecomment-582520844,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AED77IMNBP3PFTPM42DJ56TRBLZOPANCNFSM4KPHEWLA
.
Hello Daniel,
For me that would be a low priority Feature, since it wouldn‘t save that much typing in comparison to the posted solution.
In my use case I fetch the data from a SQLite database or yahoo finance and then I create and resample the Dataframe on the fly with the appropriate column names.
Regards
Gregory
closing, but will leave it as a pinned issue, since @schorschie provided an excellent answer for all who have the same question.
Most helpful comment
Hi,
you could rename the columns with
DataFrameand if you do it in the function call ofmpf.plot(), then the changes wouldn't affect the originalDataFrame.regards
Gregory