Metadata-Version: 2.1
Name: refinitiv-data
Version: 1.0.0b2
Summary: Python package for retrieving data.
Home-page: https://developers.refinitiv.com/refinitiv-data-platform/refinitiv-data-platform-libraries
Author: REFINITIV
Author-email: 
License: Apache 2.0
Platform: UNKNOWN
Requires-Python: >3.6
Description-Content-Type: text/markdown
Requires-Dist: appdirs (>=1.4.3)
Requires-Dist: eventemitter (>=0.2.0)
Requires-Dist: httpx
Requires-Dist: mysql-connector-python
Requires-Dist: nest-asyncio
Requires-Dist: numpy (>=1.11.0)
Requires-Dist: pandas (>=1.1.0)
Requires-Dist: python-configuration (>=0.8.2)
Requires-Dist: python-dateutil
Requires-Dist: requests
Requires-Dist: requests-async (>=0.6.2)
Requires-Dist: scipy
Requires-Dist: six
Requires-Dist: urllib3 (>=1.26.6)
Requires-Dist: validators
Requires-Dist: watchdog (>=0.10.2)
Requires-Dist: websocket-client (>=0.54.0)

The Refinitiv Data Library for Python provides a set of ease-of-use interfaces that gives your applications a uniform access to the breadth and depth of financial data and services available on the Refinitiv Data Platform.

Thanks to this library the same Python code can be used to retrieve data whatever the access point your application uses to connect to the Refinitiv Data Platform (either via a direct connection, via Eikon, via the Refinitiv Workspace, via CodeBook or even via a local Real-Time Distribution System).

The library provides several abstraction layers enabling different programming styles and technics suitable for all developers from Financial Coders to Seasoned Developers:

 - The __Ease-of-Use layer for FinCoders__ provides Financial Coders with simple interfaces to rapidly prototype solutions within interactive environments such as Jupyter Notebooks. The goal of this layer is to simplify as much as possible access to Refinitiv data and services. It is built on top of the __Content layer__.
 - The __Content layer__ provides developers with interfaces suitable for more advanced use cases (synchronous function calls, async/await, event driven). The __Content layer__ refers to logical market data objects like market data prices and quotes, fundamental & reference data, historical data, company research data and so on. This layer is built on top of the __Delivery layer__.
 - The __Delivery layer__ is a low abstraction layer that defines interfaces used to interract with the service agnostic delivery mechanisms of the Refinitiv Data Platform.
 - The __Session layer__ defines interfaces allowing your application to connect to the different access points to the Refinitiv Data Platform (either via a direct connection, via Eikon, via the Refinitiv Workspace, via CodeBook or even via a local Real-Time Distribution System).

# Some examples...


## ... with the __Ease of use layer for FinCoders__


### Import the Refinitiv Data Library

```python
import refinitiv.data as rd
```

### Open the session

```python
session = rd.open_session()
```

### Get data

```python
    result = rd.get_data(universe=['IBM.N', 'VOD.L'], fields=['BID', 'ASK'])
    print(result)
    rd.close_session()
```

|     | Instrument | BID    | ASK   |
| --- | ---------- | ------ | ----- |
| 0   | IBM.N      | 0.00   | 0.0   |
| 1   | VOD.L      | 120.02 | 120.1 |


### Close the session

```python
rd.close_session()
```

## ... with the __Content layer__ dedicated to more advanced use cases

### Import the Refinitiv Data Library

```python
import refinitiv.data as rd
```

### Create and open the session of your choice...

#### ... either to connect directly to the Refinitiv Data Platform...

```python
session = rd.session.platform.Definition(
    session_name='default-session',
    app_key='8e9bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1b035d', 
    grant=rdp.session.platform.GrantPassword(
        'my_login', 
        'my_password'
    )
).get_session()
```

#### ...or to connect to the platform via Eikon or Refinitiv Workspace...

```python
session = rd.session.desktop.Definition(
    session_name='default-session',
    app_key='8e9bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1b035d'
).get_session()
```

#### Open the session and set it as the default
```
session.open()
rd.session.set_default(session)
```

### Fundamental And Reference data retrieval

```python
from refinitiv.data.content import fundamental_and_reference
response = fundamental_and_reference.Definition(
    ["TRI.N", "IBM.N"],
    ["TR.Revenue", "TR.GrossProfit"]
).get_data()

response.data.df
```

|     | instrument | date                | TR.Revenue  | TR.GrossProfit |
| --- | ---------- | ------------------- | ----------- | -------------- |
| 0   | TRI.N      | 2020-12-31T00:00:00 | 5984000000  | 5656000000     |
| 1   | IBM.N      | 2020-12-31T00:00:00 | 73620000000 | 35574000000    |


### Historical data retrieval

```python
from refinitiv.data.content import historical_pricing

response = historical_pricing.summaries.Definition(
    universe='VOD.L', 
    interval=historical_pricing.Intervals.DAILY,
    fields=['BID','ASK','OPEN_PRC','HIGH_1','LOW_1','TRDPRC_1','NUM_MOVES','TRNOVR_UNS']
).get_data(session)

response.data.df
```

|   | BID | ASK | OPEN_PRC | HIGH_1 | LOW_1 | TRDPRC_1 | NUM_MOVES | TRNOVR_UNS |
| --- | --- | --- | -------- | ------ | ----- | -------- | --------- | ---------- |
| 2019-12-12 | 144.32 | 144.34 | 144.42 | 145.66 | 143.46 | 144.18 | 12631.0 | 8498347218.71154 |
| 2019-12-11 | 143.58 | 143.6 | 142.72 | 144.8 | 142.62 | 143.58 | 10395.0 | 8815450412.65353 |
| 2019-12-10 | 142.74 | 142.78 | 143.84 | 143.84 | 141.48 | 142.74 | 10311.0 | 8070285210.45742 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2019-11-18 | 152.1 | 152.12 | 154.74 | 155.66 | 152.0 | 152.12 | 14606.0 | 19322988639.34 |
| 2019-11-15 | 154.6 | 154.62 | 160.68 | 160.68 | 154.06 | 154.6326 | 17035.0 | 31993013818.37456 |


### Real-time streaming data retrieval

```python
streaming_prices = rd.content.pricing.Definition(
    universe=['EUR=', 'GBP=', 'JPY=', 'CAD='], 
    fields=['DSPLY_NAME', 'BID', 'ASK']
).get_stream(session)

streaming_prices.on_refresh(lambda streaming_price, instrument_name, fields : 
        print(f"Refresh received for {instrument_name}: {fields}"))

streaming_prices.on_update(lambda streaming_price, instrument_name, fields : 
        print(f"Update received for {instrument_name}: {fields}"))

streaming_prices.open()
```

Output:

    <StreamState.Open: 3>

    Update received for JPY=: {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 109.59, 'ASK': 109.62}
    Update received for GBP=: {'DSPLY_NAME': 'ASANPACIFIBK MOW', 'BID': 1.341, 'ASK': 1.3411}
    Update received for EUR=: {'DSPLY_NAME': 'UBS          ZUR', 'BID': 1.117, 'ASK': 1.1174}
    Update received for CAD=: {'DSPLY_NAME': 'HSBC         LON', 'BID': 1.3165, 'ASK': 1.3167}
    Update received for JPY=: {'DSPLY_NAME': 'ASANPACIFIBK MOW', 'BID': 109.59, 'ASK': 109.61}
    Update received for GBP=: {'DSPLY_NAME': 'INTERPROMBAN MOW', 'BID': 1.341, 'ASK': 1.3412}
    Update received for EUR=: {'DSPLY_NAME': 'RBS          LON', 'BID': 1.117, 'ASK': 1.1174}
    Update received for CAD=: {'DSPLY_NAME': 'CIBC         TOR', 'BID': 1.316, 'ASK': 1.3164}
    Update received for JPY=: {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 109.59, 'ASK': 109.62}
    Update received for GBP=: {'DSPLY_NAME': 'INTERPROMBAN MOW', 'BID': 1.341, 'ASK': 1.3413}
    Update received for EUR=: {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 1.117, 'ASK': 1.1174}
    Update received for CAD=: {'DSPLY_NAME': 'CIBC         TOR', 'BID': 1.316, 'ASK': 1.3164}
    Update received for JPY=: {'DSPLY_NAME': 'ASANPACIFIBK MOW', 'BID': 109.59, 'ASK': 109.61}
    Update received for GBP=: {'DSPLY_NAME': 'BARCLAYS     LON', 'BID': 1.341, 'ASK': 1.3414}

### Search

```python
from refinitiv.data.content import search

response = search.Definition("IBM").get_data()

response.data.df
```

|     | RIC      | BusinessEntity | PermID      | DocumentTitle                                     | PI        |
| --- | -------- | -------------- | ----------- | ------------------------------------------------- | --------- |
| 0   | <NA>     | ORGANISATION   | <NA>        | International Business Machines Corp, Public C... | 37036     |
| 1   | IBM      | QUOTExEQUITY   | 55839165994 | International Business Machines Corp, Ordinary... | 1097326   |
| 2   | <NA>     | ORGANISATION   | <NA>        | Tiers Corporate Bond Backed Certificates Trust... | 18062670  |
| 3   | <NA>     | ORGANISATION   | <NA>        | SG Stuttgart Vaihingen BM-Campus 1 UG haftungs... | 27968389  |
| 4   | 0#IBMF:  | QUOTExEQUITY   | 21481052421 | Eurex International Business Machines Equity F... | 48924732  |
| 5   | 0#IBMDF: | QUOTExEQUITY   | 21612423771 | Euronext Amsterdam IBM Dividend Future Chain C... | 259118763 |
| 6   | IBMFc1   | QUOTExEQUITY   | 21481052892 | Eurex International Business Machines Equity F... | 49450681  |
| 7   | IBMFc2   | QUOTExEQUITY   | 21481053949 | Eurex International Business Machines Equity F... | 50092347  |
| 8   | IBMDFc1  | QUOTExEQUITY   | 21613372305 | Euronext Amsterdam IBM Single Stock Dividend F... | 260213021 |
| 9   | IBMFc3   | QUOTExEQUITY   | 21481053950 | Eurex International Business Machines Equity F... | 50092348  |


### Close the session

```python
session.close()
```

# Learning materials

 To learn more about the Refinitiv Data Library for Python just 
 connect to the Refinitiv Developer Community. By 
 [registering](https://developers.refinitiv.com/iam/register) and 
 [login](https://developers.refinitiv.com/content/devportal/en_us/initCookie.html) to the Refinitiv 
 Developer Community portal you will get free access to a number of 
 learning materials like 
 [Quick Start guides](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-library-for-python/quick-start), 
 [Tutorials](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-library-for-python/learning), 
 [Documentation](https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-library-for-python/docs)
 and much more.

# Help and Support

If you have any questions regarding the API usage, please post them on 
the [Refinitiv Data Q&A Forum](https://community.developers.refinitiv.com/spaces/321/index.html). 
The Refinitiv Developer Community will be very pleased to help you. 



