Created
July 18, 2019 20:44
-
-
Save uneasyguy/c9d4ae55e08fa2984fcd8edd95597393 to your computer and use it in GitHub Desktop.
Server version of app.py from https://youtu.be/i2qnM_S1vh4
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
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