forked from beatzxbt/bybit-smm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
28 lines (24 loc) · 816 Bytes
/
main.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
import asyncio
import uvloop
from dotenv import load_dotenv
load_dotenv()
from src.strategy.core import Strategy
from src.sharedstate import SharedState
async def main():
"""
The main entry point of the application. Initializes the shared state and strategy,
then concurrently refreshes parameters and runs the trading strategy.
"""
try:
sharedstate = SharedState()
await asyncio.gather(
asyncio.create_task(sharedstate.refresh_parameters()),
asyncio.create_task(Strategy(sharedstate).run())
)
except Exception as e:
print(f"Critical exception occured: {e}")
# TODO: Add shutdown sequence here
raise e
if __name__ == "__main__":
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
asyncio.run(main())