Chart updating using keyboard input (Trading strategy "debug" mode) #197
-
First of all I want to express how glad I am to find this repo. I was surprised how few options for chatting there were online. Now for my issue: My current plan is to get some multithreading going where one thread keeps track of input and inserts it into a pipe, meanwhile another thread has the timer_callback running in which the update function checks whether there is anything in the pipe. Does any better solution come to mind or is this the way to go? Kind regards. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Perhaps overriding if ev.key() == QtCore.Qt.Key_Left:
vb.pan_x(steps=-1)
elif ev.key() == QtCore.Qt.Key_Right:
vb.pan_x(steps=+1) Lemmeknow if there are some bugs, don't think I ever tested the |
Beta Was this translation helpful? Give feedback.
-
I'm looking for something more like updating the data on each key_press. elif ev.text() == 'a':
candlestickChart = vb.win.axs[0].items[4]
candlestickChart.last_index -= 1
df_insert = candlestickChart.df.loc[0:candlestickChart.last_index, ['date', 'open', 'close', 'high', 'low']]
candlestickChart.update_data(df_insert) |
Beta Was this translation helpful? Give feedback.
-
I didn't realize it was possible to use the financial chart as a widget inside of a larger PyQt application using the following: self.fplt_widget = pg.PlotWidget(plotItem=fplt.create_plot_widget(self.window())) Now I can simply update the chart by calling This all seems kind of obvious now, but hopefully it helps someone along the way. |
Beta Was this translation helpful? Give feedback.
Perhaps overriding
fplt._key_pressed
is a nice way to start? Perhaps implemented something like this:Lemmeknow if there are some bugs, don't think I ever tested the
steps
implementation (only used thepercent
parameter).