menu
Data

Persistence

DataGrids can be persisted to our APIs via our DataGrids service. This allows users to create a DataGrid and access it at a later time. Users can also share DataGrids with others so they can access your DataGrids without needing the code that created the DataGrid. This allows you to easily collaborate with your team to create grids. Persisting your DataGrids is also a necessary step to visualize DataGrids on our Marquee Markets platform.

Persist Your DataGrid

If you already have a DataGrid created in GS Quant, you can create, update, and share the grid.

Below are the methods used for persisting DataGrids:

MethodDescription
createCreates a new DataGrid whether or not the DataGrid has previously been persisted. Also useful for copying an existing datagrid to start a new one.
saveCreates or updates the DataGrid if it already exists. If you already have this DataGrid in a workspace the changes will be available on page refresh.
deleteDeletes the DataGrid if it has been persisted.

More can be found about these functions below with examples.

Create a Persisted DataGrid

The create method on a DataGrid will create a new DataGrid. The function returns the unique identifier of the newly created DataGrid. The DataGrid can from now on be referenced from this id.

datagrid_id = datagrid.create()
print(datagrid_id)

Output:

DGAMPVEIQVPFKW4S2Q

Update a Persisted DataGrid

You may not want to always want to create a new DataGrid everytime you wish to update a grid. In this case, users should use the save method. This also allows you to improve and add functionaltiy to your DataGrid over time.

datagrid_id = datagrid.save()
print(datagrid_id)

Output:

DGAMPVEIQVPFKW4S2Q

The create method will update the DataGrid if it has already been created and persisted. If the grid has not been persisted before, it will be created automatically. Users can see if a datagrid has already been persisted if it has an id. Users can check if the grid has an id by doing:

datagrid_id = datagrid.get_id()

If the DataGrid id is not None, then the DataGrid has already been persisted.

Share a Persisted DataGrid

Sharing a DataGrid can be done by editting the entitlements of a DataGrid.

This can be accomplished at the instantiation of the DataGrid object or updated anytime afterwards. Here's an example of both cases (we assume you have a rows and columns variables, see the overview to learn how to create these):

from gs_quant.api.gs.users import GsUsersApi

my_guid = GsUsersApi.get_my_guid()

entitlements = {
  'view': [my_guid],
  'edit': [my_guid],
  'admin': [my_guid]
}

datagrid = DataGrid('My DataGrid', rows=rows, columns=columns, entitlements=entitlements)
datagrid.save() # Persist/Create your datagrid with only you having access

# Add your friends to the view entitlements
emails = ['your@email.com', 'friends@email.com', 'emails@email.com', 'here@email.com']
my_friends_guids = GsUsersApi.get_guids_from_ids(GsUsersApi.get_user_ids_by_email(emails))
datagrid.entitlements['view'].extend(my_friends_guids)
datagrid.save() # Update your datagrid with your friends whom now have view access
info

Note

By default, every DataGrid you create is just entitled to yourself for each entitlement type unless you update or pass in entitlements.

Entitlements

Let us break down what each of these entitlements entail.

Entitlement TypeDescription
viewEntitled users can access the DataGrid.
editEntitled users can edit everything on the DataGrid except entitlements.
adminEntitled users can edit everything on the DataGrid including entitlements.

Delete a Persisted DataGrid

In some cases, users may want to delete a persisted DataGrid. This can be done by:

datagrid_id = datagrid.delete()

The delete method will remove the DataGrid from our APIs, hence all users who had access also cannot access it. Be careful when deleting DataGrids if others are using them!

Get Your Persisted DataGrids

Utilizing the GsDataGridApi class, users can get their all the DataGrids that they are entitled to view.

Get Many DataGrids

from gs_quant.api.gs.datagrid import GsDataGridApi

datagrids = GsDataGridApi.get_datagrids()
datagrid = datagrid[0]

# Then you can calculate your grids
datagrid.initialze(), datagrid.poll()
datagrid.to_frame()

By default, the method gets the first 10 DataGrids ordered by recently updated grids, but this limit can be increased by passing the limit argument. Users can also get just the DataGrids that they have created.

Get Your Own DataGrids

Users can get just the DataGrids they have created.

from gs_quant.api.gs.datagrid import GsDataGridApi

datagrids = GsDataGridApi.get_my_datagrids()

Get a Specific DataGrid

Users can get a single DataGrid by using the DataGrid id of the grid you want.

from gs_quant.api.gs.datagrid import GsDataGridApi

datagrid = GsDataGridApi.get_datagrid('DGAMPVEIQVPFKW4S2Q')

help

Questions?

Please contact us at gs-marquee-markets@gs.com with any questions or feedback.


Related Content


This site is for informational purposes only and does not constitute an offer to sell, or the solicitation of an offer to buy, any security. The Goldman Sachs Marquee® platform is for institutional and professional clients only. Some of the services and products described on this site may not be available in certain jurisdictions or to certain types of client. Please contact your Goldman Sachs sales representative with any questions. Nothing on this site constitutes an offer, or an invitation to make an offer from Goldman Sachs to purchase or sell a product. This site is given for purely indicative purposes and does not create any contractual relationship between you and Goldman Sachs. Any market information contained on the site (including but not limited to pricing levels) is based on data available to Goldman Sachs at a given moment and may change from time to time. There is no representation that any transaction can or could have been effected on such terms or at such prices. Please see https://www.goldmansachs.com/disclaimer/sec-div-disclaimers-for-electronic-comms.html for additional information. © 2023 Goldman Sachs. All rights reserved.
Transaction Banking services are offered by Goldman Sachs Bank USA (“GS Bank”). GS Bank is a New York State chartered bank, a member of the Federal Reserve System and a Member FDIC. © 2023 Goldman Sachs. All rights reserved.
Not all products and functionality mentioned on this website are currently available through our API platform.
All loans and deposit products are provided by Goldman Sachs Bank USA, Salt Lake City Branch. Member FDIC.
Brokerage and investment advisory services offered by our investment products are provided by Goldman Sachs & Co. LLC (`‘GS&CO.`’), which is an SEC registered broker-dealer and investment adviser, and member FINRA/SIPC. Research our firm at FINRA's BrokerCheck. Custody and clearing services are provided by Apex Clearing Corporation, a registered broker-dealer and member FINRA/SIPC. Please consider your objectives before investing. A diversified portfolio does not ensure a profit or protect against a loss. Past performance does not guarantee future results. Investment outcomes and projections are forward-looking statements and hypothetical in nature. Neither this website nor any of its contents shall constitute an offer, solicitation, or advice to buy or sell securities in any jurisdictions where GS&Co. is not registered. Any information provided prior to opening an investment account is on the basis that it will not constitute investment advice and that GS&Co. is not a fiduciary to any person by reason of providing such information. For more information about our investment offerings, visit our Full Disclosures.
Investment products are: NOT FDIC INSURED ∙ NOT A DEPOSIT OR OTHER OBLIGATION OF, OR GUARANTEED BY, GOLDMAN SACHS BANK USA ∙ SUBJECT TO INVESTMENT RISKS, INCLUDING POSSIBLE LOSS OF THE PRINCIPAL AMOUNT INVESTED