The Google Finance Portfolio Data API allows client applications to view and update Finance content in the form of Google Data API feeds.
Your client application can use the Finance Data API to create new portfolio and transaction entries, request a list of entries, and edit or delete existing entries.
In addition to providing some background on the capabilities of the Finance Data API, this document provides examples of basic Data API interactions using raw XML and HTTP. After reading this document, you may want to learn more about interacting with the API using our client libraries by reading the programming-language-specific sections of this developer's guide.
This document is intended for programmers who want to write client applications that can interact with Google Finance using XML and HTTP.
This document assumes that you understand the general ideas behind the Google Data APIs protocol, and that you're familiar with the Google Finance GUI.
If you're using a UNIX system and you want to try the examples in this document without writing any code, you may find the UNIX command-line utilities curl or wget useful; for more information, see the manual pages for those utilities.
For Finance Data API reference information, see the Protocol reference guide.
You may want to sign up for a Finance account for testing purposes. Finance uses Google Accounts, so if you already have a Google account, you're all set.
User accounts at Google Finance are not connected to brokerages or other financial systems. If a user's Finance account shows the user as holding a particular position, that doesn't necesarily mean the user actually holds that position in the real world.
Transactions that a client sends to Google Finance also don't have any effect on the real world. If your client sends a Buy order for 50 shares of GOOG, that doesn't cause the user to actually purchase anything; the only thing that changes is the user's position information in their Google Finance account.
Conversely, if the user performs a real-world transaction through a brokerage or other system, then their Finance account doesn't get updated until they use a client (or the GUI) to send the information about the transaction to Google Finance.
However, the market values, returns, and gains provided in Finance Data API feeds do use real-world market data, so if a user accurately records their transactions, then the performance data provided by Google Finance is accurate.
The Finance Data API provides a hierarchical set of three feed types:
For more information about these feeds, see the appropriate sections of this developer's guide, or the feed types section of the reference guide.
A client must authenticate before using the Finance Data API. It can authenticate using either of two approaches: AuthSub proxy authentication or ClientLogin username/password authentication.
For more information about authentication with Google Data APIs in general, see the authentication documentation.
Most of the samples in subsequent sections of this document assume you're supplying the appropriate authentication.
AuthSub proxy authentication is used by web applications that need to authenticate their users to Google Accounts. The website operator and the client code don't have access to the username and password for the Finance user; instead, the client obtains special AuthSub tokens that allow the client to act on a particular user's behalf. For more detailed information, see the AuthSub documentation.
When a user first visits your application, they have not yet been authenticated. In this case, you need to display some information and a link directing the user to a Google page to authenticate your request for access to their portfolios.
The following query parameters are included in the AuthSubRequest URL:
http://finance.google.com/finance/feeds/ (URL-encoded, of course).The AuthSubRequest URL might look like this:
https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Ffinance.google.com%2Ffinance%2Ffeeds%2F&session=1&secure=0&next=http%3A%2F%2Fwww.example.com%2Fwelcome.html
The user follows the link to Google's site and authenticates to their Google Account.
After the user authenticates, the AuthSub system redirects them to the URL you specified in the next query parameter of the AuthSubRequest URL. The AuthSub system appends an authentication token to that URL, as the value of the token query parameter. For example:
http://www.example.com/welcome.html?token=yourAuthToken
This token value represents a single-use AuthSub token. In this example, since session=1 was specified, this token can be exchanged for an AuthSub session token by calling the AuthSubSessionToken service with the single-use token in an Authorization header, as follows:
GET /accounts/AuthSubSessionToken HTTP/1.1 Content-Type: application/x-www-form-urlencoded Authorization: AuthSub token="yourAuthToken" User-Agent: Java/1.5.0_06 Host: www.google.com Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
The AuthSubSessionToken service response includes a Token header that contains the session token and an Expiration header that indicates how long the token will remain valid.
Your application can then use the session token value in the Authorization header of subsequent interactions with Finance.
Here's an example of an HTTP request, containing a non-secure token, that you might send to Finance:
GET http://finance.google.com/finance/feeds/default/portfolios HTTP/1.1 Content-Type: application/x-www-form-urlencoded Authorization: AuthSub token="yourSessionToken" User-Agent: Java/1.5.0_06 Host: finance.google.com Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Use ClientLogin authentication if your client is a standalone, single-user "installed" client (such as a desktop application). To request an authentication token using the ClientLogin mechanism, send a POST request to the following URL:
https://www.google.com/accounts/ClientLogin
The POST body should contain a set of query parameters that look like parameters passed by an HTML form, using the application/x-www-form-urlencoded content type. These parameters are:
finance. (For other service names, see the service name list.)For more information about the parameters, see the Authentication for Installed Applications document.
If the authentication request fails, then the server returns an HTTP 403 Forbidden status code.
If it succeeds, then the server returns an HTTP 200 OK status code, plus three long alphanumeric codes in the body of the response: SID, LSID, and Auth. The Auth value is the authorization token that you'll send to Finance with each of your subsequent requests, so keep a copy of that value. You can ignore the SID and LSID values.
Since all requests to private feeds require authentication, you have to set the Authorization header in all subsequent interactions with Finance, using the following format:
Authorization: GoogleLogin auth=yourAuthToken
Where yourAuthToken is the Auth string returned by the ClientLogin request.
For more information about ClientLogin authentication, including sample requests and responses, see the Authentication for Installed Applications documentation.
Note: Use the same token for all requests in a given session; don't acquire a new token for each Finance request.
A portfolio is a collection of positions that the user holds in various securities, plus metadata.
A portfolio feed lists all of the user's portfolios. Each portfolio entry contains the portfolio's title along with data such as currency and total market value. Each portfolio entry also contains a link to the portfolio's position feed.
First, create an XML representation of the entry to publish. This XML needs to be in the form of an Atom <entry> element, which might look like this:
<entry> <title type='text'>A New Portfolio</title> <gf:portfolioData currencyCode='USD'/> </entry>
When you're creating a portfolio entry, specify only the portfolio title and the currency code. To add a position to a portfolio, create transactions for that position.
To publish this entry, send it to the portfolio feed's post URL as follows. First, place your Atom <entry> element in the body of a new POST request, using the application/atom+xml content type. Then send the new portfolio to the following URL:
http://finance.google.com/finance/feeds/default/portfolios
The default in the URL tells Google Finance to use the account of the currently authenticated user.
Finance creates a portfolio using the entry you sent, then returns an HTTP 201 CREATED status code, along with a copy of the new portfolio in the form of an <entry> element. The entry returned is the same one you sent, but it also contains various elements added by the server, such as an <id> element.
If your request fails for some reason, Finance may return a different status code. For information about the status codes, see the Google Data API protocol reference document.
To retrieve the user's portfolios, send an authenticated HTTP GET request to the user's portfolio feed URL. Google Finance then returns a feed containing all of the user's portfolio entries. For example, to get a list of portfolios for the currently authenticated user, send the following HTTP request to Finance:
GET http://finance.google.com/finance/feeds/default/portfolios
Finance then returns an HTTP 200 OK status code and a standard Atom 1.0 feed containing all of the user's portfolios.
The following is an example of a portfolio feed with only one entry.
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gf='http://schemas.google.com/finance/2007'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios</id>
<updated>2008-06-10T01:29:50.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#portfolio'/>
<title type='text'>Portfolio Feed</title>
<link rel='alternate' type='text/html'
href='http://finance.google.com/finance/portfolio?action=view'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<entry>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1</id>
<updated>2008-06-10T01:29:49.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#portfolio'/>
<title type='text'>Portfolio 1</title>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<link rel='edit' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<gd:feedLink
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions'/>
<gf:portfolioData currencyCode='USD' gainPercentage='0.0'
return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0'
return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0'/>
</entry>
</feed>
For information about what each of those elements means, see the Finance feed elements reference guide, the Google Data APIs Protocol Reference document, or the Atom 1.0 specification.
If your request fails for some reason, Finance may return a different status code. More information about HTTP status codes is also available in the Google Data APIs Protocol Reference document.
In each entry, the <updated> element's value is set to the timestamp when it was last edited, unless the query includes a query parameter; for more information about that exception, see Retrieving portfolios with additional data. The <updated> element in a feed that contains multiple entries is set to the most recent updated value for any of the entries.
Note: The entries in a portfolio feed are ordered by portfolio ID.
To retrieve a specific portfolio, append the portfolio's ID to the feed URL. For example, to retrieve the authenticated user's portfolio that has an ID of 1, send an HTTP GET request to the following URL:
http://finance.google.com/finance/feeds/default/portfolios/1
Google Finance responds with an HTTP 200 OK status code and a standard Atom 1.0 entry containing the specified portfolio entry in the same format as in the portfolio feed above.
The Finance Data API lets you request that additional material be included in returned feeds, such as requesting that the entries in a feed include performance data.
For example, to request a Finance portfolio feed with performance data and financial returns included, send an HTTP request to the portfolio's feed URL, with the returns=true parameter appended:
GET http://finance.google.com/finance/feeds/default/portfolios?returns=true
Google Finance returns an HTTP 200 OK status code and a feed containing all of the user's portfolio entries, as before, except that each entry includes data about that portfolio's returns, and the <updated> element for each entry and for the feed itself is set to the current time to indicate that the data contains current performance statistics.
The feed looks something like this:
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gf='http://schemas.google.com/finance/2007'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios</id>
<updated>2008-06-10T01:29:50.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#portfolio'/>
<title type='text'>Portfolio Feed</title>
<link rel='alternate' type='text/html'
href='http://finance.google.com/finance/portfolio?action=view'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios'/>
<entry>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1</id>
<updated>2008-06-10T01:29:49.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#portfolio'/>
<title type='text'>Portfolio 1</title>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<link rel='edit' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<gd:feedLink
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions'/>
<gf:portfolioData currencyCode='USD' gainPercentage='1.894857932'
return1w='-0.07711772724' return1y='0.3969560994'
return3m='0.197468495' return3y='1.228892613'
return4w='-0.003721445821' return5y='1.894857932'
returnOverall='1.894857932' returnYTD='0.4172674026'>
<gf:costBasis>
<gd:money amount='52158.0' currencyCode='USD'/>
</gf:costBasis>
<gf:daysGain>
<gd:money amount='7321.0' currencyCode='USD'/>
</gf:daysGain>
<gf:gain>
<gd:money amount='98832.0' currencyCode='USD'/>
</gf:gain>
<gf:marketValue>
<gd:money amount='150990.0' currencyCode='USD'/>
</gf:marketValue>
</gf:portfolioData>
</entry>
</feed>
For more information about query parameters, see the Finance Data API Reference Guide and the Google Data APIs Reference Guide.
These query parameters apply only to requests for feeds, not to requests for individual entries.
To update an existing entry, first you retrieve the entry you want to update, then you modify it, and then you send a PUT request, with the updated entry in the message body, to the entry's edit URL. Use the application/atom+xml content type. Be sure that the <id> value in the entry you PUT exactly matches the <id> of the existing entry.
The updated portfolio title and the edit URL are highlighted in the following entry:
<entry>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1</id>
<updated>2008-06-10T01:29:49.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#portfolio'/>
<title type='text'>Updated Portfolio Title</title>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<link rel='edit' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1'/>
<gd:feedLink
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions'/>
<gf:portfolioData currencyCode='USD' gainPercentage='0.0'
return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0'
return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0'/>
</entry>
IMPORTANT: To ensure forward compatibility, be sure that when you PUT an updated entry, you preserve all the XML that was present when you retrieved the entry from Finance. Otherwise, when we implement new stuff and include <new-awesome-feature> elements in the feed, your client won't return them and your users will miss out. The Google Data API client libraries all handle this correctly, so if you're using one of the libraries you're all set.
Troubleshooting Tip: Some firewalls block HTTP PUT messages. To get around this, you can include a X-HTTP-Method-Override: PUT header in a POST request. For details, see the Google Data API protocol basics document.
To delete a portfolio, send a DELETE request to the portfolio's edit URL. This is the same URL used to update portfolios. Deleting a portfolio also deletes all of the positions and transactions for that portfolio.
Troubleshooting Tip: Some firewalls block HTTP DELETE messages. To get around this, you can include a X-HTTP-Method-Override: DELETE header in a POST request. For details, see the Google Data API protocol basics document.
Note: To update existing portfolios, see Updating portfolios; don't update by deleting portfolios and then re-adding them.
A position is a collection of information about a security that the user holds.
A position feed lists all of the positions in a particular portfolio. Each position entry contains the ticker exchange and symbol for a stock, mutual fund, or other security, along with the number of units of that security that the user holds. Each position entry also contains a link to the position's transaction feed.
You can't directly create, update, or delete position entries; positions are derived from transactions. For example, a GOOG position is derived from the buy and sell transactions for GOOG. Google Finance updates the position every time it receives a transaction for that position.
Therefore, to create or modify a position, send appropriate transactions on that position. To delete a position, delete all of its transactions.
Selling all of the shares in a position does not delete the position; it just sets the position's value to zero.
To retrieve a portfolio's positions, send an authenticated HTTP GET request to the position feed URL. Google Finance then returns a feed containing all of the given portfolio's position entries. For example, to get a list of positions for a portfolio with ID portfolioID, send the following HTTP request to Finance (with the appropriate value in place of portfolioID, of course):
GET http://finance.google.com/finance/feeds/default/portfolios/portfolioID/positions
Finance then returns an HTTP 200 OK status code and a standard Atom 1.0 feed containing all the positions in the portfolio.
The following is an example of a position feed with only one entry.
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gf='http://schemas.google.com/finance/2007'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1/positions</id>
<updated>2008-06-10T02:45:47.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#position'/>
<title type='text'>Portfolio 1</title>
<link rel='alternate' type='text/html'
href='http://finance.google.com/finance/portfolio?action=view&pid=1'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions'/>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions'/>
<entry>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1/positions/NASDAQ%3AGOOG</id>
<updated>2008-06-10T02:45:38.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#position'/>
<title type='text'>Google Inc.</title>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG'/>
<gd:feedLink
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ:GOOG/transactions'/>
<gf:positionData gainPercentage='0.0' return1w='0.0' return1y='0.0'
return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0'
returnOverall='0.0' returnYTD='0.0' shares='100.0'/>
<gf:symbol exchange='NASDAQ' fullName='Google Inc.'
symbol='GOOG'/>
</entry>
</feed>
For information about what each of those elements means, see the Finance feed elements reference guide, the Google Data APIs Protocol Reference document, or the Atom 1.0 specification.
If your request fails for some reason, Finance may return a different status code. More information about HTTP status codes is also available in the Google Data APIs Protocol Reference document.
Note: The entries in a position feed are ordered by ticker ID.
To retrieve a specific position, append the position's ticker symbol to the feed URL. For example, to retrieve the authenticated user's position for GOOG, send an HTTP GET request to the following URL:
http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG
Google Finance responds with an HTTP 200 OK status code and a standard Atom 1.0 entry containing the specified position entry in the same format as in the position feed above.
A transaction is a collection of information about an instance of buying or selling a particular security.
A transaction feed lists all of the transactions that have been recorded for a particular position. Each transaction entry contains a transaction type (such as buy or sell), a number of units, the price, and so on.
First, create an XML representation of the entry to publish. This XML needs to be in the form of an Atom <entry> element, which might look like this:
<entry>
<gf:transactionData date='2007-09-26T00:00:00.000' shares='1000.0' type='Buy'>
<gf:commission>
<gd:money amount='0.0' currencyCode='USD'/>
</gf:commission>
<gf:price>
<gd:money amount='568.2' currencyCode='USD'/>
</gf:price>
</gf:transactionData>
</entry>
When you're creating a transaction entry, the only element you have to specify is the transaction type (such as Buy or Sell); the other data is optional, as some positions might simply be "watchlist" entries where a purchase price and share count are not relevant.
Note: If you specify a price or commission when creating or updating a transaction, Google Finance ignores the currency code you specify; instead, it uses the default currency code for the security (which is determined by the security's exchange).
To publish this entry, send it to the position's post URL as follows. First, place your Atom <entry> element in the body of a new POST request, using the application/atom+xml content type. Then find the position's post URL in the transaction feed by locating the <link> element where the rel attribute ends with #post. The position's post URL is given as the href attribute of this element, which is in this format:
http://finance.google.com/finance/feeds/default/portfolios/portfolioID/positions/TICKERID/transactions
Note: In the case of a new position (such as a new stock added to a user's portfolio without using transactions), there is no transaction feed yet. To construct the post URL for such a position, insert the portfolio ID and ticker symbol into the above URL format.
Finance creates a transaction using the entry you sent, then returns an HTTP 201 CREATED status code, along with a copy of the new transaction in the form of an <entry> element. The entry returned is the same one you sent, but it also contains various elements added by the server, such as an <id> element.
If your request fails for some reason, Finance may return a different status code. For information about the status codes, see the Google Data API protocol reference document.
To retrieve the position's transactions, send an authenticated HTTP GET request to the position's transaction feed URL. Google Finance then returns a feed containing all of the given position's transaction entries. For example, to get a list of transactions for a position with ticker symbol TICKERID, in portfolio portfolioID, send the following HTTP request to Finance (with the appropriate value in place of the placeholders, of course):
GET http://finance.google.com/finance/feeds/default/portfolios/portfolioID/positions/TICKERID/transactions
Finance then returns an HTTP 200 OK status code and a standard Atom 1.0 feed containing all of the position's transactions.
The following is an example of a transaction feed with only one entry.
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gf='http://schemas.google.com/finance/2007'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1/positions/NASDAQ%3AGOOG/transactions</id>
<updated>2008-06-10T02:54:33.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#transaction'/>
<title type='text'>Google Inc.</title>
<link rel='alternate' type='text/html'
href='http://finance.google.com/finance/portfolio?action=viewt&pid=1'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions'/>
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions'/>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions'/>
<entry>
<id>http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1/positions/NASDAQ%3AGOOG/transactions/1</id>
<updated>2008-06-10T02:54:32.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/finance/2007#transaction'/>
<title type='text'>1</title>
<link rel='self' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions/1'/>
<link rel='edit' type='application/atom+xml'
href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions/1'/>
<gf:transactionData date='2004-09-01T00:00:00.000' notes='None'
shares='100.0' type='Buy'>
<gf:commission>
<gd:money amount='25.0' currencyCode='USD'/>
</gf:commission>
<gf:price>
<gd:money amount='101.1' currencyCode='USD'/>
</gf:price>
</gf:transactionData>
</entry>
</feed>
For information about what each of those elements means, see the Finance feed elements reference guide, the Google Data APIs Protocol Reference document, or the Atom 1.0 specification.
If your request fails for some reason, Finance may return a different status code. More information about HTTP status codes is also available in the Google Data APIs Protocol Reference document.
Note: The entries in a transaction feed are ordered by transaction ID.
To retrieve a specific transaction, append the transaction's ID to the feed URL. For example, to retrieve the authenticated user's transaction that has an ID of 1, from the GOOG position in portfolio 1, send an HTTP GET request to the following URL:
http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions/1
Google Finance responds with an HTTP 200 OK status code and a standard Atom 1.0 entry containing the specified transaction entry in the same format as in the transaction feed above.
To update an existing entry, first you retrieve the entry you want to update, then you modify it, and then you send a PUT request, with the updated entry in the message body, to the entry's edit URL. Use the application/atom+xml content type. Be sure that the <id> value in the entry you PUT exactly matches the <id> of the existing entry.
Updating transactions is rare; under normal circumstances, the only time you'll do this is when there's an error in an existing transaction.
The updated transaction date and the edit URL are highlighted in the following entry:
<entry>
<id>
http://finance.google.com/finance/feeds/liz@gmail.com/portfolios/1/positions/NASDAQ%3AGOOG/transactions/2
</id>
<updated>2008-06-10T02:54:33.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#transaction'/>
<title type='text'>2</title>
<link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions/2'/>
<link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ%3AGOOG/transactions/2'/>
<gf:transactionData date='2007-09-27T00:00:00.000'
shares='1000.0' type='Sell'>
<gf:commission>
<gd:money amount='25.0' currencyCode='USD'/>
</gf:commission>
<gf:price>
<gd:money amount='201.1' currencyCode='USD'/>
</gf:price>
</gf:transactionData>
</entry>
IMPORTANT: To ensure forward compatibility, be sure that when you PUT an updated entry, you preserve all the XML that was present when you retrieved the entry from Finance. Otherwise, when we implement new stuff and include <new-awesome-feature> elements in the feed, your client won't return them and your users will miss out. The Google Data API client libraries all handle this correctly, so if you're using one of the libraries you're all set.
Troubleshooting Tip: Some firewalls block HTTP PUT messages. To get around this, you can include a X-HTTP-Method-Override: PUT header in a POST request. For details, see the Google Data API protocol basics document.
To delete a transaction, send a DELETE request to the transaction's edit URL. This is the same URL used to update transactions.
If you delete all of the transactions in a position, the position is deleted as well.
Troubleshooting Tip: Some firewalls block HTTP DELETE messages. To get around this, you can include a X-HTTP-Method-Override: DELETE header in a POST request. For details, see the Google Data API protocol basics document.
Note: To update existing transactions, see Updating transactions; don't update by deleting transactions and then re-adding them.