forked from yutiansut/QA_AtBroker
-
Notifications
You must be signed in to change notification settings - Fork 12
/
__init__.py
59 lines (50 loc) · 1.74 KB
/
__init__.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# coding:utf-8
import QUANTAXIS as QA
from py_ctp import test_trade, test_api
import time
tt = test_trade.TestTrade()
# t.OnConnected = t.ReqUserLogin('008105', '1', '9999')
# t.ReqConnect('tcp://180.168.146.187:10000')
tt.run()
time.sleep(6)
for inst in tt.t.instruments.values():
print(inst)
print(tt.t.orders)
print(tt.t.trades)
z = test_api.Test()
z.Run()
input()
z.t.Release()
input()
# ReqOrderAction(
# self.broker, self.investor,
# InstrumentID=pOrder.getInstrumentID(),
# OrderRef=pOrder.getOrderRef(),
# FrontID=pOrder.getFrontID(),
# SessionID=pOrder.getSessionID(),
# ActionFlag=ctp.ActionFlagType.Delete)
# ReqOrderInsert(
# BrokerID=self.broker,
# InvestorID=self.investor,
# InstrumentID=f.getInstrumentID(),
# OrderRef='{0:>12}'.format(self.req),
# UserID=self.investor,
# OrderPriceType=ctp.OrderPriceTypeType.LimitPrice,
# Direction=ctp.DirectionType.Buy,
# CombOffsetFlag=ctp.OffsetFlagType.Open.__char__(),
# CombHedgeFlag=ctp.HedgeFlagType.Speculation.__char__(),
# LimitPrice=f.getLastPrice() - 50,
# VolumeTotalOriginal=1,
# TimeCondition=ctp.TimeConditionType.GFD,
# # GTDDate=''
# VolumeCondition=ctp.VolumeConditionType.AV,
# MinVolume=1,
# ContingentCondition=ctp.ContingentConditionType.Immediately,
# StopPrice=0,
# ForceCloseReason=ctp.ForceCloseReasonType.NotForceClose,
# IsAutoSuspend=0,
# IsSwapOrder=0,
# UserForceClose=0)
# tt.t.ReqOrderInsert()
# tt.t.ReqOrderAction()
# tt.release()