@@ -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 \* granular datasets: 10,000 records \*
9797indicator datasets: 500 entities, timerange 1 year, lookback window 1
@@ -108,13 +108,13 @@ some time to complete.
108108
109109.. code :: python
110110
111- job = ds.request_datafile(
112- start_date = ' 2018-01-05 18:00:00' ,
113- end_date = ' 2018-01-05 18:01:00' ,
114- )
111+ job = ds.request_datafile(
112+ start_date = ' 2018-01-05 18:00:00' ,
113+ end_date = ' 2018-01-05 18:01:00' ,
114+ )
115115
116- with open (' output.csv' ) as fp:
117- job.save_to_file(filename = fp.name)
116+ with open (' output.csv' ) as fp:
117+ job.save_to_file(filename = fp.name)
118118
119119 Streaming real-time data
120120~~~~~~~~~~~~~~~~~~~~~~~~
@@ -130,64 +130,64 @@ You can find a `real-time streaming example
130130here <ravenpackapi/examples/get_realtime_news.py> `__.
131131
132132The Result object handles the conversion of various fields into the
133- appropriate type, i.e. ``record.timestamp_utc `` will be converted to
133+ appropriate type, i.e. \ ``record.timestamp_utc `` will be converted to
134134``datetime ``
135135
136136Entity mapping
137137~~~~~~~~~~~~~~
138138
139- The entity mapping endpoint allow you to find the RP \_ ENTITY \_ ID mapped
140- to your universe of entities.
139+ The entity mapping endpoint allow you to find the RP_ENTITY_ID mapped to
140+ your universe of entities.
141141
142142.. code :: python
143143
144- universe = [
145- " RavenPack" ,
146- {' ticker' : ' AAPL' },
147- ' California USA' ,
148- { # Amazon, specifying various fields
149- " client_id" : " 12345-A" ,
150- " date" : " 2017-01-01" ,
151- " name" : " Amazon Inc." ,
152- " entity_type" : " COMP" ,
153- " isin" : " US0231351067" ,
154- " cusip" : " 023135106" ,
155- " sedol" : " B58WM62" ,
156- " listing" : " XNAS:AMZN"
157- },
158-
159- ]
160- mapping = api.get_entity_mapping(universe)
161-
162- # in this case we match everything
163- assert len (mapping.matched) == len (universe)
164- assert [m.name for m in mapping.matched] == [
165- " RavenPack International S.L." ,
166- " Apple Inc." ,
167- " California, U.S." ,
168- " Amazon.com Inc."
169- ]
144+ universe = [
145+ " RavenPack" ,
146+ {' ticker' : ' AAPL' },
147+ ' California USA' ,
148+ { # Amazon, specifying various fields
149+ " client_id" : " 12345-A" ,
150+ " date" : " 2017-01-01" ,
151+ " name" : " Amazon Inc." ,
152+ " entity_type" : " COMP" ,
153+ " isin" : " US0231351067" ,
154+ " cusip" : " 023135106" ,
155+ " sedol" : " B58WM62" ,
156+ " listing" : " XNAS:AMZN"
157+ },
158+
159+ ]
160+ mapping = api.get_entity_mapping(universe)
161+
162+ # in this case we match everything
163+ assert len (mapping.matched) == len (universe)
164+ assert [m.name for m in mapping.matched] == [
165+ " RavenPack International S.L." ,
166+ " Apple Inc." ,
167+ " California, U.S." ,
168+ " Amazon.com Inc."
169+ ]
170170
171171 Entity reference
172172~~~~~~~~~~~~~~~~
173173
174174The entity reference endpoint give you all the available information for
175- an Entity given the RP \_ ENTITY \_ ID
175+ an Entity given the RP_ENTITY_ID
176176
177177.. code :: python
178178
179- ALPHABET_RP_ENTITY_ID = ' 4A6F00'
179+ ALPHABET_RP_ENTITY_ID = ' 4A6F00'
180180
181- references = api.get_entity_reference(ALPHABET_RP_ENTITY_ID )
181+ references = api.get_entity_reference(ALPHABET_RP_ENTITY_ID )
182182
183- # show all the names over history
184- for name in references.names:
185- print (name.value, name.start, name.end)
186-
187- # print all the ticket valid today
188- for ticker in references.tickers:
189- if ticker.is_valid():
190- print (ticker)
183+ # show all the names over history
184+ for name in references.names:
185+ print (name.value, name.start, name.end)
186+
187+ # print all the ticket valid today
188+ for ticker in references.tickers:
189+ if ticker.is_valid():
190+ print (ticker)
191191
192192 Text Analytics
193193~~~~~~~~~~~~~~
@@ -211,15 +211,15 @@ internal proxy:
211211
212212.. code :: python
213213
214- api = RPApi()
215- api.common_request_params.update(
216- dict (
217- proxies = {' https' : ' http://your_internal_proxy:9999' },
218- verify = False ,
219- )
220- )
214+ api = RPApi()
215+ api.common_request_params.update(
216+ dict (
217+ proxies = {' https' : ' http://your_internal_proxy:9999' },
218+ verify = False ,
219+ )
220+ )
221221
222- # use the api to do requests
222+ # use the api to do requests
223223
224224 PS. For setting your internal proxies, requests will honor the
225- HTTPS \_ PROXY environment variable.
225+ HTTPS_PROXY environment variable.
0 commit comments