-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_1.py
37 lines (25 loc) · 1.34 KB
/
test_1.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
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)
##changing stuff to see if it goes to github
#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= True, price = 112)])
ib.placeOrder(contract, lmt)
ib.sleep(3)
ib.cancelOrder(lmt)
ib.sleep(3)
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):