Skip to content
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

Implement alt-link and bind it to ^o #284

Merged
merged 4 commits into from
Mar 19, 2022

Conversation

lyricnz
Copy link
Collaborator

@lyricnz lyricnz commented Nov 18, 2021

Add support for an "alternate link" for a coin, to a user-defined target. This is expressed in a code snippet, defined in the config.toml file. The code has access to sprintf and a coin object with [ID, Name, Symbol, Rank, Slug] available.

alt_link_code = "sprintf(\"https://www.tradingview.com/chart/?symbol=%sUSDT\", coin.Symbol)"

Per #283

@lyricnz
Copy link
Collaborator Author

lyricnz commented Nov 18, 2021

Thoughts:

  • signature of interface.CoinLink() and interface.AltCoinLink() are different - they should probably be the same
  • in fact, CoinLink should probably just be a pre-configured example of the same pattern
  • in fact, we could probably support an arbitrary number of CoinLinks (though managing config would be a pain)
  • the config should probably be in an api-specific section, but updating config structs gives me a headache

@lyricnz
Copy link
Collaborator Author

lyricnz commented Nov 24, 2021

The config is a little codey. Might be easier to explain with simple tokens.

@miguelmota
Copy link
Member

(copying my comment from discord):

This format makes it very specific to Go but the config file should be generalized. I think something like alt_link_code = "https://www.tradingview.com/chart/?symbol=:SYMBOL:" would be better and we can offer :SYMBOL:, :NAME, :ID: , etc as variables

@miguelmota
Copy link
Member

miguelmota commented Mar 19, 2022

Merging this with some changes

I updated it to use template tags and simplified the link generation by not passing the alt coin link code to each coin api class

Example link

alt_coin_link = "https://www.tradingview.com/symbols/{{SYMBOL}}USD/"

Available tags:

  • {{ID}}
  • {{NAME}}
  • {{RANK}}
  • {{SLUG}}
  • {{SYMBOL}}

Thanks @lyricnz!

@miguelmota miguelmota merged commit 7c063df into cointop-sh:master Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants