-
Notifications
You must be signed in to change notification settings - Fork 59
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
add kagi chart #93
add kagi chart #93
Conversation
still need to add ability to define custom reversal amounts from config file and in the GUI
Very nice, thank you! |
Nice work! Although, shift+left & shift+right is captured by Konsole and Yakuake for switching tabs. Do you think we could perhaps use < (less than) and > (greater than)? Or we could ship with these defaults, and people like me with conflicting keybindings could use #65 when it's ready. EDIT: this works just fine for me in Alacritty. |
I also love that scrolling functionality, it might be very relevant in #80 (comment):
That can be further extended to support L-R scrolling when zoomed in to custom timeframes. EDIT: just realized you (@tarkah) already made that comment in #80 (comment)
|
Hmm.. that sucks its captured by such a common console. Maybe [ & ] would be sane defaults, or < & > like you said? Or I could have it capture both since I still like shift + arrows. Edit: Yeah, I think I will go with < & > on top of SHIFT + <- / -> |
That sounds reasonable, tbh I actually like shift+<-/-> too. I'll check if I can free up those bindings to actually be able to use them with tickrs. Again, love it! and thanks @alfredo-catalano for the chart suggestion. EDIT: I was able to disable those bindings in both terminals, so it works fine now. |
I guess, (for now), redundancy in the default keybindings can be okay but maybe after #65 (customizable keybindings), we can drop the <+> and leave it up to the users to configure that if they have a conflict. |
Agreed! So for the customization piece of Kagi chart with specifying reversals.... I was thinking of either adding a block, similar to the toggle block, with a header that said like |
I, personally think this one is better because as you pointed out, it's easier for additional configuration in the future and I think, it keeps the UI less cluttered so it makes for good UX. |
Damn! Anyways, once you're settled, you might wanna look into;
|
Great call! |
Also, I noticed |
Nice catch, I just fixed that. |
|
FYI, I am probably migrating to this pattern match for handling keys. There are instances where modifiers show up and I don't care about them (capitalized letters), and with this, I can match on match (key_event.code, key_event.modifiers) {
(KeyCode::Char('c'), KeyModifiers::CONTROL) => {
cleanup_terminal();
std::process::exit(0);
}
(_, _) => {}
} Edit: A current example is '?'... some terminals have it come across as just KeyCode('?') and no modifiers, others KeyCode('?') and Modifiers::SHIFT. You can see how I have it defined twice currently. This should let me do this just once:
|
Absolutely! I'm all for that! I wanted to point it out with #51 and #71 because I noticed a lot of code duplication for generally useful bindings but ... didn't. We could extend this to catching the bindings on multiple panes even, to further reduce the duplication. With this worked out, I can open another PR to scratch an itch I noted down earlier (ability to access useful toggles while in the Options pane) |
Yeah, there are definitely some "global" keybinds that we can match on before dispatching to the handle_events of specific modes. The exception is the AddStock mode since it's text entry based. We can't really have '?' or 'q' as globals there, but we can handle this mode prior to globals prior to all other modes. And definitely feel free to scratch that itch. The contributions are welcomed and appreciated! |
Ok, I think I have the config screen in a good state. @miraclx What do you think? Last thing I need to do is add ability to add these to the config file per symbol (hashmap), and source the form from those values if supplied (this will be very easy to do) EDIT: I guess I need to add toggle between using close prices vs high / low too. Currently it's just using close prices. |
Looks great! Yes, kagi based on high/low. |
Cory, nice work... |
@alfredo-catalano thanks! @alfredo-catalano & @miraclx I'm finished! I've added config persistence for these options, as well as the high / low price type. I've checked the 5Y Kagi against stockcharts.com for both close and high / low and it appears to be spot on. Let me know what you think! Here is how you can setup the config.... # Ticker options for Kagi charts
#
# A map of each ticker with reversal and/or price fields (both optional). If no
# entry is defined for a symbol, a default of 'close' price and 1% for 1D and 4%
# for non-1D timeframes is used. This can be updated in the GUI by pressing 'e'
#
# reversal.type can be 'amount' or 'pct'
# price can be 'close' or 'high_low'
#
#kagi_options:
# SPY:
# reversal:
# type: amount
# value: 5.00
# price: close
# AMD:
# price: high_low
# TSLA:
# reversal:
# type: pct
# value: 0.08 |
@alfredo-catalano I'm going to spoil you, I've got reversal type implemented so it can be defined per time frame OR ALL time frames: #kagi_options:
# SPY:
# reversal:
# type: amount
# value: 5.00
# price: close
# AMD:
# price: high_low
# TSLA:
# reversal:
# type: pct
# value: 0.08
# NVDA:
# reversal:
# 1D:
# type: pct
# value: 0.02
# 5Y:
# type: pct
# value: 0.10 Now when using the |
I know talent when I see it... |
this doesn't work currently, but no reason to redo it when #95 needs to be merged first and we can rebase the proper change to that
@miraclx I backmerged your keybind changes to this branch. Can you please help double check I didn't mess anything up? The new keybinds for the |
* use more intuitive keybindings up/down or tab/backtab to switch widgets left/right to choose options * increase info/error message box to contain all entries
* disable q:quit with kagi config pane open * reassign q binding to close kagi config pane
* allow scrolling chart while on chart config pane * allow scrolling chart while on options pane
@miraclx I think we have this pretty well tested now. Anything else or am I good to merge and release? |
Oh, I'm pretty good on this. +1 from here. |
Awesome work guys! |
@miraclx @alfredo-catalano The Kagi chart is basically complete. You can start to test it off this branch if you'd like.
I still need to add ability to define custom reversal amounts from config file and in the GUI.
SHIFT+< & SHIFT+> can be used to scroll the Kagi chart when it is wider than the terminal (usually only an issue on 5Y timeframes).
Let me know what you think!