I am trying to use the FRED API to get the economic data. The examples provided on the FRED website uses series Id to get the observations/values for a particular series. I am not able to find where I can find the series IDs. For example, in the below example it is asking for series id to get the data-
https://api.stlouisfed.org/fred/series/observations?series_id=GNPCA&api_key=*your_key*
Any help is appreciated.
From the documentation on FRED API, fred/category/series, "Get the series in a category."; an example:
https://api.stlouisfed.org/fred/category/series?category_id=125&api_key=abcdefghijklmnopqrstuvwxyz123456
Just go here Federal Reserve Economic Data | FRED | St. Louis Fed and search for the series you're interested in. Alternately, you can browse by several attributes, including Category from there. Once you've searched, if you find it, click one of the results. A search for S&P 500 yielded a link to S&P 500 | FRED | St. Louis Fed, which has a chart of it. You'll see some letters and/or numbers in parentheses right beside the page's title. In this case, it is SP500. THAT is your series ID.
Your complete link will be https://api.stlouisfed.org/fred/series/observations?series_id=SP500&file_type=json&api_key=YourAPIKey. More parameters are here: St. Louis Fed Web Services: fred/series/observations
Perhaps this will help you:
GET https://api.stlouisfed.org/fred/series/search?search_text=**your+search+query**&api_key=**abc123**&file_type=json&observation_start=2016-03-01&observation_end=2016-03-15
This will return JSON data with the series id you are looking for....
{
"realtime_start": "2016-04-06",
"realtime_end": "2016-04-06",
"order_by": "search_rank",
"sort_order": "desc",
"count": 164,
"offset": 0,
"limit": 1000,
"series**s**": [
{
"id": "**FEDFUNDS**",
"realtime_start": "2016-04-06",
"realtime_end": "2016-04-06",
"title": "Effective Federal Funds Rate",
------------------ json result intentionally cut off -------------
There are different ways to get the series id's and category id's found here:
https://research.stlouisfed.org/docs/api/fred/
Related
I do try to build a factur-x using Mustang library.
For minimum profile, a Buyer legal registration identifier is required.
For this I build a trade party object:
TradeParty recipient = new TradeParty(
"My Client",
"My address",
"06000",
"City",
"FR")
.setID("123 456 789 10111");
My issue is the following:
I'm able to build an XML (that's what I want)
I'm not able to set the organization ID and pass the schemeID to 0002 (for french factur-X).
I didn't find how to set
Here is what is expected:
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">123 456 789 10111</ram:ID>
</ram:SpecifiedLegalOrganization>
I do also have to set the business process type, which is specific for Chorus Pro (in france):
<ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:ID>A1</ram:ID>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
Here, A1 means invoice deposit, A2 means prepaid invoice deposit, ... By default (in the absence of this field), the case A1 is applied.
The output for recipient :
<ram:BuyerTradeParty>
<ram:ID>123 456 789 10111</ram:ID>
<ram:Name>My Client</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>06000</ram:PostcodeCode>
<ram:LineOne>My address</ram:LineOne>
<ram:CityName>City</ram:CityName>
<ram:CountryID>FR</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
SpecifiedLegalOrganisation/ID has been added to Mustang 2.5 https://www.mustangproject.org/mustang-2-5-0/, please report an issue via https://github.com/ZUGFeRD/mustangproject/issues if there are further requirements vis á vis Chorus Pro I am not aware of.
as you indicated (and as described in the english FX spec 1.05 e.g. on page 115 as well as in the technical annex to ZUGFeRD with a cardinality 0..1) BT-23, i.e. ram:BusinessProcessSpecifiedDocumentContextParameter is optional so you can just omit it unless you need other values. Do you require to set anything nonstandard here?
However, so far nobody ever requested being able to set the legalorganisation +ID and scheme ID, which means that probably nobody ever used Mustang so far to write invoices vis á vis the french authorities (only to german ones or for factur-x B2B invoices).
However, I just added the possibility, you can now use someTradeParty.setLegalOrganisation(new LegalOrganisation("0815", "0002")). This will become part of the next release, could you please confirm that this works and is all you need?
I have two data files which is some weird format. Need to parse it to some descent format to use that for future purposes. after parsing i end up having two formats on which one has an id and respective information pertaining to that id will be from another file.
Ex :
From file 1 i get
Name, Position, PropertyID
from file 2
PropertyId, Property1,Property2
like this i have more columns from both the file.
what is the idle way to store these information in a flat file to server as a database. i don't want to use database(Mysql,MsSql) for some reason.
initially i thought of using single Coma separated file. but ill end up using so many columns which will create problem when i update these information.
I ll be using the parsed data in some other application using java and python
can anyone suggest better way to handle this
Thanks
I would use JSON. JSON can be easily converted to and from objects in either Python or Java. In Python, JSON maps directly to dict. Java has various facilities to convert. Far less work than doing all that yourself. For Java, see JAXB.
Something like this.
File 1: Map people to propertyID
{
{"firstName": "John", "lastName": "Smith", "position": "sales"} : 123},
{"firstName": "Jane", "lastName": "Doe", "position": "manager"} : 456}
}
File 2: Map propertyId to list of properties.
{
{123: [{"address": "123 street", "city": "LA"}, {"address": "456 street", "city": "SF"}] } ,
{456: [{"address": "123 ave", "city": "XX"}, {"address": "456 ave", "city": "SF"}] }
}
p.s. It might make more sense to associate a person with a list of property IDs and have each property have it's own ID. Easier to move things around and reassign. Just my $0.02.
Ensure that you normalize your data with an ID to avoid touching so many different data columns with even a single change. Like the file2 you mentioned above, you can reduce the columns to two by having just the propertyId and the property columns. Rather than having 1 propertyId associated with 2 property in a single row you'd have 1 propertyId associated with 1 property per your example above. You need another file to correlate your two main data table. Normalizing your data like this can make your updates to them very minimal when change occurs.
file1:
owner_id | name | position |
1 | Jack Ma | CEO |
file2:
property_id | property |
101 | Hollywood Mansion |
102 | Miami Beach House |
file3:
OwnerId | PropertyId |
1 | 101
1 | 102
After reading the documentation and Google's developer guide, I did not find a to add a second address line.
For example, if I want to store this address as a Google contact :
Mr. Ace Person
Amphitheatre Village Premium Outlets
1600 Amphitheatre Pkwy
Mountain View CA 94043
I can add the street as demonstrated in the developer guide :
StructuredPostalAddress postalAddress = new StructuredPostalAddress();
postalAddress.setStreet(new Street("1600 Amphitheatre Pkwy"));
I couldn't find a structured solution to add a "2 line street address".
Obviously I could add one of the two lines as a house-name (setHousename(housename)) or Neighborhood (setNeighborhood(neighborhood)) but this is not quiet right.
Unfortunately, there is no document or feature that support what you want to accomplish. According to the current document pertaining to the element's property which you can choose what appropriate property to work around you 2nd street line. I hope it helps.
I've worked with several different APIs where I needed to parse JSON. And in all cases the Response is constructed a bit differently.
I now need to expose some data via a JSON API and want to know the proper way to deliver that Response.
Here is an example of what I have now, however some users (one using Java) are having difficulty parsing.
{"status": "200 OK",
"code": "\/api\/status\/ok",
"result": {
"publishers": ["Asmodee", "HOBBITY.eu", "Kaissa Chess & Games"],
"playing_time": 30, "description": "2010 Spiel des Jahres WinnerOne player is the storyteller for the turn. He looks at the 6 images in his hand. From one of these, he makes up a sentence and says it out loud (without showing the card to the other players).The other players select amongst their 6 images the one that best matches the sentence made up by the storyteller.Then, each of them gives their selected card to the storyteller, without showing it to the others. The storyteller shuffles his card with all the received cards. ",
"expansions": ["Dixit 2", "Dixit 2: \"Gift\" Promo Card", "Dixit 2: The American Promo Card", "Dixit Odyssey"],
"age": 8,
"min_players": 3,
"mid": "\/m\/0cn_gq3",
"max_players": null,
"designers": ["Jean-Louis Roubira"],
"year_published": 2008,
"name": "Dixit"
}
}
The Java user in particular is complaining that they get the error:
org.json.JSONException:[json string] of type org.json.JSONObject cannot be converted to JSONArray
But in Python I am able to take in this Response, fetch "result" and then parse as I would any other JSON data.
* UPDATE *
I passed both my JSON and Twitter's timeline JSON to JSONLint. Both are valid. The Java user can parse Twitter's JSON but not mine. What I noticed with Twitter's JSON is that it's encapsulated with brackets [], signifying an array. And the error this user is getting with my JSON is that it cannot be converted to a JSON array. I didn't think I need to encapsulate in brackets.
It looks valid according to http://json.parser.online.fr/ (random json parser). Its in the other code i'd say ;)
How exactly are you generating this response? Are you doing it yourself?
I see you have a dangling comma at the end of the last element in publishers (i.e. after the value Kaissa Chess & Games).
I'd recommend using JSONLint to ensure your JSON is valid.
I have a database which has very similar rows within the same table. Those rows are similar because they have nearly equal column values. I need to integrate those corresponding rows into one single row.
For example, those two users (u1 and u2) should be integrated:
u1 = User(name = "William Henry Gates III",
age = 55,
nationality = "american",
alma_mater = "Harvard Univesity")
u2 = User(name: "William Henry 'Bill' Gates III",
age: 55,
nationality: "America",
alma_mater: "Harvard U.")
I am thinking of using some edit distance and stemming techniques. Other algorithms and techniques suggestions? Any helpful libraries to use (preferably in Python or Java)?
Considered something like Refine?