finbourne-sdk-utils 0.0.24__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 (52) hide show
  1. features/__init__.py +0 -0
  2. features/main.py +11 -0
  3. finbourne_sdk_utils/__init__.py +8 -0
  4. finbourne_sdk_utils/cocoon/__init__.py +34 -0
  5. finbourne_sdk_utils/cocoon/async_tools.py +94 -0
  6. finbourne_sdk_utils/cocoon/cocoon.py +1862 -0
  7. finbourne_sdk_utils/cocoon/cocoon_printer.py +455 -0
  8. finbourne_sdk_utils/cocoon/config/domain_settings.json +125 -0
  9. finbourne_sdk_utils/cocoon/config/seed_sample_data.json +36 -0
  10. finbourne_sdk_utils/cocoon/dateorcutlabel.py +198 -0
  11. finbourne_sdk_utils/cocoon/instruments.py +482 -0
  12. finbourne_sdk_utils/cocoon/properties.py +442 -0
  13. finbourne_sdk_utils/cocoon/seed_sample_data.py +137 -0
  14. finbourne_sdk_utils/cocoon/systemConfiguration.py +92 -0
  15. finbourne_sdk_utils/cocoon/transaction_type_upload.py +136 -0
  16. finbourne_sdk_utils/cocoon/utilities.py +1877 -0
  17. finbourne_sdk_utils/cocoon/validator.py +243 -0
  18. finbourne_sdk_utils/extract/__init__.py +1 -0
  19. finbourne_sdk_utils/extract/group_holdings.py +400 -0
  20. finbourne_sdk_utils/iam/__init__.py +1 -0
  21. finbourne_sdk_utils/iam/roles.py +74 -0
  22. finbourne_sdk_utils/jupyter_tools/__init__.py +2 -0
  23. finbourne_sdk_utils/jupyter_tools/hide_code_button.py +23 -0
  24. finbourne_sdk_utils/jupyter_tools/stop_execution.py +14 -0
  25. finbourne_sdk_utils/logger/LusidLogger.py +41 -0
  26. finbourne_sdk_utils/logger/__init__.py +1 -0
  27. finbourne_sdk_utils/lpt/__init__.py +0 -0
  28. finbourne_sdk_utils/lpt/back_compat.py +20 -0
  29. finbourne_sdk_utils/lpt/cash_ladder.py +191 -0
  30. finbourne_sdk_utils/lpt/connect_lusid.py +64 -0
  31. finbourne_sdk_utils/lpt/connect_none.py +5 -0
  32. finbourne_sdk_utils/lpt/connect_token.py +9 -0
  33. finbourne_sdk_utils/lpt/dfq.py +321 -0
  34. finbourne_sdk_utils/lpt/either.py +65 -0
  35. finbourne_sdk_utils/lpt/get_instruments.py +101 -0
  36. finbourne_sdk_utils/lpt/lpt.py +374 -0
  37. finbourne_sdk_utils/lpt/lse.py +188 -0
  38. finbourne_sdk_utils/lpt/map_instruments.py +164 -0
  39. finbourne_sdk_utils/lpt/pager.py +32 -0
  40. finbourne_sdk_utils/lpt/record.py +13 -0
  41. finbourne_sdk_utils/lpt/refreshing_token.py +43 -0
  42. finbourne_sdk_utils/lpt/search_instruments.py +48 -0
  43. finbourne_sdk_utils/lpt/stdargs.py +154 -0
  44. finbourne_sdk_utils/lpt/txn_config.py +128 -0
  45. finbourne_sdk_utils/lpt/txn_config_yaml.py +493 -0
  46. finbourne_sdk_utils/pandas_utils/__init__.py +0 -0
  47. finbourne_sdk_utils/pandas_utils/lusid_pandas.py +128 -0
  48. finbourne_sdk_utils-0.0.24.dist-info/LICENSE +21 -0
  49. finbourne_sdk_utils-0.0.24.dist-info/METADATA +25 -0
  50. finbourne_sdk_utils-0.0.24.dist-info/RECORD +52 -0
  51. finbourne_sdk_utils-0.0.24.dist-info/WHEEL +5 -0
  52. finbourne_sdk_utils-0.0.24.dist-info/top_level.txt +2 -0
features/__init__.py ADDED
File without changes
features/main.py ADDED
@@ -0,0 +1,11 @@
1
+ import sys
2
+
3
+ from lusidfeature.reporter import extract_features_to_file
4
+
5
+
6
+ def main(argv):
7
+ extract_features_to_file(sys.argv)
8
+
9
+
10
+ if __name__ == "__main__":
11
+ main(sys.argv)
@@ -0,0 +1,8 @@
1
+ import finbourne_sdk_utils.cocoon.cocoon
2
+ import finbourne_sdk_utils.cocoon.instruments
3
+ import finbourne_sdk_utils.cocoon.properties
4
+ import finbourne_sdk_utils.cocoon.systemConfiguration
5
+ import finbourne_sdk_utils.cocoon.utilities
6
+ import finbourne_sdk_utils.cocoon.async_tools
7
+ import finbourne_sdk_utils.cocoon.validator
8
+ import finbourne_sdk_utils.cocoon.dateorcutlabel
@@ -0,0 +1,34 @@
1
+ import finbourne_sdk_utils.cocoon.cocoon
2
+ import finbourne_sdk_utils.cocoon.instruments
3
+ import finbourne_sdk_utils.cocoon.properties
4
+ import finbourne_sdk_utils.cocoon.systemConfiguration
5
+ import finbourne_sdk_utils.cocoon.utilities
6
+ from finbourne_sdk_utils.cocoon.instruments import resolve_instruments
7
+ from finbourne_sdk_utils.cocoon.properties import create_property_values
8
+ from finbourne_sdk_utils.cocoon.utilities import set_attributes_recursive
9
+ from finbourne_sdk_utils.cocoon.cocoon import load_from_data_frame
10
+ from finbourne_sdk_utils.cocoon.utilities import (
11
+ checkargs,
12
+ load_data_to_df_and_detect_delimiter,
13
+ check_mapping_fields_exist,
14
+ parse_args,
15
+ identify_cash_items,
16
+ validate_mapping_file_structure,
17
+ get_delimiter,
18
+ scale_quote_of_type,
19
+ strip_whitespace,
20
+ load_json_file,
21
+ default_fx_forward_model,
22
+ )
23
+ from finbourne_sdk_utils.cocoon.cocoon_printer import (
24
+ format_holdings_response,
25
+ format_instruments_response,
26
+ format_portfolios_response,
27
+ format_quotes_response,
28
+ format_transactions_response,
29
+ )
30
+
31
+ import finbourne_sdk_utils.cocoon.async_tools
32
+ import finbourne_sdk_utils.cocoon.validator
33
+ import finbourne_sdk_utils.cocoon.dateorcutlabel
34
+ from finbourne_sdk_utils.cocoon.seed_sample_data import seed_data
@@ -0,0 +1,94 @@
1
+ import asyncio
2
+ import functools
3
+ from threading import Thread, enumerate
4
+ import concurrent.futures
5
+
6
+
7
+ def start_event_loop_new_thread() -> asyncio.AbstractEventLoop:
8
+ """
9
+ Creates and starts a new event loop in a new thread
10
+
11
+ Returns
12
+ -------
13
+ loop : asyncio.AbstractEventLoop
14
+ The newly created loop
15
+
16
+ """
17
+
18
+ loop = asyncio.new_event_loop()
19
+ t = Thread(target=start_background_loop, args=(loop,), daemon=True)
20
+ t.start()
21
+ return loop
22
+
23
+
24
+ def stop_event_loop_new_thread(loop: asyncio.AbstractEventLoop) -> None:
25
+ """
26
+ Takes an event loop, stops it and once stopped closes it
27
+
28
+ Parameters
29
+ ----------
30
+ loop : asyncio.AbstractEventLoop
31
+ The loop to stop and close
32
+
33
+ """
34
+
35
+ thread_id = loop._thread_id
36
+ loop.call_soon_threadsafe(loop.stop)
37
+ threads = enumerate()
38
+ match = [thread for thread in threads if thread.ident == thread_id]
39
+ if len(match) == 1:
40
+ match[0].join(timeout=1)
41
+
42
+
43
+ def start_background_loop(loop: asyncio.AbstractEventLoop) -> None:
44
+ """
45
+ Sets and starts the event loop
46
+
47
+ Parameters
48
+ ----------
49
+ loop : asyncio.AbstractEventLoop
50
+ The event loop to use
51
+
52
+ """
53
+
54
+ asyncio.set_event_loop(loop)
55
+ loop.run_forever()
56
+
57
+
58
+ def run_in_executor(f):
59
+ """
60
+ Passes a synchronous & blocking function off to another thread so that it can be awaited
61
+
62
+ Parameters
63
+ ----------
64
+ f
65
+ The function to transform into an awaitable
66
+
67
+ Returns
68
+ -------
69
+ inner : callable
70
+ An awaitable version of the function with the execution delegated to another thread
71
+ """
72
+
73
+ @functools.wraps(f)
74
+ def inner(*args, **kwargs):
75
+ loop = asyncio.get_running_loop()
76
+
77
+ return loop.run_in_executor(
78
+ # If the function to be wrapped has been provided with a thread pool use that, otherwise create one
79
+ kwargs.get("thread_pool", ThreadPool(5).thread_pool),
80
+ lambda: f(*args, **kwargs),
81
+ )
82
+
83
+ return inner
84
+
85
+
86
+ class ThreadPool:
87
+ """
88
+ Creates a class which has a thread pool.
89
+ """
90
+
91
+ def __init__(self, max_workers):
92
+ self.thread_pool = concurrent.futures.ThreadPoolExecutor(
93
+ max_workers=max_workers
94
+ )