Skip to content

Instantly share code, notes, and snippets.

@uneasyguy
Created July 18, 2019 20:44
Show Gist options
  • Save uneasyguy/c9d4ae55e08fa2984fcd8edd95597393 to your computer and use it in GitHub Desktop.
Save uneasyguy/c9d4ae55e08fa2984fcd8edd95597393 to your computer and use it in GitHub Desktop.
Server version of app.py from https://youtu.be/i2qnM_S1vh4
from flask import Flask
from flask_restful import Api,Resource
from binance.client import Client
app = Flask(__name__)
api = Api(app)
class Prices(Resource):
def get(self,symbols,something_else):
client = Client(None,None)
prices = client.get_all_tickers()
return_values = [something_else]
for x,currency_pair in enumerate(prices):
if currency_pair['symbol'] in symbols:
return_values.append([currency_pair['symbol'],currency_pair['price']])
return return_values
api.add_resource(Prices,'/symbols/<string:symbols>&<string:something_else>')
app.run(host="0.0.0.0",port=5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment