@@ -11,7 +11,7 @@ Installation
1111
1212::
1313
14- pip install ravenpackapi
14+ pip install ravenpackapi
1515
1616About
1717-----
2424-----
2525
2626In order to be able to use the RavenPack API you will need an API KEY.
27- If you don' t already have one please contact your `customer
27+ If you don’ t already have one please contact your `customer
2828support <mailto:sales@ravenpack.com> `__ representative.
2929
3030To begin using the API you will need to instantiate an API object that
@@ -35,9 +35,9 @@ environment variable or set it in your code:
3535
3636.. code :: python
3737
38- from ravenpackapi import RPApi
38+ from ravenpackapi import RPApi
3939
40- api = RPApi(api_key = " YOUR_API_KEY" )
40+ api = RPApi(api_key = " YOUR_API_KEY" )
4141
4242 Creating a new dataset
4343~~~~~~~~~~~~~~~~~~~~~~
@@ -47,19 +47,19 @@ API with a Dataset instance.
4747
4848.. code :: python
4949
50- from ravenpackapi import Dataset
50+ from ravenpackapi import Dataset
5151
52- ds = api.create_dataset(
53- Dataset(
54- name = " New Dataset" ,
55- filters = {
56- " relevance" : {
57- " $gte" : 90
58- }
59- },
60- )
61- )
62- print (" Dataset created" , ds)
52+ ds = api.create_dataset(
53+ Dataset(
54+ name = " New Dataset" ,
55+ filters = {
56+ " relevance" : {
57+ " $gte" : 90
58+ }
59+ },
60+ )
61+ )
62+ print (" Dataset created" , ds)
6363
6464 Getting data from the datasets
6565~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -71,10 +71,10 @@ Here is how you may get a dataset definition for a pre-existing dataset
7171
7272.. code :: python
7373
74- # Get the dataset description from the server, here we use 'us30'
75- # one of RavenPack public datasets with the top30 companies in the US
74+ # Get the dataset description from the server, here we use 'us30'
75+ # one of RavenPack public datasets with the top30 companies in the US
7676
77- ds = api.get_dataset(dataset_id = ' us30' )
77+ ds = api.get_dataset(dataset_id = ' us30' )
7878
7979 Downloads: json
8080^^^^^^^^^^^^^^^
@@ -85,13 +85,13 @@ use the asynchronous datafile endpoint instead.
8585
8686.. code :: python
8787
88- data = ds.json(
89- start_date = ' 2018-01-05 18:00:00' ,
90- end_date = ' 2018-01-05 18:01:00' ,
91- )
88+ data = ds.json(
89+ start_date = ' 2018-01-05 18:00:00' ,
90+ end_date = ' 2018-01-05 18:01:00' ,
91+ )
9292
93- for record in data:
94- print (record)
93+ for record in data:
94+ print (record)
9595
9696 Json queries are limited to
9797
@@ -110,13 +110,13 @@ some time to complete.
110110
111111.. code :: python
112112
113- job = ds.request_datafile(
114- start_date = ' 2018-01-05 18:00:00' ,
115- end_date = ' 2018-01-05 18:01:00' ,
116- )
113+ job = ds.request_datafile(
114+ start_date = ' 2018-01-05 18:00:00' ,
115+ end_date = ' 2018-01-05 18:01:00' ,
116+ )
117117
118- with open (' output.csv' ) as fp:
119- job.save_to_file(filename = fp.name)
118+ with open (' output.csv' ) as fp:
119+ job.save_to_file(filename = fp.name)
120120
121121 Streaming real-time data
122122~~~~~~~~~~~~~~~~~~~~~~~~
@@ -132,64 +132,64 @@ You can find a `real-time streaming example
132132here <ravenpackapi/examples/get_realtime_news.py> `__.
133133
134134The Result object handles the conversion of various fields into the
135- appropriate type, i.e. ``record.timestamp_utc `` will be converted to
135+ appropriate type, i.e. \ ``record.timestamp_utc `` will be converted to
136136``datetime ``
137137
138138Entity mapping
139139~~~~~~~~~~~~~~
140140
141- The entity mapping endpoint allow you to find the RP \_ ENTITY \_ ID mapped
142- to your universe of entities.
141+ The entity mapping endpoint allow you to find the RP_ENTITY_ID mapped to
142+ your universe of entities.
143143
144144.. code :: python
145145
146- universe = [
147- " RavenPack" ,
148- {' ticker' : ' AAPL' },
149- ' California USA' ,
150- { # Amazon, specifying various fields
151- " client_id" : " 12345-A" ,
152- " date" : " 2017-01-01" ,
153- " name" : " Amazon Inc." ,
154- " entity_type" : " COMP" ,
155- " isin" : " US0231351067" ,
156- " cusip" : " 023135106" ,
157- " sedol" : " B58WM62" ,
158- " listing" : " XNAS:AMZN"
159- },
160-
161- ]
162- mapping = api.get_entity_mapping(universe)
163-
164- # in this case we match everything
165- assert len (mapping.matched) == len (universe)
166- assert [m.name for m in mapping.matched] == [
167- " RavenPack International S.L." ,
168- " Apple Inc." ,
169- " California, U.S." ,
170- " Amazon.com Inc."
171- ]
146+ universe = [
147+ " RavenPack" ,
148+ {' ticker' : ' AAPL' },
149+ ' California USA' ,
150+ { # Amazon, specifying various fields
151+ " client_id" : " 12345-A" ,
152+ " date" : " 2017-01-01" ,
153+ " name" : " Amazon Inc." ,
154+ " entity_type" : " COMP" ,
155+ " isin" : " US0231351067" ,
156+ " cusip" : " 023135106" ,
157+ " sedol" : " B58WM62" ,
158+ " listing" : " XNAS:AMZN"
159+ },
160+
161+ ]
162+ mapping = api.get_entity_mapping(universe)
163+
164+ # in this case we match everything
165+ assert len (mapping.matched) == len (universe)
166+ assert [m.name for m in mapping.matched] == [
167+ " RavenPack International S.L." ,
168+ " Apple Inc." ,
169+ " California, U.S." ,
170+ " Amazon.com Inc."
171+ ]
172172
173173 Entity reference
174174~~~~~~~~~~~~~~~~
175175
176176The entity reference endpoint give you all the available information for
177- an Entity given the RP \_ ENTITY \_ ID
177+ an Entity given the RP_ENTITY_ID
178178
179179.. code :: python
180180
181- ALPHABET_RP_ENTITY_ID = ' 4A6F00'
181+ ALPHABET_RP_ENTITY_ID = ' 4A6F00'
182182
183- references = api.get_entity_reference(ALPHABET_RP_ENTITY_ID )
183+ references = api.get_entity_reference(ALPHABET_RP_ENTITY_ID )
184184
185- # show all the names over history
186- for name in references.names:
187- print (name.value, name.start, name.end)
185+ # show all the names over history
186+ for name in references.names:
187+ print (name.value, name.start, name.end)
188188
189- # print all the ticket valid today
190- for ticker in references.tickers:
191- if ticker.is_valid():
192- print (ticker)
189+ # print all the ticket valid today
190+ for ticker in references.tickers:
191+ if ticker.is_valid():
192+ print (ticker)
193193
194194 Text Analytics
195195~~~~~~~~~~~~~~
@@ -213,15 +213,15 @@ internal proxy:
213213
214214.. code :: python
215215
216- api = RPApi()
217- api.common_request_params.update(
218- dict (
219- proxies = {' https' : ' http://your_internal_proxy:9999' },
220- verify = False ,
221- )
222- )
216+ api = RPApi()
217+ api.common_request_params.update(
218+ dict (
219+ proxies = {' https' : ' http://your_internal_proxy:9999' },
220+ verify = False ,
221+ )
222+ )
223223
224- # use the api to do requests
224+ # use the api to do requests
225225
226226 PS. For setting your internal proxies, requests will honor the
227- HTTPS \_ PROXY environment variable.
227+ HTTPS_PROXY environment variable.
0 commit comments