Datastore¶
Endpoints
POST /datastores
POST /datastores/filter
GET /datastores
GET /datastores/:id
PUT /datastores/:id
DELETE /datastores/:id
DELETE /datastores?ids=:id1,:id2
Datastores are fully integrated repositories to manage and persist data. They can record data calculated by Everysk’s servers, proprietary data from the client or both. The most common usage is the storage of securities as rows and related properties as columns, but there are no constraints on the usage. They enable powerful data explorations and trend analysis to be performed.
The datastore object¶
What a datastore object looks like?
{
"updated": 1625688283,
"name": "My First Datastore",
"tags": ["first", "datastore", "20210622"],
"created": 1625688283,
"workspace": "main",
"date": "20210622",
"data": [
["MIC", "SYMBOL", "LATEST SECURITY DATE", "LATEST SECURITY VALUE"],
["XKRX", "003550:XKRX", "20210429", 126500.0]
],
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"description": "This is my first datastore"
}
| Property | Description |
|---|---|
id string |
Unique identifier (UID) for the datastore. |
created float |
Time at which the object was created. Measured in seconds since the Unix epoch. |
updated float |
Time at which the object was updated. Measured in seconds since the Unix epoch. |
name string |
The datastore's name. Up to 200 characters. |
description string |
An arbitrary string attached to the datastore. Up to 500 characters. |
tags array |
A list of strings. Up to 32 tags. Use them to find the datastore in a list. |
version string |
Indicates the datastore's current version. |
date string |
Datastore date in the format: YYYYMMDD. The Datastore Date is important because it instructs the API to use the market conditions and security prices prevailing on that date. In order to run the datastore using the market conditions prevailing today, use null. |
data array |
The content that will be stored inside the Datastore. |
workspace string |
The workspace where the datastore was generated. |
link_uid string |
An identifier you choose to link the datastore to related entities. Several entities can share it. |
level string |
A free text of up to 32 characters. |
date_time string |
The datastore date with a time. |
Create a datastore¶
To create a new datastore, run the following:
curl https://api.everysk.com/v2/datastores \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"name": "My First Datastore",
"tags": [
"first",
"datastore",
"20210622"
],
"description": "This is my first datastore",
"date": "20210622",
"data": [
[
"MIC",
"SYMBOL",
"LATEST SECURITY DATE",
"LATEST SECURITY VALUE"
],
[
"XKRX",
"003550:XKRX",
"20210429",
126500.0
]
],
"workspace": "main"
}' \
-X POST
The above call returns the following JSON object:
{
"datastore": {
"updated": 1625688283,
"name": "My First Datastore",
"tags": ["first", "datastore", "20210622"],
"created": 1625688283,
"workspace": "main",
"date": "20210622",
"data": [
["MIC", "SYMBOL", "LATEST SECURITY DATE", "LATEST SECURITY VALUE"],
["XKRX", "003550:XKRX", "20210429", 126500.0]
],
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"description": "This is my first datastore"
}
}
Creates and then returns the new datastore.
HTTP Request
POST /datastores
HTTP Parameters
| Parameter | Description |
|---|---|
name string |
REQUIRED A string to identify a datastore besides the datastore's id. Up to 200 characters. |
description string |
optional, default is "" Provides detailed information about your datastore. Up to 500 characters. |
tags array |
optional, default is [] A list of strings. Up to 32 tags. |
date string |
optional, default is null (today) Datastore date in the format: YYYYMMDD. The Datastore Date is important because it instructs the API to use the market conditions and security prices prevailing on that date. Therefore, historical datastores will be calculated without look ahead. In order to run the datastore using market conditions prevailing today, use null. |
data array |
REQUIRED The content that will be stored inside the Datastore. |
with_data boolean |
optional, default is True When True, the data inside the generated datastore will be returned in the api response. |
workspace string |
optional, default is main The workspace where the API creates the datastore. Send it in the JSON body. |
link_uid string |
optional, default is null An identifier you choose to link the datastore to related entities. Several entities can share it. |
List all datastores¶
To list all datastores, run the following:
The above call returns the following JSON object:
{
"datastores": [
{
"updated": 1625507085,
"name": "My First Datastore",
"tags": [
"first",
"datastore",
"20210622"
],
"created": 1625507085,
"workspace": "main",
"date": "20210622",
"id": "dats_xSYqUnLuQue8WwE9nEfgg0TVL",
"description": "This is my first datastore"
},
...
],
"next_page_token": null
}
Returns a list of datastores you’ve previously created. The list shows the most recently updated datastore first. A name search returns the datastores whose name starts with the text, case-insensitive, sorted A to Z. The list leaves out data unless you send with_data=true.
HTTP Request
GET /datastores
HTTP Parameters
| Parameter | Description |
|---|---|
query string |
optional, default is null Request a list of datastores filtering it by name or tag. When using a tag to perform a query, each term must include a hashtag prefix. (e.g: query="#april #sample") See Filter with query. |
workspace string |
optional, default is main The workspace to list. |
page_size integer |
optional, default is 10 Set the number of objects that will be listed per page, between 1 and 10000. |
page_token string |
optional, default is null The next_page_token from the previous response. See the pagination guide. |
with_data boolean |
optional, default is False When True, each datastore in the list includes its data. |
start, end, date_time, period_field string |
optional Filter the list by a period. See Filter by period. |
Filter datastores¶
To filter datastores, run the following:
The above call returns the following JSON object:
{
"datastores": [
{
"updated": 1625507085,
"name": "My First Datastore",
"tags": ["first", "datastore", "20210622"],
"created": 1625507085,
"workspace": "main",
"date": "20210622",
"id": "dats_xSYqUnLuQue8WwE9nEfgg0TVL",
"description": "This is my first datastore"
},
...
]
}
Returns the datastores of one workspace that match every filter you send, up to limit. The response has no next_page_token.
HTTP Request
POST /datastores/filter
HTTP Parameters
| Parameter | Description |
|---|---|
workspace string |
REQUIRED The workspace to search. Without it, the API returns 400. |
tags array |
optional, default is [] A list of strings. Returns the datastores that have every one of these tags. |
link_uid string |
optional, default is null Returns the datastores with this link_uid. |
start string |
optional, default is null Returns the datastores from this day onward, in the format YYYYMMDD. |
end string |
optional, default is null Returns the datastores up to this day, in the format YYYYMMDD. |
date_time string |
optional, default is null Returns the datastores of one day, in the format YYYYMMDD. It replaces start and end. |
period_field string |
optional, default is date The property that start, end and date_time filter: date or updated_on. |
limit integer |
optional, default is 1 The maximum number of datastores to return, between 1 and 10000. |
with_data boolean |
optional, default is False When True, each item includes its data. |
Retrieve a datastore¶
To retrieve a datastore, run the following:
The above call returns the following JSON object:
{
"datastore": {
"updated": 1625688283,
"name": "My First Datastore",
"tags": ["first", "datastore", "20210622"],
"created": 1625688283,
"workspace": "main",
"date": "20210622",
"data": [
["MIC", "SYMBOL", "LATEST SECURITY DATE", "LATEST SECURITY VALUE"],
["XKRX", "003550:XKRX", "20210429", 126500.0]
],
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"description": "This is my first datastore"
}
}
Retrieves the details of an existing datastore by supplying the datastore's id.
HTTP Request
GET /datastores/:id
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED A unique identifier (UID) for a datastore. A datastore's id will always look like this: dats_52KiJy2yFvosTtWM5aUJcOs1R. |
workspace string |
optional The workspace of the object. If you send it and the object is in another workspace, the API returns 403. |
Update a datastore¶
To update a datastore, run the following:
curl https://api.everysk.com/v2/datastores/dats_52KiJy2yFvosTtWM5aUJcOs1R \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"name": "My New Datastore Name",
"description": "My new datastore description",
"data": [
[
"MIC",
"SYMBOL",
"LATEST SECURITY DATE",
"LATEST SECURITY VALUE"
],
[
"XLIF",
"CAM:XLIF",
"20190211",
17.504
]
]
}' \
-X PUT
The above call returns the following JSON object:
{
"datastore": {
"updated": 1625690528,
"name": "My New Datastore Name",
"tags": ["first", "datastore", "20210622"],
"created": 1625688283,
"workspace": "main",
"date": "20210622",
"data": [
["MIC", "SYMBOL", "LATEST SECURITY DATE", "LATEST SECURITY VALUE"],
["XLIF", "CAM:XLIF", "20190211", 17.504]
],
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"description": "My new datastore description"
}
}
Updates a datastore and then returns the updated datastore. Only the fields you send change. The other fields keep their current values.
HTTP Request
PUT /datastores/:id
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED A unique identifier (UID) for a datastore. |
name string |
optional A string to identify a datastore besides the datastore's id. Up to 200 characters. |
description string |
optional Use this field to provide detailed information about your datastore. Up to 500 characters. |
tags array |
optional A list of strings. Up to 32 tags. Replaces the current tags. |
date string |
optional Datastore date in the format: YYYYMMDD. |
data array |
optional The content that will be stored inside the Datastore. |
workspace string |
optional Moves the object to this workspace. Leave it out to keep the current workspace. |
link_uid string |
optional An identifier you choose to link the datastore to related entities. |
with_data boolean |
optional, default is True When True, the response includes the data of the datastore. |
Delete a datastore¶
To delete a datastore, run the following:
The above call returns the following JSON object:
{
"datastore": {
"deleted": true,
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"name": "My First Datastore"
}
}
Permanently deletes a datastore. It cannot be undone. Returns an object with the datastore's id and an attribute specifying whether the datastore was successfully deleted or not.
HTTP Request
DELETE /datastores/:id
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED The datastore's unique identifier. |
workspace string |
optional The workspace of the object. If you send it and the object is in another workspace, the API returns 403. |
Delete several datastores¶
To delete several datastores, run the following:
The above call returns the following JSON object:
{
"datastores": [
{
"id": "dats_52KiJy2yFvosTtWM5aUJcOs1R",
"name": "BATCH_DELETE",
"deleted": true
},
{
"id": "dats_xSYqUnLuQue8WwE9nEfgg0TVL",
"name": "BATCH_DELETE",
"deleted": true
}
]
}
Permanently deletes several datastores in one request. It cannot be undone. The response has one item for each id in ids. deleted is false for an id that the API could not delete. An id that does not exist also returns deleted: true. A bulk delete does not check workspace.
HTTP Request
DELETE /datastores?ids=:id1,:id2
HTTP Parameters
| Parameter | Description |
|---|---|
ids string |
REQUIRED The ids to delete, separated by commas. |