added flask
This commit is contained in:
parent
dcd91eaab8
commit
f694f81b1b
42
main.py
42
main.py
@ -494,25 +494,35 @@ from bfxbot.currency import Symbol
|
|||||||
from bfxbot.models import PositionState
|
from bfxbot.models import PositionState
|
||||||
from strategy import TrailingStopStrategy
|
from strategy import TrailingStopStrategy
|
||||||
|
|
||||||
dotenv.load_dotenv()
|
from flask import Flask, render_template
|
||||||
API_KEY = os.getenv("API_KEY")
|
app = Flask(__name__)
|
||||||
API_SECRET = os.getenv("API_SECRET")
|
|
||||||
|
|
||||||
bot = BfxBot(api_key=API_KEY, api_secret=API_SECRET)
|
|
||||||
strategy = TrailingStopStrategy()
|
|
||||||
bot.set_strategy(Symbol.BTC, strategy)
|
|
||||||
eh = bot.event_handler(Symbol.BTC)
|
|
||||||
|
|
||||||
|
|
||||||
@eh.on_state(PositionState.PROFIT)
|
@app.route('/')
|
||||||
def on_min_profit(ss, pw):
|
def entry():
|
||||||
print("Minimum profit!")
|
return render_template('index.html')
|
||||||
|
|
||||||
async def main():
|
# dotenv.load_dotenv()
|
||||||
await bot.start()
|
|
||||||
|
|
||||||
while True:
|
# API_KEY = os.getenv("API_KEY")
|
||||||
await bot.update()
|
# API_SECRET = os.getenv("API_SECRET")
|
||||||
|
|
||||||
|
# bot = BfxBot(api_key=API_KEY, api_secret=API_SECRET)
|
||||||
|
# strategy = TrailingStopStrategy()
|
||||||
|
# bot.set_strategy(Symbol.BTC, strategy)
|
||||||
|
# eh = bot.event_handler(Symbol.BTC)
|
||||||
|
|
||||||
|
|
||||||
|
# @eh.on_state(PositionState.PROFIT)
|
||||||
|
# def on_min_profit(ss, pw):
|
||||||
|
# print("Minimum profit!")
|
||||||
|
|
||||||
|
# async def main():
|
||||||
|
# await bot.start()
|
||||||
|
|
||||||
|
# while True:
|
||||||
|
# await bot.update()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
asyncio.run(main())
|
# asyncio.run(main())
|
||||||
|
app.run()
|
7
templates/index.html
Normal file
7
templates/index.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
||||||
|
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
||||||
|
|
||||||
|
<title>Hello world!</title>
|
||||||
|
|
||||||
|
<h1>Rustico - Approved Salento Bot</h1>
|
Loading…
Reference in New Issue
Block a user