Closed pssolanki111 closed 4 years ago
You need to arrange your timestamps in order (they're reversed in the CSV and JSON):
import finplot as fplt
df = fplt.pd.read_csv('intraday_5min_IBM.csv', parse_dates=['timestamp'], index_col='timestamp').sort_index()
fplt.candlestick_ochl(df[['open','close','high','low']])
fplt.show()
(Note that some 5 minute intervals are missing in your data, but they are simply left out when plotting.)
@highfestiva Thanks for your response. I'll try the suggestion in a bit and let you know. On an unrelated topic, I tried your games and honestly they were fun :D. I liked that NSAgent & kill cutie the most.
I've got 2 questions now--
Did you check the json one as well? there seems to something wrong with that as well. Although that's not much important, I can work csv instead. But It would be better to have options.
Is is possible to plot more than one finplot graphs for different CSVs, and is there a way to update the graphs every one hour (I know how to schedule events, I'm just asking if finplot allows changing the plot in-place or like in the same graph window ) or do i have to close the current windows with graphs and plot them again with different data. I mean how does that work.
Thank you for the amazing work again :)
@highfestiva It worked!! It took a bit time to draw but I'll take that considering I've got a potato system..
You can redraw your graphs every hour if you wish. Look at the runtime examples to help you get going (example-bfx, examply-bitmex-ws). There are also some closed issue here where someone asks for the same thing.
Thank you. I'll take a look :). Istimer_callback()
an equivalent of .after()
of tkinter
, which calls a function after a given period of time? I'm looking at example-bfx.py
RN and what I understand is, usetimer_callback()
to schedule data updates, and use plot.update_data()
to redraw the graph with new data. Is that correct?
if it is, I'll have to figure out a way to make things synchronized in multi-processed environment. But I could manage that, also that has nothing to do with this 'seriously' amazing lib.
on another topic,
when I used the code you wrote above, it plots the data fine. But when i write that df
data back to a csv
, it always skips that timestamp
column. I want to be able to write that timestamp
column as well.
And if possible, is there is a way to draw finplot
graphs directly from csv
files, without creating pandas df
? like maybe using csv.DictReader()
or something?
Function defined like so: def timer_callback(update_func, seconds, single_shot=False)
.
To set timestamp back as a column, as opposed to an index, use df = df.reset_index()
.
You can supply arrays directly, or use numpy arrays, you don't have to use pandas. Although pandas is always used internally in finplot.
Thank you for the information, Jonas! appreciate it. Thanks again..
Can you ask me, I just want each graph display, the default graph will enlarge and display exactly 100 candles and move to the end like pressing the "End" button?
HERE is the small CSV file that I'm getting from an API. I tried to follow your docs to plot this but I'm getting all sorts of troubles in doing that. This is the code I tried it with
data.csv being the csv file. It just takes quite long then execution stops without any error message.
I'd appreciate any help on how to get just a simple plot, nothing fancy or additional layout in there with a simple CSV file?
Moreover they do have an API which reckons about sending data in json, HERE but that doesn't work either.
I'd appreciate any help on either of the cases, preferably on the json one, but csv one is also equally appreciable.
Thank You for the amazing tool btw. I stumbled upon one of your answers on SO and here I am :)