初步测试通过
This commit is contained in:
+11
-3
@@ -1,5 +1,7 @@
|
||||
from peewee import SqliteDatabase, Model, CharField, IntegerField, FloatField, BooleanField
|
||||
|
||||
from xtquant import xtconn, xtconstant
|
||||
|
||||
# 连接到SQLite数据库
|
||||
db = SqliteDatabase('example.db')
|
||||
|
||||
@@ -8,18 +10,24 @@ class BaseModel(Model):
|
||||
class Meta:
|
||||
database = db
|
||||
|
||||
OrderTypeBuy = f'{xtconstant.STOCK_BUY}' # 买
|
||||
OrderTypeSell = f'{xtconstant.STOCK_SELL}' # 卖
|
||||
OrderTypeInit = "0" # 建仓
|
||||
OrderTypeNone = "None" # 建仓
|
||||
|
||||
# 定义Target类,对应targets表
|
||||
class TradeTarget(BaseModel):
|
||||
stock_code = CharField(unique=True)
|
||||
stock_name = CharField()
|
||||
market_price = FloatField()
|
||||
current_position = IntegerField()
|
||||
grid_index = IntegerField()
|
||||
market_price = FloatField()
|
||||
last_trade_price = FloatField()
|
||||
plan_buy_price = FloatField()
|
||||
current_buy_order_no = CharField(default='')
|
||||
plan_sell_price = FloatField()
|
||||
current_sell_order_no = CharField(default='')
|
||||
current_order_price = FloatField()
|
||||
current_order_no = CharField(default='')
|
||||
current_order_type = CharField(default='')
|
||||
status = IntegerField(default=0) # 0表示新标的,1表示已建初始仓,正常交易中
|
||||
enabled = BooleanField(default=False) # 是否启动交易线程
|
||||
|
||||
|
||||
Reference in New Issue
Block a user