Skip to content

Commit b9352c1

Browse files
committed
Update README.md
1 parent 30a5e8b commit b9352c1

File tree

2 files changed

+53
-49
lines changed

2 files changed

+53
-49
lines changed

README.md

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
A Python library to consume the [RavenPack](https://www.ravenpack.com) API.
44

5-
[API documention.](https://www.ravenpack.com/support/)
5+
[API documentation.](https://www.ravenpack.com/support/)
66

77
## Installation
88

99
pip install ravenpackapi
1010

1111
## About
1212

13-
The Python client helps managing the API calls to the RavenPack dataset server
14-
in a Pythonic way, here are some examples of usage, you can find more in the tests.
13+
The Python client helps managing the API calls to the RavenPack dataset server in a Pythonic way, here are some examples
14+
of usage, you can find more in the tests.
1515

1616
## Usage
1717

18-
In order to be able to use the RavenPack API you will need an API KEY.
19-
If you don't already have one please contact your [customer support](mailto:sales@ravenpack.com) representative.
18+
In order to be able to use the RavenPack API you will need an API KEY. If you don't already have one please contact
19+
your [customer support](mailto:sales@ravenpack.com) representative.
2020

2121
To begin using the API you will need to instantiate an API object that will deal with the API calls.
2222

@@ -60,9 +60,11 @@ Here is how you may get a dataset definition for a pre-existing dataset
6060

6161
ds = api.get_dataset(dataset_id='us30')
6262
```
63+
6364
#### Downloads: json
6465

65-
The json endpoint is useful for asking data synchronously, optimized for small requests, if you need to download big data chunks you may want to use the asynchronous datafile endpoint instead.
66+
The json endpoint is useful for asking data synchronously, optimized for small requests, if you need to download big
67+
data chunks you may want to use the asynchronous datafile endpoint instead.
6668

6769
```python
6870
data = ds.json(
@@ -75,12 +77,14 @@ for record in data:
7577
```
7678

7779
Json queries are limited to
80+
7881
* granular datasets: 10,000 records
7982
* indicator datasets: 500 entities, timerange 1 year, lookback window 1 year
8083

8184
#### Downloads: datafile
8285

83-
For bigger requests the datafile endpoint can be used to prepare a datafile asynchronously on the RavenPack server for later retrieval.
86+
For bigger requests the datafile endpoint can be used to prepare a datafile asynchronously on the RavenPack server for
87+
later retrieval.
8488

8589
Requesting a datafile, will give you back a job object, that will take some time to complete.
8690

@@ -91,53 +95,52 @@ job = ds.request_datafile(
9195
)
9296

9397
with open('output.csv') as fp:
94-
job.save_to_file(filename=fp.name)
98+
job.save_to_file(filename=fp.name)
9599
```
96100

97101
### Streaming real-time data
98102

99103
It is possible to subscribe to a real-time stream for a dataset.
100104

101-
Once you create a streaming connection to the real-time feed with your dataset,
102-
you will receive analytics records as soon as they are published.
105+
Once you create a streaming connection to the real-time feed with your dataset, you will receive analytics records as
106+
soon as they are published.
103107

108+
It is suggested to handle possible disconnection with a retry policy. You can find
109+
a [real-time streaming example here](ravenpackapi/examples/get_realtime_news.py).
104110

105-
It is suggested to handle possible disconnection with a retry policy.
106-
You can find a [real-time streaming example here](ravenpackapi/examples/get_realtime_news.py).
107-
108-
The Result object handles the conversion of various fields into the appropriate type,
109-
i.e. `record.timestamp_utc` will be converted to `datetime`
111+
The Result object handles the conversion of various fields into the appropriate type, i.e. `record.timestamp_utc` will
112+
be converted to `datetime`
110113

111114
### Entity mapping
112115

113116
The entity mapping endpoint allow you to find the RP_ENTITY_ID mapped to your universe of entities.
114117

115118
```python
116119
universe = [
117-
"RavenPack",
118-
{'ticker': 'AAPL'},
119-
'California USA',
120-
{ # Amazon, specifying various fields
121-
"client_id": "12345-A",
122-
"date": "2017-01-01",
123-
"name": "Amazon Inc.",
124-
"entity_type": "COMP",
125-
"isin": "US0231351067",
126-
"cusip": "023135106",
127-
"sedol": "B58WM62",
128-
"listing": "XNAS:AMZN"
129-
},
130-
120+
"RavenPack",
121+
{'ticker': 'AAPL'},
122+
'California USA',
123+
{ # Amazon, specifying various fields
124+
"client_id": "12345-A",
125+
"date": "2017-01-01",
126+
"name": "Amazon Inc.",
127+
"entity_type": "COMP",
128+
"isin": "US0231351067",
129+
"cusip": "023135106",
130+
"sedol": "B58WM62",
131+
"listing": "XNAS:AMZN"
132+
},
133+
131134
]
132135
mapping = api.get_entity_mapping(universe)
133136

134137
# in this case we match everything
135138
assert len(mapping.matched) == len(universe)
136139
assert [m.name for m in mapping.matched] == [
137-
"RavenPack International S.L.",
138-
"Apple Inc.",
139-
"California, U.S.",
140-
"Amazon.com Inc."
140+
"RavenPack International S.L.",
141+
"Apple Inc.",
142+
"California, U.S.",
143+
"Amazon.com Inc."
141144
]
142145
```
143146

@@ -153,7 +156,7 @@ references = api.get_entity_reference(ALPHABET_RP_ENTITY_ID)
153156
# show all the names over history
154157
for name in references.names:
155158
print(name.value, name.start, name.end)
156-
159+
157160
# print all the ticket valid today
158161
for ticker in references.tickers:
159162
if ticker.is_valid():
@@ -164,24 +167,23 @@ for ticker in references.tickers:
164167

165168
Analyse your own content using RavenPack’s proprietary NLP technology.
166169

167-
The API for analyzing your internal content is still in beta and may change in the future.
168-
You can request an early access and [see an example of usage here](ravenpackapi/examples/text_extraction.py).
169-
170+
The API for analyzing your internal content is still in beta and may change in the future. You can request an early
171+
access and [see an example of usage here](ravenpackapi/examples/text_extraction.py).
170172

171173
### Accessing the low-level requests
172174

173-
RavenPack API wrapper is using the [requests library](https://2.python-requests.org) to do HTTPS requests,
174-
you can set common requests parameters to all the outbound calls by setting the `common_request_params` attribute.
175+
RavenPack API wrapper is using the [requests library](https://2.python-requests.org) to do HTTPS requests, you can set
176+
common requests parameters to all the outbound calls by setting the `common_request_params` attribute.
175177

176178
For example, to disable HTTPS certificate verification and to setup your internal proxy:
177179

178180
```python
179181
api = RPApi()
180182
api.common_request_params.update(
181-
dict(
182-
proxies={'https': 'http://your_internal_proxy:9999'},
183-
verify=False,
184-
)
183+
dict(
184+
proxies={'https': 'http://your_internal_proxy:9999'},
185+
verify=False,
186+
)
185187
)
186188

187189
# use the api to do requests

README.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RavenPack API - Python client
44
A Python library to consume the
55
`RavenPack <https://www.ravenpack.com>`__ API.
66

7-
`API documention. <https://www.ravenpack.com/support/>`__
7+
`API documentation. <https://www.ravenpack.com/support/>`__
88

99
Installation
1010
------------
@@ -93,9 +93,11 @@ use the asynchronous datafile endpoint instead.
9393
for record in data:
9494
print(record)
9595
96-
Json queries are limited to \* granular datasets: 10,000 records \*
97-
indicator datasets: 500 entities, timerange 1 year, lookback window 1
98-
year
96+
Json queries are limited to
97+
98+
- granular datasets: 10,000 records
99+
- indicator datasets: 500 entities, timerange 1 year, lookback window 1
100+
year
99101

100102
Downloads: datafile
101103
^^^^^^^^^^^^^^^^^^^
@@ -155,7 +157,7 @@ your universe of entities.
155157
"sedol": "B58WM62",
156158
"listing": "XNAS:AMZN"
157159
},
158-
160+
159161
]
160162
mapping = api.get_entity_mapping(universe)
161163
@@ -183,7 +185,7 @@ an Entity given the RP_ENTITY_ID
183185
# show all the names over history
184186
for name in references.names:
185187
print(name.value, name.start, name.end)
186-
188+
187189
# print all the ticket valid today
188190
for ticker in references.tickers:
189191
if ticker.is_valid():

0 commit comments

Comments
 (0)