-
Notifications
You must be signed in to change notification settings - Fork 852
/
Copy pathib_static_data.py
43 lines (34 loc) · 1.19 KB
/
ib_static_data.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
from syslogging.logger import *
from sysbrokers.IB.client.ib_client import ibClient
from sysbrokers.IB.ib_connection import connectionIB
from sysbrokers.broker_static_data import brokerStaticData
from sysdata.data_blob import dataBlob
class ibStaticData(brokerStaticData):
def __init__(
self,
ibconnection: connectionIB,
data: dataBlob,
log=get_logger("ibStaticData"),
):
super().__init__(log=log, data=data)
self._ibconnection = ibconnection
def __repr__(self):
return "IB static data %s" % str(self.ib_client)
@property
def ibconnection(self) -> connectionIB:
return self._ibconnection
@property
def ib_client(self) -> ibClient:
client = getattr(self, "_ib_client", None)
if client is None:
client = self._ib_client = ibClient(
ibconnection=self.ibconnection, log=self.log
)
return client
def get_broker_clientid(self) -> int:
return self.ib_client.client_id
def get_broker_account(self) -> str:
broker_account = self.ibconnection.account
return broker_account
def get_broker_name(self) -> str:
return "IB"