webull-openapi-python-sdk 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. samples/__init__.py +1 -0
  2. samples/data/__init__.py +1 -0
  3. samples/data/data_client.py +57 -0
  4. samples/data/data_streaming_client.py +86 -0
  5. samples/data/data_streaming_client_async.py +101 -0
  6. samples/trade/__init__.py +0 -0
  7. samples/trade/trade_client.py +163 -0
  8. samples/trade/trade_client_v2.py +181 -0
  9. samples/trade/trade_event_client.py +47 -0
  10. webull/__init__.py +1 -0
  11. webull/core/__init__.py +12 -0
  12. webull/core/auth/__init__.py +0 -0
  13. webull/core/auth/algorithm/__init__.py +0 -0
  14. webull/core/auth/algorithm/sha_hmac1.py +65 -0
  15. webull/core/auth/algorithm/sha_hmac256.py +75 -0
  16. webull/core/auth/composer/__init__.py +0 -0
  17. webull/core/auth/composer/default_signature_composer.py +125 -0
  18. webull/core/auth/credentials.py +46 -0
  19. webull/core/auth/signers/__init__.py +0 -0
  20. webull/core/auth/signers/app_key_signer.py +72 -0
  21. webull/core/auth/signers/signer.py +48 -0
  22. webull/core/auth/signers/signer_factory.py +58 -0
  23. webull/core/cache/__init__.py +225 -0
  24. webull/core/client.py +410 -0
  25. webull/core/common/__init__.py +0 -0
  26. webull/core/common/api_type.py +19 -0
  27. webull/core/common/easy_enum.py +35 -0
  28. webull/core/common/region.py +7 -0
  29. webull/core/compat.py +85 -0
  30. webull/core/context/__init__.py +0 -0
  31. webull/core/context/request_context_holder.py +33 -0
  32. webull/core/data/endpoints.json +22 -0
  33. webull/core/data/retry_config.json +15 -0
  34. webull/core/endpoint/__init__.py +8 -0
  35. webull/core/endpoint/chained_endpoint_resolver.py +57 -0
  36. webull/core/endpoint/default_endpoint_resolver.py +60 -0
  37. webull/core/endpoint/local_config_regional_endpoint_resolver.py +77 -0
  38. webull/core/endpoint/resolver_endpoint_request.py +46 -0
  39. webull/core/endpoint/user_customized_endpoint_resolver.py +55 -0
  40. webull/core/exception/__init__.py +0 -0
  41. webull/core/exception/error_code.py +23 -0
  42. webull/core/exception/error_msg.py +21 -0
  43. webull/core/exception/exceptions.py +53 -0
  44. webull/core/headers.py +57 -0
  45. webull/core/http/__init__.py +0 -0
  46. webull/core/http/initializer/__init__.py +0 -0
  47. webull/core/http/initializer/client_initializer.py +79 -0
  48. webull/core/http/initializer/token/__init__.py +0 -0
  49. webull/core/http/initializer/token/bean/__init__.py +0 -0
  50. webull/core/http/initializer/token/bean/access_token.py +40 -0
  51. webull/core/http/initializer/token/bean/check_token_request.py +44 -0
  52. webull/core/http/initializer/token/bean/create_token_request.py +45 -0
  53. webull/core/http/initializer/token/bean/refresh_token_request.py +44 -0
  54. webull/core/http/initializer/token/token_manager.py +208 -0
  55. webull/core/http/initializer/token/token_operation.py +72 -0
  56. webull/core/http/method_type.py +43 -0
  57. webull/core/http/protocol_type.py +43 -0
  58. webull/core/http/request.py +121 -0
  59. webull/core/http/response.py +166 -0
  60. webull/core/request.py +278 -0
  61. webull/core/retry/__init__.py +0 -0
  62. webull/core/retry/backoff_strategy.py +102 -0
  63. webull/core/retry/retry_condition.py +214 -0
  64. webull/core/retry/retry_policy.py +63 -0
  65. webull/core/retry/retry_policy_context.py +51 -0
  66. webull/core/utils/__init__.py +0 -0
  67. webull/core/utils/common.py +62 -0
  68. webull/core/utils/data.py +25 -0
  69. webull/core/utils/desensitize.py +33 -0
  70. webull/core/utils/validation.py +49 -0
  71. webull/core/vendored/__init__.py +0 -0
  72. webull/core/vendored/requests/__init__.py +94 -0
  73. webull/core/vendored/requests/__version__.py +28 -0
  74. webull/core/vendored/requests/_internal_utils.py +56 -0
  75. webull/core/vendored/requests/adapters.py +539 -0
  76. webull/core/vendored/requests/api.py +166 -0
  77. webull/core/vendored/requests/auth.py +307 -0
  78. webull/core/vendored/requests/certs.py +34 -0
  79. webull/core/vendored/requests/compat.py +85 -0
  80. webull/core/vendored/requests/cookies.py +555 -0
  81. webull/core/vendored/requests/exceptions.py +136 -0
  82. webull/core/vendored/requests/help.py +134 -0
  83. webull/core/vendored/requests/hooks.py +48 -0
  84. webull/core/vendored/requests/models.py +960 -0
  85. webull/core/vendored/requests/packages/__init__.py +17 -0
  86. webull/core/vendored/requests/packages/certifi/__init__.py +17 -0
  87. webull/core/vendored/requests/packages/certifi/__main__.py +16 -0
  88. webull/core/vendored/requests/packages/certifi/cacert.pem +4433 -0
  89. webull/core/vendored/requests/packages/certifi/core.py +51 -0
  90. webull/core/vendored/requests/packages/chardet/__init__.py +53 -0
  91. webull/core/vendored/requests/packages/chardet/big5freq.py +400 -0
  92. webull/core/vendored/requests/packages/chardet/big5prober.py +61 -0
  93. webull/core/vendored/requests/packages/chardet/chardistribution.py +247 -0
  94. webull/core/vendored/requests/packages/chardet/charsetgroupprober.py +120 -0
  95. webull/core/vendored/requests/packages/chardet/charsetprober.py +159 -0
  96. webull/core/vendored/requests/packages/chardet/cli/__init__.py +1 -0
  97. webull/core/vendored/requests/packages/chardet/cli/chardetect.py +99 -0
  98. webull/core/vendored/requests/packages/chardet/codingstatemachine.py +102 -0
  99. webull/core/vendored/requests/packages/chardet/compat.py +48 -0
  100. webull/core/vendored/requests/packages/chardet/cp949prober.py +63 -0
  101. webull/core/vendored/requests/packages/chardet/enums.py +90 -0
  102. webull/core/vendored/requests/packages/chardet/escprober.py +115 -0
  103. webull/core/vendored/requests/packages/chardet/escsm.py +260 -0
  104. webull/core/vendored/requests/packages/chardet/eucjpprober.py +106 -0
  105. webull/core/vendored/requests/packages/chardet/euckrfreq.py +209 -0
  106. webull/core/vendored/requests/packages/chardet/euckrprober.py +61 -0
  107. webull/core/vendored/requests/packages/chardet/euctwfreq.py +401 -0
  108. webull/core/vendored/requests/packages/chardet/euctwprober.py +60 -0
  109. webull/core/vendored/requests/packages/chardet/gb2312freq.py +297 -0
  110. webull/core/vendored/requests/packages/chardet/gb2312prober.py +60 -0
  111. webull/core/vendored/requests/packages/chardet/hebrewprober.py +306 -0
  112. webull/core/vendored/requests/packages/chardet/jisfreq.py +339 -0
  113. webull/core/vendored/requests/packages/chardet/jpcntx.py +247 -0
  114. webull/core/vendored/requests/packages/chardet/langbulgarianmodel.py +242 -0
  115. webull/core/vendored/requests/packages/chardet/langcyrillicmodel.py +347 -0
  116. webull/core/vendored/requests/packages/chardet/langgreekmodel.py +239 -0
  117. webull/core/vendored/requests/packages/chardet/langhebrewmodel.py +214 -0
  118. webull/core/vendored/requests/packages/chardet/langhungarianmodel.py +239 -0
  119. webull/core/vendored/requests/packages/chardet/langthaimodel.py +213 -0
  120. webull/core/vendored/requests/packages/chardet/langturkishmodel.py +207 -0
  121. webull/core/vendored/requests/packages/chardet/latin1prober.py +159 -0
  122. webull/core/vendored/requests/packages/chardet/mbcharsetprober.py +105 -0
  123. webull/core/vendored/requests/packages/chardet/mbcsgroupprober.py +68 -0
  124. webull/core/vendored/requests/packages/chardet/mbcssm.py +586 -0
  125. webull/core/vendored/requests/packages/chardet/sbcharsetprober.py +146 -0
  126. webull/core/vendored/requests/packages/chardet/sbcsgroupprober.py +87 -0
  127. webull/core/vendored/requests/packages/chardet/sjisprober.py +106 -0
  128. webull/core/vendored/requests/packages/chardet/universaldetector.py +300 -0
  129. webull/core/vendored/requests/packages/chardet/utf8prober.py +96 -0
  130. webull/core/vendored/requests/packages/chardet/version.py +23 -0
  131. webull/core/vendored/requests/packages/urllib3/__init__.py +114 -0
  132. webull/core/vendored/requests/packages/urllib3/_collections.py +346 -0
  133. webull/core/vendored/requests/packages/urllib3/connection.py +405 -0
  134. webull/core/vendored/requests/packages/urllib3/connectionpool.py +910 -0
  135. webull/core/vendored/requests/packages/urllib3/contrib/__init__.py +0 -0
  136. webull/core/vendored/requests/packages/urllib3/contrib/_appengine_environ.py +44 -0
  137. webull/core/vendored/requests/packages/urllib3/contrib/_securetransport/__init__.py +0 -0
  138. webull/core/vendored/requests/packages/urllib3/contrib/_securetransport/bindings.py +607 -0
  139. webull/core/vendored/requests/packages/urllib3/contrib/_securetransport/low_level.py +360 -0
  140. webull/core/vendored/requests/packages/urllib3/contrib/appengine.py +303 -0
  141. webull/core/vendored/requests/packages/urllib3/contrib/ntlmpool.py +125 -0
  142. webull/core/vendored/requests/packages/urllib3/contrib/pyopenssl.py +484 -0
  143. webull/core/vendored/requests/packages/urllib3/contrib/securetransport.py +818 -0
  144. webull/core/vendored/requests/packages/urllib3/contrib/socks.py +206 -0
  145. webull/core/vendored/requests/packages/urllib3/exceptions.py +260 -0
  146. webull/core/vendored/requests/packages/urllib3/fields.py +192 -0
  147. webull/core/vendored/requests/packages/urllib3/filepost.py +112 -0
  148. webull/core/vendored/requests/packages/urllib3/packages/__init__.py +19 -0
  149. webull/core/vendored/requests/packages/urllib3/packages/backports/__init__.py +0 -0
  150. webull/core/vendored/requests/packages/urllib3/packages/backports/makefile.py +67 -0
  151. webull/core/vendored/requests/packages/urllib3/packages/ordered_dict.py +273 -0
  152. webull/core/vendored/requests/packages/urllib3/packages/six.py +882 -0
  153. webull/core/vendored/requests/packages/urllib3/packages/socks.py +887 -0
  154. webull/core/vendored/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py +19 -0
  155. webull/core/vendored/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py +170 -0
  156. webull/core/vendored/requests/packages/urllib3/poolmanager.py +467 -0
  157. webull/core/vendored/requests/packages/urllib3/request.py +164 -0
  158. webull/core/vendored/requests/packages/urllib3/response.py +721 -0
  159. webull/core/vendored/requests/packages/urllib3/util/__init__.py +68 -0
  160. webull/core/vendored/requests/packages/urllib3/util/connection.py +148 -0
  161. webull/core/vendored/requests/packages/urllib3/util/queue.py +35 -0
  162. webull/core/vendored/requests/packages/urllib3/util/request.py +132 -0
  163. webull/core/vendored/requests/packages/urllib3/util/response.py +101 -0
  164. webull/core/vendored/requests/packages/urllib3/util/retry.py +426 -0
  165. webull/core/vendored/requests/packages/urllib3/util/selectors.py +601 -0
  166. webull/core/vendored/requests/packages/urllib3/util/ssl_.py +396 -0
  167. webull/core/vendored/requests/packages/urllib3/util/timeout.py +256 -0
  168. webull/core/vendored/requests/packages/urllib3/util/url.py +252 -0
  169. webull/core/vendored/requests/packages/urllib3/util/wait.py +164 -0
  170. webull/core/vendored/requests/packages.py +28 -0
  171. webull/core/vendored/requests/sessions.py +750 -0
  172. webull/core/vendored/requests/status_codes.py +105 -0
  173. webull/core/vendored/requests/structures.py +119 -0
  174. webull/core/vendored/requests/utils.py +916 -0
  175. webull/core/vendored/six.py +905 -0
  176. webull/data/__init__.py +3 -0
  177. webull/data/common/__init__.py +0 -0
  178. webull/data/common/category.py +26 -0
  179. webull/data/common/connect_ack.py +29 -0
  180. webull/data/common/direction.py +25 -0
  181. webull/data/common/exchange_code.py +33 -0
  182. webull/data/common/exercise_style.py +22 -0
  183. webull/data/common/expiration_cycle.py +26 -0
  184. webull/data/common/instrument_status.py +23 -0
  185. webull/data/common/option_type.py +20 -0
  186. webull/data/common/subscribe_type.py +22 -0
  187. webull/data/common/timespan.py +29 -0
  188. webull/data/data_client.py +35 -0
  189. webull/data/data_streaming_client.py +89 -0
  190. webull/data/internal/__init__.py +0 -0
  191. webull/data/internal/default_retry_policy.py +84 -0
  192. webull/data/internal/exceptions.py +60 -0
  193. webull/data/internal/quotes_client.py +314 -0
  194. webull/data/internal/quotes_decoder.py +40 -0
  195. webull/data/internal/quotes_payload_decoder.py +35 -0
  196. webull/data/internal/quotes_topic.py +36 -0
  197. webull/data/quotes/__init__.py +0 -0
  198. webull/data/quotes/instrument.py +33 -0
  199. webull/data/quotes/market_data.py +187 -0
  200. webull/data/quotes/market_streaming_data.py +66 -0
  201. webull/data/quotes/subscribe/__init__.py +0 -0
  202. webull/data/quotes/subscribe/ask_bid_result.py +49 -0
  203. webull/data/quotes/subscribe/basic_result.py +45 -0
  204. webull/data/quotes/subscribe/broker_result.py +33 -0
  205. webull/data/quotes/subscribe/message_pb2.py +37 -0
  206. webull/data/quotes/subscribe/order_result.py +30 -0
  207. webull/data/quotes/subscribe/payload_type.py +19 -0
  208. webull/data/quotes/subscribe/quote_decoder.py +28 -0
  209. webull/data/quotes/subscribe/quote_result.py +47 -0
  210. webull/data/quotes/subscribe/snapshot_decoder.py +30 -0
  211. webull/data/quotes/subscribe/snapshot_result.py +69 -0
  212. webull/data/quotes/subscribe/tick_decoder.py +29 -0
  213. webull/data/quotes/subscribe/tick_result.py +47 -0
  214. webull/data/request/__init__.py +0 -0
  215. webull/data/request/get_batch_historical_bars_request.py +43 -0
  216. webull/data/request/get_corp_action_request.py +47 -0
  217. webull/data/request/get_eod_bars_request.py +32 -0
  218. webull/data/request/get_historical_bars_request.py +43 -0
  219. webull/data/request/get_instruments_request.py +30 -0
  220. webull/data/request/get_quotes_request.py +35 -0
  221. webull/data/request/get_snapshot_request.py +38 -0
  222. webull/data/request/get_tick_request.py +37 -0
  223. webull/data/request/subscribe_request.py +43 -0
  224. webull/data/request/unsubscribe_request.py +42 -0
  225. webull/trade/__init__.py +2 -0
  226. webull/trade/common/__init__.py +0 -0
  227. webull/trade/common/account_type.py +22 -0
  228. webull/trade/common/category.py +29 -0
  229. webull/trade/common/combo_ticker_type.py +23 -0
  230. webull/trade/common/combo_type.py +31 -0
  231. webull/trade/common/currency.py +24 -0
  232. webull/trade/common/forbid_reason.py +27 -0
  233. webull/trade/common/instrument_type.py +27 -0
  234. webull/trade/common/markets.py +27 -0
  235. webull/trade/common/order_entrust_type.py +21 -0
  236. webull/trade/common/order_side.py +23 -0
  237. webull/trade/common/order_status.py +25 -0
  238. webull/trade/common/order_tif.py +24 -0
  239. webull/trade/common/order_type.py +30 -0
  240. webull/trade/common/trade_policy.py +22 -0
  241. webull/trade/common/trading_date_type.py +24 -0
  242. webull/trade/common/trailing_type.py +23 -0
  243. webull/trade/events/__init__.py +0 -0
  244. webull/trade/events/default_retry_policy.py +64 -0
  245. webull/trade/events/events_pb2.py +43 -0
  246. webull/trade/events/events_pb2_grpc.py +66 -0
  247. webull/trade/events/signature_composer.py +61 -0
  248. webull/trade/events/types.py +21 -0
  249. webull/trade/request/__init__.py +0 -0
  250. webull/trade/request/cancel_order_request.py +28 -0
  251. webull/trade/request/get_account_balance_request.py +28 -0
  252. webull/trade/request/get_account_positions_request.py +30 -0
  253. webull/trade/request/get_account_profile_request.py +26 -0
  254. webull/trade/request/get_app_subscriptions.py +28 -0
  255. webull/trade/request/get_open_orders_request.py +30 -0
  256. webull/trade/request/get_order_detail_request.py +27 -0
  257. webull/trade/request/get_today_orders_request.py +31 -0
  258. webull/trade/request/get_trade_calendar_request.py +30 -0
  259. webull/trade/request/get_trade_instrument_detail_request.py +24 -0
  260. webull/trade/request/get_trade_security_detail_request.py +42 -0
  261. webull/trade/request/get_tradeable_instruments_request.py +27 -0
  262. webull/trade/request/palce_order_request.py +91 -0
  263. webull/trade/request/place_order_request_v2.py +58 -0
  264. webull/trade/request/replace_order_request.py +73 -0
  265. webull/trade/request/replace_order_request_v2.py +38 -0
  266. webull/trade/request/v2/__init__.py +0 -0
  267. webull/trade/request/v2/cancel_option_request.py +28 -0
  268. webull/trade/request/v2/cancel_order_request.py +28 -0
  269. webull/trade/request/v2/get_account_balance_request.py +28 -0
  270. webull/trade/request/v2/get_account_list.py +23 -0
  271. webull/trade/request/v2/get_account_positions_request.py +24 -0
  272. webull/trade/request/v2/get_order_detail_request.py +26 -0
  273. webull/trade/request/v2/get_order_history_request.py +35 -0
  274. webull/trade/request/v2/palce_order_request.py +87 -0
  275. webull/trade/request/v2/place_option_request.py +64 -0
  276. webull/trade/request/v2/preview_option_request.py +28 -0
  277. webull/trade/request/v2/preview_order_request.py +59 -0
  278. webull/trade/request/v2/replace_option_request.py +28 -0
  279. webull/trade/request/v2/replace_order_request.py +57 -0
  280. webull/trade/trade/__init__.py +0 -0
  281. webull/trade/trade/account_info.py +83 -0
  282. webull/trade/trade/order_operation.py +246 -0
  283. webull/trade/trade/trade_calendar.py +37 -0
  284. webull/trade/trade/trade_instrument.py +72 -0
  285. webull/trade/trade/v2/__init__.py +0 -0
  286. webull/trade/trade/v2/account_info_v2.py +55 -0
  287. webull/trade/trade/v2/order_operation_v2.py +206 -0
  288. webull/trade/trade_client.py +43 -0
  289. webull/trade/trade_events_client.py +233 -0
  290. webull_openapi_python_sdk-1.0.0.dist-info/METADATA +28 -0
  291. webull_openapi_python_sdk-1.0.0.dist-info/RECORD +295 -0
  292. webull_openapi_python_sdk-1.0.0.dist-info/WHEEL +5 -0
  293. webull_openapi_python_sdk-1.0.0.dist-info/licenses/LICENSE +202 -0
  294. webull_openapi_python_sdk-1.0.0.dist-info/licenses/NOTICE +56 -0
  295. webull_openapi_python_sdk-1.0.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,66 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from webull.data.request.subscribe_request import SubscribeRequest
16
+ from webull.data.request.unsubscribe_request import UnsubcribeRequest
17
+
18
+
19
+ class MarketDataStreaming:
20
+ def __init__(self, api_client):
21
+ self.client = api_client
22
+
23
+ def subscribe(self, session_id, symbols, category, sub_types, depth=None, overnight_required=None):
24
+ """
25
+ Real-time quotes unsubscribe interface is subscribed to real-time quotes pushes according to symbol and data type.
26
+
27
+ :param session_id: Create the sessionId used for the connection
28
+ :param symbols: Such as: [AAPL,TSLA]
29
+ :param category: Security type, enumeration
30
+ :param sub_types: Unsubscribe data type, such as: [SNAPSHOT]、SubType Required when unsubscribe_all is empty
31
+ or not true
32
+ :param depth: Level 2 subscription levels.
33
+ 10 levels by default, up to 50 levels for U.S. stocks.
34
+ :param overnight_required: Whether to include the night session, the default is not included
35
+ """
36
+ request = SubscribeRequest()
37
+ request.set_session_id(session_id)
38
+ request.set_symbols(symbols)
39
+ request.set_category(category)
40
+ request.set_sub_types(sub_types)
41
+ request.set_depth(depth)
42
+ request.set_overnight_required(overnight_required)
43
+ response = self.client.get_response(request)
44
+ return response
45
+
46
+ def unsubscribe(self, session_id, symbols=None, category=None, sub_types=None, unsubscribe_all=False):
47
+ """
48
+ Real-time quotes unsubscribe interface is subscribed to real-time quotes pushes according to symbol and data type.
49
+ When unsubscribing from the interface, you get no result returned if it succeeds, and Error is returned if it fails.
50
+
51
+ :param session_id: Create the sessionId used for the connection
52
+ :param symbols: Such as: [AAPL,TSLA]
53
+ :param category: Security type, enumeration
54
+ :param sub_types: Unsubscribe data type, such as: [SNAPSHOT]、SubType Required when unsubscribe_all is empty
55
+ or not true
56
+ :param unsubscribe_all: boolean false (true means canceling all real-time market subscriptions.
57
+ When unsubscribe_all is true, symbols, category, sub_types can be empty)
58
+ """
59
+ request = UnsubcribeRequest()
60
+ request.set_session_id(session_id)
61
+ request.set_symbols(symbols)
62
+ request.set_category(category)
63
+ request.set_sub_types(sub_types)
64
+ request.set_unsubscribe_all(unsubscribe_all)
65
+ response = self.client.get_response(request)
66
+ return response
File without changes
@@ -0,0 +1,49 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from decimal import Decimal
16
+ from webull.data.quotes.subscribe.order_result import Order
17
+ from webull.data.quotes.subscribe.broker_result import Broker
18
+
19
+
20
+ class AskBidResult:
21
+ def __init__(self, ask_bid):
22
+ self.price = Decimal(ask_bid.price) if ask_bid.price else None
23
+ self.size = ask_bid.size
24
+ self.order = []
25
+ if ask_bid.order:
26
+ for order in ask_bid.order:
27
+ self.order.append(Order(order))
28
+ self.broker = []
29
+ if ask_bid.broker:
30
+ for broker in ask_bid.broker:
31
+ self.broker.append(Broker(broker))
32
+
33
+ def get_price(self):
34
+ return self.price
35
+
36
+ def get_size(self):
37
+ return self.size
38
+
39
+ def get_order(self):
40
+ return self.order
41
+
42
+ def get_broker(self):
43
+ return self.broker
44
+
45
+ def __repr__(self):
46
+ return "price:%s,size:%s,order:%s,broker:%s" % (self.price, self.size, self.order, self.broker)
47
+
48
+ def __str__(self):
49
+ return self.__repr__()
@@ -0,0 +1,45 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+ from datetime import datetime
17
+
18
+
19
+ class BasicResult:
20
+ def __init__(self, pb_basic):
21
+ self.symbol = pb_basic.symbol
22
+ self.instrument_id = pb_basic.instrument_id
23
+ self.timestamp = int(pb_basic.timestamp)
24
+ self.trading_session = pb_basic.trading_session
25
+
26
+ def get_symbol(self):
27
+ return self.symbol
28
+
29
+ def get_instrument_id(self):
30
+ return self.instrument_id
31
+
32
+ def get_timestmap(self):
33
+ return self.timestamp
34
+
35
+ def get_timestamp_as_utc(self):
36
+ return datetime.utcfromtimestamp(self.timestamp / 1000.0)
37
+
38
+ def get_trading_session(self):
39
+ return self.trading_session
40
+
41
+ def __repr__(self):
42
+ return "symbol:%s,instrument_id:%s,timestamp:%d,trading_session:%s" % (self.symbol, self.instrument_id, self.timestamp, self.trading_session)
43
+
44
+ def __str__(self):
45
+ return self.__repr__()
@@ -0,0 +1,33 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from decimal import Decimal
16
+
17
+
18
+ class Broker:
19
+ def __init__(self, pb_broker):
20
+ self.bid = Decimal(pb_broker.bid) if pb_broker.bid else None
21
+ self.name = pb_broker.name if pb_broker.name else None
22
+
23
+ def get_bid(self):
24
+ return self.bid
25
+
26
+ def get_name(self):
27
+ return self.name
28
+
29
+ def __repr__(self):
30
+ return "name:%s,bid:%s" % (self.name, self.bid)
31
+
32
+ def __str__(self):
33
+ return self.__repr__()
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: message.proto
4
+ """Generated protocol buffer code."""
5
+ from google.protobuf.internal import builder as _builder
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ # @@protoc_insertion_point(imports)
10
+
11
+ _sym_db = _symbol_database.Default()
12
+
13
+
14
+
15
+
16
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rmessage.proto\"Z\n\x05\x42\x61sic\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x15\n\rinstrument_id\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x03 \x01(\t\x12\x17\n\x0ftrading_session\x18\x04 \x01(\t\"\xb6\x01\n\x08Snapshot\x12\x15\n\x05\x62\x61sic\x18\x01 \x01(\x0b\x32\x06.Basic\x12\x12\n\ntrade_time\x18\x02 \x01(\t\x12\r\n\x05price\x18\x03 \x01(\t\x12\x0c\n\x04open\x18\x04 \x01(\t\x12\x0c\n\x04high\x18\x05 \x01(\t\x12\x0b\n\x03low\x18\x06 \x01(\t\x12\x11\n\tpre_close\x18\x07 \x01(\t\x12\x0e\n\x06volume\x18\x08 \x01(\t\x12\x0e\n\x06\x63hange\x18\t \x01(\t\x12\x14\n\x0c\x63hange_ratio\x18\n \x01(\t\"L\n\x05Quote\x12\x15\n\x05\x62\x61sic\x18\x01 \x01(\x0b\x32\x06.Basic\x12\x15\n\x04\x61sks\x18\x02 \x03(\x0b\x32\x07.AskBid\x12\x15\n\x04\x62ids\x18\x03 \x03(\x0b\x32\x07.AskBid\"X\n\x04Tick\x12\x15\n\x05\x62\x61sic\x18\x01 \x01(\x0b\x32\x06.Basic\x12\x0c\n\x04time\x18\x02 \x01(\t\x12\r\n\x05price\x18\x03 \x01(\t\x12\x0e\n\x06volume\x18\x04 \x01(\t\x12\x0c\n\x04side\x18\x05 \x01(\t\"U\n\x06\x41skBid\x12\r\n\x05price\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\t\x12\x15\n\x05order\x18\x03 \x03(\x0b\x32\x06.Order\x12\x17\n\x06\x62roker\x18\x04 \x03(\x0b\x32\x07.Broker\"#\n\x05Order\x12\x0c\n\x04mpid\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\t\"#\n\x06\x42roker\x12\x0b\n\x03\x62id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
17
+
18
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
19
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'message_pb2', globals())
20
+ if _descriptor._USE_C_DESCRIPTORS == False:
21
+
22
+ DESCRIPTOR._options = None
23
+ _BASIC._serialized_start=17
24
+ _BASIC._serialized_end=107
25
+ _SNAPSHOT._serialized_start=110
26
+ _SNAPSHOT._serialized_end=292
27
+ _QUOTE._serialized_start=294
28
+ _QUOTE._serialized_end=370
29
+ _TICK._serialized_start=372
30
+ _TICK._serialized_end=460
31
+ _ASKBID._serialized_start=462
32
+ _ASKBID._serialized_end=547
33
+ _ORDER._serialized_start=549
34
+ _ORDER._serialized_end=584
35
+ _BROKER._serialized_start=586
36
+ _BROKER._serialized_end=621
37
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,30 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ class Order:
16
+ def __init__(self, order):
17
+ self.mpid = order.mpid
18
+ self.size = order.size
19
+
20
+ def get_mpid(self):
21
+ return self.mpid
22
+
23
+ def get_size(self):
24
+ return self.size
25
+
26
+ def __repr__(self):
27
+ return "mpid:%s,size:%s" % (self.mpid, self.size)
28
+
29
+ def __str__(self):
30
+ return self.__repr__()
@@ -0,0 +1,19 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ PAYLOAD_TYPE_QUOTE = 'quote'
18
+ PAYLOAD_TYPE_SHAPSHOT = 'snapshot'
19
+ PAYLOAD_TYPE_TICK = 'tick'
@@ -0,0 +1,28 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ from webull.data.quotes.subscribe.message_pb2 import Quote
18
+ from webull.data.quotes.subscribe.quote_result import QuoteResult
19
+ from webull.data.internal.quotes_payload_decoder import BaseQuotesPayloadDecoder
20
+
21
+ class QuoteDecoder(BaseQuotesPayloadDecoder):
22
+ def __init__(self):
23
+ super().__init__()
24
+
25
+ def parse(self, payload):
26
+ quote = Quote()
27
+ quote.ParseFromString(payload)
28
+ return QuoteResult(quote)
@@ -0,0 +1,47 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ from decimal import Decimal
18
+ from webull.data.quotes.subscribe.basic_result import BasicResult
19
+ from webull.data.quotes.subscribe.ask_bid_result import AskBidResult
20
+
21
+
22
+ class QuoteResult:
23
+ def __init__(self, pb_quote):
24
+ self.basic = BasicResult(pb_quote.basic)
25
+ self.asks = []
26
+ if pb_quote.asks:
27
+ for ask in pb_quote.asks:
28
+ self.asks.append(AskBidResult(ask))
29
+ self.bids = []
30
+ if pb_quote.bids:
31
+ for bid in pb_quote.bids:
32
+ self.bids.append(AskBidResult(bid))
33
+
34
+ def get_basic(self):
35
+ return self.basic
36
+
37
+ def get_asks(self):
38
+ return self.asks
39
+
40
+ def get_bids(self):
41
+ return self.bids
42
+
43
+ def __repr__(self):
44
+ return "basic: %s,asks: %s,bids:%s" % (self.basic, self.asks, self.bids)
45
+
46
+ def __str__(self):
47
+ return self.__repr__()
@@ -0,0 +1,30 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ from webull.data.quotes.subscribe.message_pb2 import Snapshot
18
+ from webull.data.quotes.subscribe.snapshot_result import SnapshotResult
19
+ from webull.data.internal.quotes_payload_decoder import BaseQuotesPayloadDecoder
20
+
21
+
22
+
23
+ class SnapshotDecoder(BaseQuotesPayloadDecoder):
24
+ def __init__(self):
25
+ super().__init__()
26
+
27
+ def parse(self, payload):
28
+ snapshot = Snapshot()
29
+ snapshot.ParseFromString(payload)
30
+ return SnapshotResult(snapshot)
@@ -0,0 +1,69 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ from decimal import Decimal
18
+ from webull.data.quotes.subscribe.basic_result import BasicResult
19
+
20
+
21
+ class SnapshotResult:
22
+ def __init__(self, pb_snapshot):
23
+ self.basic = BasicResult(pb_snapshot.basic)
24
+ self.open = Decimal(pb_snapshot.open) if pb_snapshot.open else None
25
+ self.high = Decimal(pb_snapshot.high) if pb_snapshot.high else None
26
+ self.low = Decimal(pb_snapshot.low) if pb_snapshot.low else None
27
+ self.price = Decimal(pb_snapshot.price) if pb_snapshot.price else None
28
+ self.pre_close = Decimal(
29
+ pb_snapshot.pre_close) if pb_snapshot.pre_close else None
30
+ self.volume = Decimal(
31
+ pb_snapshot.volume) if pb_snapshot.volume else None
32
+ self.change = Decimal(
33
+ pb_snapshot.change) if pb_snapshot.change else None
34
+ self.change_ratio = Decimal(
35
+ pb_snapshot.change_ratio) if pb_snapshot.change_ratio else None
36
+
37
+ def get_basic(self):
38
+ return self.basic
39
+
40
+ def get_open(self):
41
+ return self.open
42
+
43
+ def get_high(self):
44
+ return self.high
45
+
46
+ def get_low(self):
47
+ return self.low
48
+
49
+ def get_price(self):
50
+ return self.price
51
+
52
+ def get_pre_close(self):
53
+ return self.pre_close
54
+
55
+ def get_volume(self):
56
+ return self.volume
57
+
58
+ def get_change(self):
59
+ return self.change
60
+
61
+ def get_change_ratio(self):
62
+ return self.change_ratio
63
+
64
+ def __repr__(self):
65
+ return "%s, open:%s, high:%s, low:%s, price:%s, pre_close:%s, volume:%s, change:%s, change_ratio:%s" \
66
+ % (self.basic, self.open, self.high, self.low, self.price, self.pre_close, self.volume, self.change, self.change_ratio)
67
+
68
+ def __str__(self):
69
+ return self.__repr__()
@@ -0,0 +1,29 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+
17
+ from webull.data.quotes.subscribe.message_pb2 import Tick
18
+ from webull.data.quotes.subscribe.tick_result import TickResult
19
+ from webull.data.internal.quotes_payload_decoder import BaseQuotesPayloadDecoder
20
+
21
+
22
+ class TickDecoder(BaseQuotesPayloadDecoder):
23
+ def __init__(self):
24
+ super().__init__()
25
+
26
+ def parse(self, payload):
27
+ tick = Tick()
28
+ tick.ParseFromString(payload)
29
+ return TickResult(tick)
@@ -0,0 +1,47 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from decimal import Decimal
16
+ from webull.data.quotes.subscribe.basic_result import BasicResult
17
+
18
+
19
+ class TickResult:
20
+ def __init__(self, pb_tick):
21
+ self.basic = BasicResult(pb_tick.basic)
22
+ self.time = pb_tick.time
23
+ self.price = Decimal(pb_tick.price) if pb_tick.price else None
24
+ self.volume = pb_tick.volume if pb_tick.volume else None
25
+ self.side = pb_tick.side if pb_tick.side else None
26
+
27
+ def get_basic(self):
28
+ return self.basic
29
+
30
+ def get_price(self):
31
+ return self.price
32
+
33
+ def get_volume(self):
34
+ return self.volume
35
+
36
+ def get_time(self):
37
+ return self.time
38
+
39
+ def get_side(self):
40
+ return self.side
41
+
42
+ def __repr__(self):
43
+ return "%s, price:%s, volume:%s, time:%s, side:%s" \
44
+ % (self.basic, self.price, self.volume, self.time, self.side)
45
+
46
+ def __str__(self):
47
+ return self.__repr__()
File without changes
@@ -0,0 +1,43 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+ from webull.core.request import ApiRequest
17
+
18
+ class BatchHistoricalBarsRequest(ApiRequest):
19
+ def __init__(self):
20
+ ApiRequest.__init__(self, "/market-data/batch-bars", version='v2', method="POST", body_params={})
21
+
22
+ def set_symbols(self, symbol):
23
+ self.add_body_params("symbols", symbol)
24
+
25
+ def set_category(self, category):
26
+ self.add_body_params("category", category)
27
+
28
+ def set_timespan(self, timespan):
29
+ self.add_body_params("timespan", timespan)
30
+
31
+ def set_count(self, count='200'):
32
+ self.add_body_params("count", count)
33
+
34
+ def set_real_time_required(self, real_time_required):
35
+ if real_time_required:
36
+ self.add_body_params("real_time_required", real_time_required)
37
+
38
+ def set_trading_sessions(self, trading_sessions):
39
+ if trading_sessions:
40
+ if isinstance(trading_sessions, list):
41
+ self.add_body_params("trading_sessions", ','.join(trading_sessions))
42
+ else:
43
+ self.add_body_params("trading_sessions", trading_sessions)
@@ -0,0 +1,47 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+ from webull.core.request import ApiRequest
17
+
18
+ class GetCorpActionRequest(ApiRequest):
19
+ def __init__(self):
20
+ ApiRequest.__init__(self, "/instrument/corp-action", version='v2', method="GET", query_params={})
21
+
22
+ def set_instrument_ids(self, instrument_ids):
23
+ if isinstance(instrument_ids, str):
24
+ self.add_query_param("instrument_ids", instrument_ids)
25
+ elif isinstance(instrument_ids, list):
26
+ self.add_query_param("instrument_ids", ",".join(instrument_ids))
27
+
28
+ def set_event_types(self, event_types):
29
+ if isinstance(event_types, str):
30
+ self.add_query_param("event_types", event_types)
31
+ elif isinstance(event_types, list):
32
+ self.add_query_param("event_types", ",".join(event_types))
33
+
34
+ def set_start_date(self, start_date):
35
+ self.add_query_param("start_date", start_date)
36
+
37
+ def set_end_date(self, end_date):
38
+ self.add_query_param("end_date", end_date)
39
+
40
+ def set_page_number(self, page_number):
41
+ self.add_query_param("page_number", page_number)
42
+
43
+ def set_page_size(self, page_size):
44
+ self.add_query_param("page_size", page_size)
45
+
46
+ def set_last_update_time(self, last_update_time):
47
+ self.add_query_param("last_update_time", last_update_time)
@@ -0,0 +1,32 @@
1
+ # Copyright 2022 Webull
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding=utf-8
16
+ from webull.core.request import ApiRequest
17
+
18
+ class GetEodBarsRequest(ApiRequest):
19
+ def __init__(self):
20
+ ApiRequest.__init__(self, "/market-data/eod-bars", version='v2', method="GET", query_params={})
21
+
22
+ def set_instrument_ids(self, instrument_ids):
23
+ if isinstance(instrument_ids, str):
24
+ self.add_query_param("instrument_ids", instrument_ids)
25
+ elif isinstance(instrument_ids, list):
26
+ self.add_query_param("instrument_ids", ",".join(instrument_ids))
27
+
28
+ def set_date(self, date):
29
+ self.add_query_param("date", date)
30
+
31
+ def set_count(self, count='1'):
32
+ self.add_query_param("count", count)