-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
50 lines (47 loc) · 1.24 KB
/
test.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
from ib_insync import *
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=15)
contract = Forex('EURUSD')
ib.qualifyContracts(contract)
#print(contract)
# trades = ib.openTrades()
# print(type(trades))
# print(trades)
# print(trades[0].contract.conId)
orders = ib.openOrders()
opentrades = ib.openTrades()
positions = ib.positions('DU865608')
#print(trades)
#print(positions)
# print(trades[0].contract.localSymbol)
# print(trades[0].order.totalQuantity)
print(opentrades)
print(positions)
print(orders)
# for x in opentrades:
# if x.contract.conId == 12087792:
# print("found conId")
# break
# # for x in positions:
# # if x.contract.localSymbol == contract.localSymbol:
# # current_position = x.position
# # break
# # print(current_position)
# # def current_trades():
# # for x in opentrades:
# # if x.contract.localSymbol == contract.localSymbol:
# # opentrade = x.contract.localSymbol
# # break
# # return opentrade
# #
# # print(current_trades())
#
#
# def current_position():
# for x in positions:
# if x.contract.localSymbol == contract.localSymbol:
# current_position = x.position
# break
# return current_position
#
# print(current_position())