Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Allow looking up prices by symbol #34

Closed
wants to merge 85 commits into from
Closed

Allow looking up prices by symbol #34

wants to merge 85 commits into from

Conversation

jathpala
Copy link
Contributor

See #33

The ticker method now accepts a 'symbol' paramater. If a currency id
is not specified but symbol is, then the appropriate currency id is
automatically chosen for the request to the coinmarketcap api.

The mappings of currency symbols to currency ids are stored in a
'symbol.json' data file. This is generated using the 'get_symbols.py'
script. The data file is static for a given release of the library.
Users are not expected to update the data file.

To keep the library up to date with new currencies, the 'get_symbols'
script should be run from time to time and the update 'symbols.json'
file should be moved into the data folder and a new release pushed.

barnumbirr and others added 28 commits June 8, 2017 09:36
Requests of the form ticker/bitcoin?param cause a 301 redirect from
the coinmarketcap API. The correct endpoint is ticker/bitcoin/?param
(with a '/') between the currency symbol and the ?param.
(Refer https://coinmarketcap.com/api/)
Add a '/' after the currency id for api requests
Adds a 'tempdir_cache' boolean option to the Market class which allows
the cached market data to be saved to the system temp directory rather
than the current working directory. This avoids polluting the working
directory with a short-term file that the user likely doesn't need to
be able to directly access themselves.

By default the tempdir is not used (for backwards compatibility) and
has to be explicitly requested by passing 'tempdir_cache = True' when
instantiating a Market object.
Allow saving cache data to a temp directory
The ticker method now accepts a 'symbol' paramater. If a currency id
is not specified but symbol is, then the appropriate currency id is
automatically chosen for the request to the coinmarketcap api.

The mappings of currency symbols to currency ids are stored in a
'symbol.json' data file. This is generated using the 'get_symbols.py'
script. The data file is static for a given release of the library.
Users are not expected to update the data file.

To keep the library up to date with new currencies, the 'get_symbols'
script should be run from time to time and the update 'symbols.json'
file should be moved into the data folder and a new release pushed.
Adds the necessary setup information to ensure the 'symbols.json'
data file is included when the package is installed.
Adds a 'Developer' section to the readme with instructions on using
'get_symbols.py' to update 'symbols.json'.
As pointed out by @jorijnsmit, multiple coins can share the same
symbol. Allowing such coins to be looked up by symbol would lead to
ambiguity about exactly which coin is being requested.

The 'get_symbols.py' script has been modified to detect such symbol
collisions and exclude them from the symbol lookup dictionary.
Attempting to lookup one of those symbols will lead to an error being
raised (just as if such a symbol doesn't exist at all). Those coins
with colliding symbols can still be looked up by id.

When 'get_symbols.py' is run it creates a file 'collisions.log' which
lists all collisions. It should be manually copied to 'docs/'.
Small change to keep the symbols in collisions.log sorted
alphabetically for better readability.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants