Local Platform
Object Store
Introduction
The Object Store is an organization-specific key-value storage location to save and retrieve data. Similar to a dictionary or hash table, a key-value store is a storage system that saves and retrieves objects by using keys. A key is a unique string that is associated with a single record in the key-value store and a value is an object being stored. Some common use cases of the Object Store include the following:
- Transporting data between the backtesting environment and the research environment.
- Training machine learning models in the research environment before deploying them to live trading.
The Object Store is shared across the entire organization. Using the same key, you can access data across all projects in an organization.
Supported Types
The Object Store has helper methods to store strings, JSON objects, XML objects, and bytes.
The Object Store has helper methods to store strings and bytes.
ObjectStore.Save(stringKey, stringValue); ObjectStore.SaveJson<T>(jsonKey, jsonValue); ObjectStore.SaveXml<T>(xmlKey, xmlValue); ObjectStore.SaveBytes(bytesKey, bytesValue);
self.object_store.save(string_key, string_value) self.object_store.save_bytes(bytes_key, bytes_value)
To store an object that is in a different format, you need to encode it to one of the supported data types. For instance, if you train a machine learning model and it is in binary format, encode it into base 64 before saving it.
The Object Store also has helper methods to retrieve the stored objects.
var stringValue = ObjectStore.Read(stringKey); var jsonValue = ObjectStore.SaveJson<T>(jsonKey); var xmlValue = ObjectStore.SaveXml<T>(xmlKey); var bytesValue = ObjectStore.SaveBytes(bytesKey);
string_value = self.object_store.read(string_key) bytes_value = self.object_store.read_bytes(bytes_key)
For complete examples of using the Object Store, see Object Store.
Storage Location
The Object Store is organization-specific. When you save data in the Object Store, it creates a new file in the <organizationWorkspace> / storage / <projectName> directory and names the file with the key you provide. To access the storage data of project A from project B, include the project id of project A to the key.
Delete Storage
To free up storage space, delete the key-value pairs in the Object Store by calling the Delete
delete
method with a key.
ObjectStore.Delete(key);
self.object_store.delete(key)
Alternatively, delete the files in <organizationWorkspace> / <projectName> / storage directory.