forked from msitt/blpapi-python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NOTES
234 lines (135 loc) · 6.67 KB
/
NOTES
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
This document outlines most obvious differences between Bloomberg C++ SDK and
this Python SDK.
Different APIs
==============
Below is a list of APIs that have different parameters or enhanced
functionality:
class 'Constant'
----------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of type 'Constant' are destroyed before the relevant sessions.
C++: overloaded methods with name 'getValueAs', together with methods
'getValueAsChar', 'getValueAsInt32', 'getValueAsInt64', 'getValueAsFloat32',
'getValueAsFloat64', 'getValueAsDatetime', 'getValueAsString'.
Python: methods 'getValueAsInteger', 'getValueAsFloat', 'getValueAsDatetime',
'getValueAsString', that return integers, floats, datetime objects, strings,
and method 'getValue' that returns value of the constant as it is stored,
without conversion.
class 'ConstantList'
--------------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of type 'Constant' are destroyed before the relevant sessions.
In addition, in Python, objects of type ConstantList support iterator
interface, to iterate over constants they store.
class 'CorrelationId'
---------------------
C++: method 'swap' that swaps two CorrelationID objects.
Python: none.
C++: method 'valueType'.
Python: method that does the same has different name, 'type'.
class Datetime
--------------
In Python SDK, two methods exist to convert between objects of this type and
standard Python classes from datetime module,
blpapi._DatetimeUtil.convertToNative, and
blpapi._DatetimeUtil.convertToBlpapi. No separate Datetime class is defined.
class 'Element'
---------------
C++: overloaded methods with name 'GetElement' that return an element based on
its name or position for sequences or choices.
Python: two separate methods: 'GetElement' that returns an element by its name
and method 'GetElementAt' that returns an element at the specified position.
C++: overloaded methods with name 'getValueAs', together with methods
'getValueAsBool', 'getValueAsChar', 'getValueAsInt32', 'getValueAsInt64',
'getValueAsFloat32', 'getValueAsFloat64', 'getValueAsDatetime',
'getValueAsString', 'getValueAsElement', 'getValueAsName'.
Python: methods 'getValueAsBool', 'getValueAsInteger', 'getValueAsFloat',
'getValueAsDatetime', 'getValueAsString', 'getValueAsName',
'getValueAsElement' that return value of the element converted to the relevant
data types, and method 'getValue' that returns value of the (sub)element as it
is stored, without conversion.
C++: methods 'getElementAsBool', 'getElementAsChar', 'getElementAsInt32',
'getElementAsInt64', 'getElementAsFloat32', 'getElementAsFloat64',
'getElementAsDatetime', 'getElementAsString', 'getElementAsName'.
Python: methods 'getElementAsBool', 'getElementAsString',
'getElementAsDatetime', 'getElementAsInteger', 'getElementAsFloat',
'getElementAsName' that return a value of the specified subelement converted
to the relevant data types, and method 'getElementValue' that returns the
value without conversion.
C++: overloaded methods 'setElement', 'setValue', 'appendValue' for bool,
char, Int32, Int64, Float32, Float64, Datetime, const char*, Name date types.
Python: methods 'setElement', 'setValue', 'appendValue' that treat bools as
BLPAPI_DATATYPE_BOOL, ints as BLPAPI_DATATYPE_INT32, longs as
BLPAPI_DATATYPE_INT64, floats as BLPAPI_DATATYPE_FLOAT64, Datetimes as
BLPAPI_DATATYPE_DATETIME. Everything else is treated as/converted to
BLPAPI_DATATYPE_STRING.
Also, this class in the Python implementation support methods 'elements' and
'values' to iterate over elements in this object and values stored in it.
class 'Event'
-------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
In addition, in Python, objects of this type support iterator interface, to
iterate over messages they store.
class 'EventHandler'
--------------------
Not defined in Python code. Examples of event handlers can be found in
'MktdataPublisher.py' and 'PagePublisherExample.py' files in examples
directory.
class 'Identity'
----------------
C++: constructor accepts a handle
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
class 'Message'
---------------
C++: methods 'numCorrelationIds', 'correlationId'.
Python: method 'correlationIds', that return a list of correlation IDs.
class 'Name'
------------
C++: class method 'findName' returns 'Name()' when it cannot find the name.
Python: class method 'findName' returns None when it cannot find the name.
class 'Request'
---------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
class 'SchemaElementDefinition'
-------------------------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
C++: methods 'numAlternateNames', 'getAlternateName'.
Python: method 'alternateNames', that returns a list of Name objects.
class 'SchemaTypeDefinition'
---------------------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
class 'Operation'
-----------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
C++: method 'responseDefinition'.
Python: method 'getResponseDefinitionAt'.
In addition, in Python, objects of this type support iterator interface, to
iterate over responses they store.
class 'Service'
---------------
C++: constructor accepts a handle.
Python: constructor accepts a handle and a list of relevant sessions, to make
sure objects of this type are destroyed before the relevant sessions.
C++: overloaded methods 'getOperation'.
Python: methods 'getOperation' and 'getOperationAt'.
C++: overloaded method 'getEventDefinition'.
Python: methods 'getEventDefinition' and 'getEventDefinitionAt'.
In addition, in Python, objects of this type support iterator interface.
General notes
-------------
In most cases, where a class defines method print() that sends formatted
output to a stream, a replacement method is defined in the Python SDK,
toString(), that returns a formatted string.