-
Notifications
You must be signed in to change notification settings - Fork 1
/
Test_2.py
36 lines (24 loc) · 1.42 KB
/
Test_2.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
from ib_insync import *
from ibapi.order_condition import PriceCondition
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=15)
contract = []
contract = Stock('AAPL','SMART','USD')
ib.qualifyContracts(contract)
#conParams.append(PriceCondition(0, contract.conId, "SMART", False, 112.0))
lmt = LimitOrder('BUY', 100 ,110, algoStrategy='Adaptive',algoParams=[TagValue('adaptivePriority', 'Normal')],
conditions = [PriceCondition(0, contract.conId, exch= "SMART", isMore= False, price = 112)])
ib.placeOrder(contract, lmt)
ib.sleep(3)
lmt.conditions = [PriceCondition(0, contract.conId, exch= "SMART", isMore= False, price = 118)]
#lmt.algoParams = [TagValue('adaptivePriority', 'Urgent')]
# lmt = LimitOrder('BUY', 100 ,110, algoStrategy='Adaptive',algoParams=[TagValue('adaptivePriority', 'Normal')],
# conditions = [PriceCondition(0, contract.conId, exch= "SMART", isMore= False, price = 113)])
# lmt = LimitOrder('BUY', 100 ,110, algoStrategy='Adaptive',algoParams=[TagValue('adaptivePriority', 'Normal')],
# conditions = [PriceCondition(0, contract.conId, exch= "SMART", isMore= False, price = 113)])
#
ib.placeOrder(contract, lmt)
# parent = MarketOrder('BUY', 100, algoStrategy='Adaptive',algoParams=[TagValue('adaptivePriority', 'Normal')])
# ib.placeOrder(contract, parent)
# def __init__(self, triggerMethod=None, conId=None, exch=None, isMore=None,
# price=None):