-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
65 lines (44 loc) · 1.24 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from crypt import methods
from django.shortcuts import render,redirect
from flask import Flask, render_template,request,flash
from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
# from requests import request
import config
import csv
from binance.enums import *
app=Flask(__name__)
app.secret_key=config.SECRET_KEY
client = Client(config.API_KEY,config.API_SECRET)
@app.route('/')
def index():
title='CoinView'
print(client)
info=client.get_account()
#print(info)
exchange_info=client.get_exchange_info()
symbols=exchange_info['symbols']
balances=info['balances']
print(balances)
return render_template('index.html',title=title)
@app.route('/buy',methods=['GET','POST'])
def buy():
symbol=request.form['symbol']
quantity=request.form['quantity']
try:
order = client.create_order(
symbol=symbol,
side=SIDE_BUY,
type=ORDER_TYPE_LIMIT,
quantity=quantity,
price='0.00001')
except Exception as e:
flash(e.message,"error")
return redirect('/')
@app.route('/sell')
def sell():
return 'sell'
@app.route('/settings')
def settings():
return 'settings'
if __name__=="__main__":
app.run(debug=True)