Sei sulla pagina 1di 7

QuandlTabularDataAPI:InterimDocumentation

EffectiveAugust2016.Foradditionalsupportpleasecontact
connect@quandl.com.

ThisdocumentcontainsinterimdocumentationforQuandlsAPIforgeneraltabulardata.This
isadifferentAPIfromQuandlstimeseriesdataAPI.

Datatables

Generaltabulardataisstoredindatatables.Adatatablesimplyatableofdata;acollectionof
datastructuredasoneormorecolumnsandrows.

EverydatatableonQuandlcanbeidentifiedbyitsuniqueQuandlcodeviathe:datatableAPI
route.TheQuandlcodeforadatatableisthecombinationofitsvendor_codeandits
datatable_code.

GEThttps://www.quandl.com/api/v3/datatables/:vendor_code/:datatable_code/

HereisasimpleAPIcall:

curl"https://www.quandl.com/api/v3/datatables/ZACKS/FC.csv?api_key=YOURAPIKEY"XGET

ThiscallwouldreturntheFCdatatable,initsentiretyasaCSVdocument.(Youcanreplace
.csvwith.jsonor.xml).

FilteringParameters

Youcancustomizethedatatableobjectbeingreturnedbyaddingvariousfilterparametersto
yourquery.Filterparametersareuniquetoeachdatatable.Theavailablefilterparameterscan
befoundwithineachdatatablesdocumentationwebpage.Forexample,thefilterparameters
forZACKS/FCare:

Parameter Required Description

per_end_date false Retrievedataforaspecificdate,bysettinga


periodenddateinyourquery.Settheperiod
enddatewith:per_end_date=yyyymmdd

ticker false Retrievedataforaspecificstocktickerby


includingthetickersymbolinyourquery.
per_type false Retrievedataforaspecifictimeperiod.To
retrievequarterlydatapassper_type=Q,to
retrieveannualdatapassper_type=A.

Atablesfilterablecolumnsareavailableatitsmetadataroute,forexample:

https://www.quandl.com/api/v3/datatables/ZACKS/FC/metadata.json?api_key=YOURAPIKEY

MultipleValues

Ifyouwanttoselectmultiplevaluesforthesameparameter,youcanpassanarraytotheAPI
byincludingtheparameterfollowedbycommaforeachquery.

Forexample,ifyouwanttoqueryforthetickersAAPLandMSFTandreturncolumnsfortotal
revenueandcompanyname:

https://www.quandl.com/api/v3/datatables/ZACKS/FC.json?api_key=YOURAPIKEY&ticker=AAP
L,MSFT&qopts.columns=tot_revnu,comp_name

FilterModifiers

YoucanmodifycertainfiltersbyappendingamodifiertotheparameterinyourAPIcall.

Parameterfiltersaretabulatedbelow:

Filter Required Description

.gt false Modifiestheparametertoreturnvaluesgreaterthantherequested


value.

.lt false Modifiestheparametertoreturnvalueslessthantherequestedvalue.


.gte false Modifiestheparametertoreturnvaluesgreaterthanorequaltothe


requestedvalue.

.lte false Modifiestheparametertoreturnvalueslessthanorequaltothe


requestedvalue.

Forexample,tomodifytheparameterper_end_datetoretrievedatafromAAPLafterJan.1,
2015,usethefollowingAPIcall:

https://www.quandl.com/api/v3/datatables/ZACKS/FC.json?api_key=YOURAPIKEY&ticker=AAP
L&per_end_date.gt=20150101







ComplexExampleBreakdown


https://www.quandl.com/api/v3/datatables/ZACKS/FC.csv?api_key=YOURAPIKEY&ticker=AAPL,
MSFT&per_end_date.gt=20120101&per_end_date.lte=20141231&per_type=A&qopts.colum
ns=ticker,per_end_date,tot_revnu


https://www.quandl.com/api/v3/datatables/ APIendpoint

ZACKS/FC QuandlCode(VendorZACKS,tableFC)

.csv Returncsvformat

api_key=YOURAPIKEY Authentication

&ticker=AAPL,MSFT SelectallrowswithtickerAAPLorMSFT

&per_end_date.gt=20120101&per_end_dat Selectallrowswithper_end_dategreater
e.lte=20141231 than20120101andlessthanorequalto
20141231

&per_type=A Selectallrowswithper_typeequaltoA.In
thiscasereferringtoallannualrecords

&qopts.columns=ticker,per_end_date,tot_rev Showonlythecolumnsticker,per_end_date
nu andtot_revnu

Metadata

Todownloadthemetadataassociatedwithadatatable,append/metadatatoyourAPIrequest.

(Youcanreplace.jsonwith.csvor.xmlinthisrequest).

curl
"https://www.quandl.com/api/v3/datatables/ZACKS/FC/metadata.xml?api_key=YOURAPIKEY"
XGET
Exampleresponse:

<quandlresponse>
<datatable>
<vendorcode>ZACKS</vendorcode>
<datatablecode>FC</datatablecode>
<name>ZacksFundamentalsCondensed</name>
<descriptionnil="true"/>
<columnstype="array">...</columns>
<filterstype="array">
<filter>ticker</filter>
<filter>per_type</filter>
<filter>per_end_date</filter>
</filters>
<primarykeytype="array">
<primarykey>m_ticker</primarykey>
<primarykey>per_type</primarykey>
<primarykey>per_end_date</primarykey>
</primarykey>
<premiumtype="boolean">false</premium>
</datatable>
</quandlresponse>

OtherParameters

Therearefourgeneralparametersthatarecommontoalldatatables:

Parameter Required Description

qopts.per_page false Thenumberofresultsperpagethatwillbe


returned.

qopts.cursor_id false EachAPIcallreturnsauniquecursoridthat


identifiesthenextpageofthedatatable.
IncludingthecursoridinyourAPIcallwillallow
youtopagethroughthedatatable.Anullcursor
idmeansthatthecurrentpageisthelastpageof
thedatatable.

qopts.columns false Requestdatafromspecificcolumnsbypassing


theqopts.columnsparameter.Ifyouwantto
queryformultiplecolumns,includethecolumn
namesseparatedbyacomma.

qopts.export false Goodforlargequeries,thedatarequestedis


packagedintoazipfolderreadyfordownload.
Moreinformationinthenextsection.
DatatableBulkDownload

Overview

ThenewbulkdownloadAPIforDatatablesprovidesQuandluserswithatooltogenerate
customCSVfilesfromthedatacontainedinaDatatable.Thefilesarecreatedondemand
basedontheprovidedAPIparametersandaredeliveredasynchronously.

QuickExample

Note:thebelowexamplesmustalsoincludeavalidAPIkey(append
&api_key=YOUR_API_KEY)oranerrorwillbereturned.

AlldatafromZacksEquityPricesDatatableforAAPL,FBMSFTandAMZN
between1995and2005(requestedviaHTML)

https://www.quandl.com/api/v3/datatables/ZACKS/P?ticker=MSFT,AAPL,AMZN,FB&date.gte=1
9950101&date.lte=20151231&qopts.export=true

Note:YouwillonlygetaccesstoZACKS/PifyouaresubscribedtotheZEPdatabasewiththe
Zacks/Pdatatable.Ifnot,pleasesubstituteZACKS/Pwiththevendor/datatablecodethat
youaresubscribedto.

AlldatafromZacksFundamentalsCondensedDatatable(requestedvia
JSON)

https://www.quandl.com/api/v3/datatables/ZACKS/FC.json?qopts.export=true

Usage

APISignature

TousethebulkdownloadAPIfordatatables,simplyappendthequeryparameter
qopts.export=truetoanyDatatablesAPIrequest.Whenthisparameterispresent,ratherthan
returningdatasynchronouslyinpages,Quandlwillgenerateasinglefilecontainingallofthe
requesteddata,andreturnmetadatacontainingthelocationandstatusofthisfile.
TheAPIcanbeusedviaHTML,JSON,XMLorCSV.Thefollowingisanexampleresponsein
JSON:

{
"datatable_bulk_download":{
"file":{
"link":"https://duf9k3nptkna3.cloudfront.net",
"status":"fresh",
"data_snapshot_time":"2016060814:02:50UTC"
},
"datatable":{
"last_refreshed_time":"2016060722:53:19UTC"
}
}
}

AttributeDefinitions

file
linkThestringURLwherethefilecanbedownloaded,ornull,ifitisnot
present.
statusThestringstatusoftherequestedfile.Thepossiblevaluesare:
Freshthefileisavailableanduptodate
Creatingthefileisnotavailable,butitisbeingcreated
Regeneratingthefileisavailable,butitisoutofdateandanewoneis
beingcreated.
data_snapshot_timetheDateTimewhenfilecreationstarted.
datatable
last_refreshed_timeTheDateTimewhentheDatatablewaslastupdated.


ThegeneratedlinkdownloadURLisvalidfor2minutes.Ifyourlinkexpires,repeatyour
requesttotheAPItogenerateanewlinkdownloadURL.

Limits

UsersmustbeloggedintoaccessthebulkdownloadAPI.
Usersarelimitedtorequesting10bulkdownloadfileseveryhour.
Thegeneratedfilewillincludeonlythedatathattherequestinguserisentitledto.Ifyou
donothaveasubscriptiontothedata,yourfilewillincludeonlypreviewdata.

Potrebbero piacerti anche