-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
42 lines (33 loc) · 1.01 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
from flask import Flask, render_template, request,flash,redirect,jsonify
import config, csv, datetime
from binance.client import Client
from binance.enums import *
app = Flask(__name__)
#client = Client(config.API_KEY, config.API_SECRET, tld='us')
client = Client()
@app.route("/")
def index():
return render_template('index.html')
@app.route("/buy")
def buy():
return "<p>buy</p>"
@app.route("/sell")
def sell():
return "<p>sell</p>"
@app.route("/settings")
def settings():
return "<p>settings</p>"
@app.route("/history")
def history() :
candlesticks = client.get_historical_klines("BTCUSDT", Client.KLINE_INTERVAL_15MINUTE, "1 Aug, 2023", "10 Aug, 2023")
processed_candlesticks = []
for data in candlesticks :
candlestick = {
"time": data[0]/1000,
"open": data[1],
"high": data[2],
"low": data[3],
"close": data[4]
}
processed_candlesticks.append(candlestick)
return jsonify(processed_candlesticks)