Try this:
[code block omitted from the quote for a clearer view]
Remark: The "difficult" looking stuff in the return of index() is only to "stringify" each of the keys in the market ticker dictionary.
This makes the output look 'nice'. If you where to return 'ticker' directly with "return jsonify(ticker)" .. you would get a whole lot more information that is unfortunately, way less useful for most people
Thanks for the insight! Yes, I tried
json.dumps(market.ticker()) and it gave a lot more information. In my example, I manually do all the work which is done by the two Flask modules in your version. There is one question, though. When we construct the webpage with Flask's
route, does the script send a request to the API node each time someone browses the page? If so, I'd go with the more primitive file writing-reading version.
Best,
Jian