-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathexample.py
More file actions
27 lines (18 loc) · 638 Bytes
/
example.py
File metadata and controls
27 lines (18 loc) · 638 Bytes
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
from typing import Dict
from easyquant import StrategyTemplate
from easyquant.context import Context
from pandas import DataFrame
class Strategy(StrategyTemplate):
name = "example strategy"
watch_stocks = ["002230"]
def init(self):
for stock_code in self.watch_stocks:
self.quotation_engine.watch(stock_code)
def on_bar(self, context: Context, data: Dict[str, DataFrame]):
self.log.info("on_bar")
def on_close(self, context: Context):
self.log.info("on_close")
def on_open(self, context: Context):
pass
def shutdown(self):
self.log.info("shutdown")