Repository navigation
Compare other symbols on the main chart - #10
Merged
Merged
Conversation
Compare in the top bar draws up to 5 other symbols as lines over the main chart. Each line starts at the chart's price at the left edge and follows its own percent changes, so the lines are rescaled as the chart scrolls. The first one switches a normal price scale to percent and the last one switches it back. Compared symbols are saved with the layout, travel with the indicators in share links and embeds (keyless sources only), and agents get add_compare and remove_compare, with the list in get_chart_state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Compare button to the top bar. It draws up to 5 other symbols as lines over the main chart, for example ETH and SOL over BTC.
How it works
request.security, so a symbol used by both a script and a compare line is fetched once. Any source works, including the keyed ones and CSV.Saved and shared
cfield. Only keyless sources go into a link. Keyed and CSV ones are left out with a note, and a link edited to include one drops it instead of using the viewer's key. Older versions ignore the field.Agents
New tools
add_compareandremove_compare(28 tools now).get_chart_statelists the compared symbols with last price and change.window.kandle.comparehaslist,add,removeandclear.Docs and tests
Docs: the README features list, a Compare symbols section with a screenshot, the tool table, the Chinese README and the agent skill.
Tests cover the alignment and rescaling math, the controller against a fake chart, layout sanitizing, share link round trips and hostile input, the shared view, embeds and the new handlers. I also checked it in Chromium at 1600x1000, 1400x850 and 390x844, and an embed at 800x450.