dve-lumipy-testing 1.0.389__py3-none-any.whl → 1.0.391__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.
- {dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/METADATA +212 -33
- {dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/RECORD +7 -7
- lumipy/provider/max_version.py +1 -1
- lumipy/test/integration/test_client.py +1 -1
- {dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/WHEEL +0 -0
- {dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/entry_points.txt +0 -0
- {dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dve-lumipy-testing
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.391
|
|
4
4
|
Summary: Python library for Luminesce
|
|
5
5
|
Author: FINBOURNE Technology
|
|
6
6
|
Author-email: engineering@finbourne.com
|
|
@@ -91,37 +91,6 @@ lm.config.add('fbn-ci', '<your PAT>')
|
|
|
91
91
|
lm.config.domain = 'fbn-ci'
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
## Query
|
|
95
|
-
All built around the atlas object. This is the starting point for exploring your data sources and then using them.
|
|
96
|
-
|
|
97
|
-
Build your atlas with `lm.get_atlas`. If you don't supply credentials it will default to your active domain in the config.
|
|
98
|
-
If there is no active domain in your config it will fall back to env vars.
|
|
99
|
-
```python
|
|
100
|
-
import lumipy as lm
|
|
101
|
-
|
|
102
|
-
atlas = lm.get_atlas()
|
|
103
|
-
|
|
104
|
-
ins = atlas.lusid_instrument()
|
|
105
|
-
ins.select('^').limit(10).go()
|
|
106
|
-
```
|
|
107
|
-
You can also specify the domain here by a positional argument, e.g. `lm.get_atlas('fbn-ci')` will use `fbn-ci` and will override the active domain.
|
|
108
|
-
|
|
109
|
-
Client objects are created in the same way. You can submit raw SQL strings as queries using `run()`
|
|
110
|
-
```python
|
|
111
|
-
import lumipy as lm
|
|
112
|
-
|
|
113
|
-
client = lm.get_client()
|
|
114
|
-
client.run('select ^ from lusid.instrument limit 10')
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
You can create a `client` or `atlas` for a domain other than the active one by specifying it in `get_client` or `get_atlas`.
|
|
118
|
-
```python
|
|
119
|
-
import lumipy as lm
|
|
120
|
-
|
|
121
|
-
client = lm.get_client('fbn-prd')
|
|
122
|
-
atlas = lm.get_atlas('fbn-prd')
|
|
123
|
-
```
|
|
124
|
-
|
|
125
94
|
## Connect
|
|
126
95
|
|
|
127
96
|
Python providers are build by inheriting from a base class, `BaseProvider`, and implementing the `__init__` and `get_data` methods.
|
|
@@ -273,7 +242,7 @@ Directory
|
|
|
273
242
|
```
|
|
274
243
|
|
|
275
244
|
|
|
276
|
-
## Query
|
|
245
|
+
## Query Using SQL
|
|
277
246
|
This command runs a SQL query, gets the result back, shows it on screen and then saves it as a CSV.
|
|
278
247
|
|
|
279
248
|
### Query Examples
|
|
@@ -352,9 +321,11 @@ Authenticate by setting up the PAT token via the CLI or directly in Python (see
|
|
|
352
321
|
|
|
353
322
|
### Secrets File
|
|
354
323
|
Initialize `get_client` using a secrets file:
|
|
324
|
+
|
|
355
325
|
```python
|
|
356
326
|
client = get_client(api_secrets_file="secrets_file_path/secrets.json")
|
|
357
327
|
```
|
|
328
|
+
|
|
358
329
|
File structure should be:
|
|
359
330
|
```json
|
|
360
331
|
{
|
|
@@ -407,3 +378,211 @@ The following environment variables can also be set:
|
|
|
407
378
|
- FBN_PROXY_USERNAME
|
|
408
379
|
- FBN_PROXY_PASSWORD
|
|
409
380
|
- FBN_ACCESS_TOKEN
|
|
381
|
+
|
|
382
|
+
# Lumipy Atlas and LumiFlex
|
|
383
|
+
|
|
384
|
+
This guide demonstrates how to use the Lumipy Atlas interface to query data providers, transform data, join datasets, create views, and interact with external services like AWS S3, Drive, and Slack.
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
### Query
|
|
388
|
+
|
|
389
|
+
All built around the `atlas` object. This is the starting point for exploring your data sources and then using them.
|
|
390
|
+
|
|
391
|
+
Build your atlas with `lm.get_atlas`. If you don't supply credentials it will default to your active domain in the config.
|
|
392
|
+
If there is no active domain in your config it will fall back to env vars.
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
import lumipy as lm
|
|
396
|
+
|
|
397
|
+
atlas = lm.get_atlas()
|
|
398
|
+
|
|
399
|
+
ins = atlas.lusid_instrument()
|
|
400
|
+
ins.select('^').limit(10).go()
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
You can also specify the domain here by a positional argument, e.g. `lm.get_atlas('fbn-ci')` will use `fbn-ci` and will override the active domain.
|
|
404
|
+
|
|
405
|
+
Client objects are created in the same way. You can submit raw SQL strings as queries using `run()`
|
|
406
|
+
|
|
407
|
+
```python
|
|
408
|
+
import lumipy as lm
|
|
409
|
+
|
|
410
|
+
client = lm.get_client()
|
|
411
|
+
client.run('select ^ from lusid.instrument limit 10')
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
You can create a `client` or `atlas` for a domain other than the active one by specifying it in `get_client` or `get_atlas`.
|
|
415
|
+
|
|
416
|
+
```python
|
|
417
|
+
import lumipy as lm
|
|
418
|
+
|
|
419
|
+
client = lm.get_client('fbn-prd')
|
|
420
|
+
atlas = lm.get_atlas('fbn-prd')
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
### Querying a Provider
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
pf = atlas.lusid_portfolio(as_at=dt.datetime(2022, 9, 1))
|
|
429
|
+
df = pf.select('*').limit(10).go()
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
### Select New Columns
|
|
435
|
+
|
|
436
|
+
```python
|
|
437
|
+
df = pf.select(
|
|
438
|
+
'^', # all original main columns
|
|
439
|
+
LoudNoises=pf.portfolio_code.str.upper(),
|
|
440
|
+
IntVal=7,
|
|
441
|
+
BoolVal=False
|
|
442
|
+
).limit(10).go()
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
### Where Filtering
|
|
448
|
+
|
|
449
|
+
```python
|
|
450
|
+
df = pf.select('*').where(pf.portfolio_scope == 'Finbourne-Examples').go()
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
### Order By
|
|
456
|
+
|
|
457
|
+
```python
|
|
458
|
+
df = pf.select('*').where(
|
|
459
|
+
pf.portfolio_scope == 'Finbourne-Examples'
|
|
460
|
+
).order_by(
|
|
461
|
+
pf.portfolio_code.ascending()
|
|
462
|
+
).go()
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
### Case Statements and Group By
|
|
468
|
+
|
|
469
|
+
```python
|
|
470
|
+
region = lm.when(pf.portfolio_code.str.contains('GLOBAL')).then('GLOBAL') \
|
|
471
|
+
.when(pf.portfolio_code.str.contains('US')).then('US') \
|
|
472
|
+
.otherwise('OTHER')
|
|
473
|
+
|
|
474
|
+
df = pf.select(Region=region).where(
|
|
475
|
+
pf.portfolio_scope == 'Finbourne-Examples'
|
|
476
|
+
).group_by(
|
|
477
|
+
Region=region
|
|
478
|
+
).aggregate(
|
|
479
|
+
PortfolioCount=pf.portfolio_code.count()
|
|
480
|
+
).go()
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
### Having
|
|
486
|
+
|
|
487
|
+
```python
|
|
488
|
+
df = pf.select(Region=region).where(
|
|
489
|
+
pf.portfolio_scope == 'Finbourne-Examples'
|
|
490
|
+
).group_by(
|
|
491
|
+
Region=region
|
|
492
|
+
).aggregate(
|
|
493
|
+
PortfolioCount=pf.portfolio_code.count()
|
|
494
|
+
).having(
|
|
495
|
+
pf.portfolio_code.count() > 3
|
|
496
|
+
).go()
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
### Joins
|
|
502
|
+
|
|
503
|
+
```python
|
|
504
|
+
tv = pf.select('^').where(pf.portfolio_scope == 'Finbourne-Examples').to_table_var()
|
|
505
|
+
hld = atlas.lusid_portfolio_holding(as_at=dt.datetime(2022, 9, 1))
|
|
506
|
+
|
|
507
|
+
df = tv.left_join(hld, on=tv.portfolio_code == hld.portfolio_code).select('*').go()
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
### Union / Concat
|
|
513
|
+
|
|
514
|
+
```python
|
|
515
|
+
df = lm.concat([query1, query2, query3]).go()
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
### Sampling
|
|
521
|
+
|
|
522
|
+
```python
|
|
523
|
+
# Sample by fraction
|
|
524
|
+
df = pf.select('*').limit(200).sample(prob=0.5).go()
|
|
525
|
+
|
|
526
|
+
# Sample by count
|
|
527
|
+
df = pf.select('*').limit(200).sample(100).go()
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
### Create View
|
|
533
|
+
|
|
534
|
+
```python
|
|
535
|
+
df = pf.select('*').setup_view('Lumipy.View.MyView').go()
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
### S3, Drive, and SaveAs Integration
|
|
541
|
+
|
|
542
|
+
```python
|
|
543
|
+
# Load CSV from S3
|
|
544
|
+
csv = atlas.awss3_csv(file='bucket/path/file.csv')
|
|
545
|
+
df = csv.select('*').go()
|
|
546
|
+
|
|
547
|
+
# Save table variable to Drive
|
|
548
|
+
save = atlas.drive_saveas(tv, type='CSV', path='/my-path/', file_names='exported_file')
|
|
549
|
+
df = save.select('*').go()
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
### Slack Integration
|
|
555
|
+
|
|
556
|
+
```python
|
|
557
|
+
# Send table var as CSV
|
|
558
|
+
slack = atlas.dev_slack_send(
|
|
559
|
+
tv,
|
|
560
|
+
attach_as='CSV',
|
|
561
|
+
channel='#channel-name',
|
|
562
|
+
text='Here is your result!'
|
|
563
|
+
)
|
|
564
|
+
df = slack.select('*').go()
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
### Built-in Analytics
|
|
570
|
+
|
|
571
|
+
```python
|
|
572
|
+
df = ar.select(
|
|
573
|
+
ar.timestamp,
|
|
574
|
+
ar.duration,
|
|
575
|
+
Drawdown=lm.window().finance.drawdown(ar.duration)
|
|
576
|
+
).go()
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
### Cumulative and Fractional Functions
|
|
582
|
+
|
|
583
|
+
```python
|
|
584
|
+
df = ar.select(
|
|
585
|
+
CumeSum=ar.duration.cume.sum(),
|
|
586
|
+
FracDiff=ar.duration.frac_diff()
|
|
587
|
+
).go()
|
|
588
|
+
```
|
|
@@ -78,7 +78,7 @@ lumipy/provider/common.py,sha256=2NMoIDYEkO0km1TcRc_KWZ5NWpo02eBtByKB2_d-mpM,682
|
|
|
78
78
|
lumipy/provider/context.py,sha256=VwsHZO46HP3G9BN4Eot_jQlbfETGKyNg2vG5wm1zL_4,5401
|
|
79
79
|
lumipy/provider/factory.py,sha256=QFuSCT_byJwbFmHF669I2iz0vLAF0T9Or1ghIEUZ0ok,9257
|
|
80
80
|
lumipy/provider/manager.py,sha256=A4bxCO__m5nc9GL8veOLtySbK1giMNDMml_r3B-q8y8,7218
|
|
81
|
-
lumipy/provider/max_version.py,sha256=
|
|
81
|
+
lumipy/provider/max_version.py,sha256=SM-ytRJBHWLYhBmiQDYvCyoVZLdmGNzDETnyG3S6gFo,28
|
|
82
82
|
lumipy/provider/metadata.py,sha256=WGfMv_tLn5W29-zMKipqBpueroe0eF-w9Hj_6QRdZAI,5483
|
|
83
83
|
lumipy/provider/provider_sets.py,sha256=Z_VyiN2dBP1xuIdRiuGgyzLD7LfO4wxFvodprME2Uls,1478
|
|
84
84
|
lumipy/provider/implementation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -271,7 +271,7 @@ lumipy/test/data/context_examples/test_titanic_single_bool_column.json,sha256=SC
|
|
|
271
271
|
lumipy/test/data/context_examples/test_titanic_test_ignore.json,sha256=HYEcQ3CGrtZ9sdacVnn8Vs38tJi4B7I2Tqqo1kS5BLY,575
|
|
272
272
|
lumipy/test/integration/__init__.py,sha256=Qb9wYCQF3WMv7emOmpAvnYzvLi3C_dGOqyheycYzp_g,192
|
|
273
273
|
lumipy/test/integration/test_atlas_build_queries.py,sha256=2wS-kW4uwrUleOU1bRYEHvxmxkWevskw4eIzp1dGUXQ,1286
|
|
274
|
-
lumipy/test/integration/test_client.py,sha256=
|
|
274
|
+
lumipy/test/integration/test_client.py,sha256=M4sF-Vv7RyUjb7vtyXCAxlfk1ESTtYEvCsViV7chgHU,9949
|
|
275
275
|
lumipy/test/integration/test_direct_providers.py,sha256=SaC1iu7ZKLMF_2lSihmKPM27jRwwfxOXQDdHHKX8VMc,8363
|
|
276
276
|
lumipy/test/integration/test_lumiflex.py,sha256=FM7r7YjYQD0vLNWXY25ceV5jEpFl0r6douAcj5KlBSI,12593
|
|
277
277
|
lumipy/test/provider/__init__.py,sha256=GrfZvgfTjrRk6Y8niwJjY60E6DymOrRmuy--1K6Lzuk,148
|
|
@@ -379,8 +379,8 @@ lumipy/test/unit/provider_tests/test_provider_factory.py,sha256=ICHlEiYS-GvKFoI5
|
|
|
379
379
|
lumipy/test/unit/provider_tests/test_provider_manager.py,sha256=-TT-3ZGpDsFKMz4efWIy7TGAUVtZ2gTDa67DiorIioc,13456
|
|
380
380
|
lumipy/test/unit/queryjob_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
381
381
|
lumipy/test/unit/queryjob_tests/test_queryjob.py,sha256=1UE4-VuIkAE6vo0vogq3p2iXtTukiAPxOt5Uankx7c4,1542
|
|
382
|
-
dve_lumipy_testing-1.0.
|
|
383
|
-
dve_lumipy_testing-1.0.
|
|
384
|
-
dve_lumipy_testing-1.0.
|
|
385
|
-
dve_lumipy_testing-1.0.
|
|
386
|
-
dve_lumipy_testing-1.0.
|
|
382
|
+
dve_lumipy_testing-1.0.391.dist-info/METADATA,sha256=QnilfDd1_YVc2EzxIUpMuI7fiu91rpjJIdEGCbgxzeo,14795
|
|
383
|
+
dve_lumipy_testing-1.0.391.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
384
|
+
dve_lumipy_testing-1.0.391.dist-info/entry_points.txt,sha256=L7hRlqwmvzHMwaOQzygKLK-gx4k4e1q4Qz5m0DGihW8,46
|
|
385
|
+
dve_lumipy_testing-1.0.391.dist-info/top_level.txt,sha256=DVww8LaQM3Xm0WOgo4JE0epePgCM1xGWWWxh7wuv-CY,7
|
|
386
|
+
dve_lumipy_testing-1.0.391.dist-info/RECORD,,
|
lumipy/provider/max_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
max_version_str = '1.18.
|
|
1
|
+
max_version_str = '1.18.243'
|
|
@@ -239,7 +239,7 @@ class ClientTests(BaseIntTest):
|
|
|
239
239
|
except Exception as e:
|
|
240
240
|
# Currently throwing `pydantic.v1.error_wrappers.ValidationError` so I thought best to have a generic
|
|
241
241
|
# catch here, I suspect this will be updated soon which could break this test
|
|
242
|
-
self.assertIn(
|
|
242
|
+
self.assertIn("The value 'Not_A_Binary' is not valid.", str(e))
|
|
243
243
|
|
|
244
244
|
def test_certs_download(self):
|
|
245
245
|
self.client.download_certs()
|
|
File without changes
|
{dve_lumipy_testing-1.0.389.dist-info → dve_lumipy_testing-1.0.391.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|