### Install Exabel SDK Source: https://context7.com/exabel/python-sdk/llms.txt Install the core SDK or include optional extras for specific SQL data source support. ```bash # Basic installation pip install exabel # With Snowflake support pip install exabel[snowflake] # With multiple data sources pip install exabel[snowflake,bigquery,athena] ``` -------------------------------- ### Install Exabel SDK Source: https://github.com/exabel/python-sdk/blob/main/README.md Standard installation command for the Exabel Python SDK. ```shell pip install exabel ``` -------------------------------- ### Install Exabel SDK with SQL support Source: https://github.com/exabel/python-sdk/blob/main/README.md Installation commands for including specific SQL data source support via pip extras. ```shell # Install the Exabel Python SDK with Snowflake support: pip install exabel[snowflake] # Or install multiple data sources at the same time: pip install exabel[snowflake,bigquery,athena] ``` -------------------------------- ### Get Data Set Source: https://context7.com/exabel/python-sdk/llms.txt Retrieves a specific data set by its name, providing details about its signals and derived signals. ```python # Get a specific data set data_set = client.data_set_api.get_data_set(f"dataSets/{namespace}.my_signals") if data_set: print(f"Found: {data_set.display_name}") ``` -------------------------------- ### Get Relationships From Entity Source: https://context7.com/exabel/python-sdk/llms.txt Retrieves all relationships originating from a specified entity, filtered by relationship type. ```python # Get relationships from an entity result = client.relationship_api.get_relationships_from_entity( relationship_type="relationshipTypes/LOCATED_IN", from_entity="entityTypes/company/entities/F_000Q07-E" ) for rel in result.results: print(f"From {rel.from_entity} to {rel.to_entity}") ``` -------------------------------- ### Get Relationships To Entity Source: https://context7.com/exabel/python-sdk/llms.txt Retrieves all relationships pointing to a specified entity, filtered by relationship type. ```python # Get relationships to an entity result = client.relationship_api.get_relationships_to_entity( relationship_type="relationshipTypes/WEB_DOMAIN_OWNED_BY", to_entity="entityTypes/company/entities/F_000Q07-E" ) ``` -------------------------------- ### Initialize ExabelClient Source: https://context7.com/exabel/python-sdk/llms.txt Configure the main client using environment variables, explicit credentials, or custom connection settings. ```python from exabel import ExabelClient # Initialize using environment variables (EXABEL_API_KEY or EXABEL_ACCESS_TOKEN) client = ExabelClient() # Initialize with explicit API key client = ExabelClient(api_key="your-api-key-here") # Initialize with access token client = ExabelClient(access_token="your-access-token-here") # Full configuration with custom settings client = ExabelClient( api_key="your-api-key", client_name="MyApplication", timeout=900, # 15 minutes in seconds retries=3, data_api_host="data.api.exabel.com", analytics_api_host="analytics.api.exabel.com", management_api_host="management.api.exabel.com", export_api_host="export.api.exabel.com" ) # Access the customer's writeable namespace print(f"Namespace: {client.namespace}") ``` -------------------------------- ### Search Entities Source: https://context7.com/exabel/python-sdk/llms.txt Initialize the client to begin searching for entities. ```python from exabel import ExabelClient client = ExabelClient() ``` -------------------------------- ### Querying Signals with Custom DSL Source: https://context7.com/exabel/python-sdk/llms.txt Demonstrates how to query signals using custom DSL expressions and export the results. ```APIDOC ## Query with custom DSL expressions ### Description This section shows how to construct a query using the Signals API with custom DSL expressions for calculating indicators like moving averages and RSI, and then exporting the data. ### Method POST ### Endpoint `/api/export/run_query` (implied by `client.export_api.run_query`) ### Parameters #### Query Parameters - **start_time** (string) - Required - The start date for the query. #### Request Body - **columns** (list) - Required - A list of columns to retrieve, including time, signal name, and custom DSL expressions. - **name** (string) - Required - The name of the column. - **expression** (string) - Required - The DSL expression to evaluate. - **start_time** (string) - Required - The start date for the query. ### Request Example ```json { "columns": [ {"name": "time", "expression": "time"}, {"name": "name", "expression": "name"}, {"name": "price_ma_50", "expression": "sma(close, 50)"}, {"name": "rsi_14", "expression": "rsi(close, 14)"} ], "start_time": "2024-01-01" } ``` ### Response #### Success Response (200) - **data** (DataFrame) - The query results as a pandas DataFrame. ### Export to Different Formats #### Description This section demonstrates how to export query results to various file formats like CSV and Excel. #### Method POST #### Endpoint `/api/export/run_query_bytes` (implied by `client.export_api.run_query_bytes`) #### Parameters ##### Query Parameters - **file_format** (string) - Required - The desired file format (e.g., "csv", "excel", "json"). ##### Request Body - **query** (object) - Required - The query object defining the data to export. - **file_format** (string) - Required - The desired file format. #### Request Example (CSV) ```python query = Signals.query( columns=[ Signals.TIME, Signals.NAME, Column(name="price_ma_50", expression="sma(close, 50)"), Column(name="rsi_14", expression="rsi(close, 14)") ], start_time="2024-01-01" ) content = client.export_api.run_query_bytes(query, file_format="csv") with open("output.csv", "wb") as f: f.write(content) ``` #### Request Example (Excel) ```python query = Signals.query( columns=[ Signals.TIME, Signals.NAME, Column(name="price_ma_50", expression="sma(close, 50)"), Column(name="rsi_14", expression="rsi(close, 14)") ], start_time="2024-01-01" ) excel_content = client.export_api.run_query_bytes(query, file_format="excel") ``` #### Available formats csv, excel, pickle, json, feather, parquet ``` -------------------------------- ### Create Entities and Time Series Data Source: https://context7.com/exabel/python-sdk/llms.txt Demonstrates creating brand entities, relationship types, linking brands to companies, creating signals, and uploading time series data. Includes retrieval and verification of the uploaded data. This function requires an initialized ExabelClient. ```python import pandas as pd from dateutil import tz from exabel import ExabelClient from exabel.client.api.data_classes.entity import Entity from exabel.client.api.data_classes.relationship import Relationship from exabel.client.api.data_classes.relationship_type import RelationshipType from exabel.client.api.data_classes.signal import Signal def create_brand_data(): """Create brand entities with time series data linked to companies.""" client = ExabelClient() namespace = client.namespace # 1. Create a brand entity brand = client.entity_api.create_entity( Entity( name=f"entityTypes/brand/entities/{namespace}.acme_brand", display_name="Acme Brand", description="A sample brand for demonstration", properties={"category": "Consumer Goods", "founded": 2020} ), entity_type="entityTypes/brand" ) print(f"Created brand: {brand.display_name}") # 2. Create relationship type for brand ownership rel_type = client.relationship_api.create_relationship_type( RelationshipType( name=f"relationshipTypes/{namespace}.BRAND_OWNED_BY", description="Indicates company ownership of a brand" ) ) # 3. Link brand to a company company = client.entity_api.get_entity("entityTypes/company/entities/F_000Q07-E") if company: relationship = client.relationship_api.create_relationship( Relationship( relationship_type=rel_type.name, from_entity=brand.name, to_entity=company.name, description="Brand owned by company" ) ) print(f"Created relationship: {brand.display_name} -> {company.display_name}") # 4. Create a signal for brand metrics signal = client.signal_api.create_signal( Signal( name=f"signals/{namespace}.brand_awareness", display_name="Brand Awareness Score", description="Monthly brand awareness measurement (0-100)" ) ) print(f"Created signal: {signal.display_name}") # 5. Upload time series data ts_name = f"{brand.name}/{signal.name}" data = pd.Series( [65.2, 68.4, 72.1, 75.8, 78.3, 80.1], index=pd.DatetimeIndex([ "2024-01-01", "2024-02-01", "2024-03-01", "2024-04-01", "2024-05-01", "2024-06-01" ], tz=tz.tzutc()) ) client.time_series_api.create_time_series(ts_name, data) print(f"Created time series with {len(data)} data points") # 6. Retrieve and verify the data result = client.time_series_api.get_time_series(ts_name) print(f"Retrieved time series:\n{result}") return brand, signal, rel_type def cleanup_brand_data(brand, signal, rel_type): """Clean up the created resources.""" client = ExabelClient() # Delete in reverse order of dependencies client.entity_api.delete_entity(brand.name) print(f"Deleted entity: {brand.name}") client.signal_api.delete_signal(signal.name) print(f"Deleted signal: {signal.name}") client.relationship_api.delete_relationship_type(rel_type.name) print(f"Deleted relationship type: {rel_type.name}") if __name__ == "__main__": brand, signal, rel_type = create_brand_data() # cleanup_brand_data(brand, signal, rel_type) ``` -------------------------------- ### Create Data Set Source: https://context7.com/exabel/python-sdk/llms.txt Creates a new data set to group signals. Requires a name, display name, description, and a list of signals. ```python from exabel.client.api.data_classes.data_set import DataSet client = ExabelClient() namespace = client.namespace # Create a data set data_set = client.data_set_api.create_data_set( DataSet( name=f"dataSets/{namespace}.my_signals", display_name="My Custom Signals", description="Collection of proprietary signals", signals=[f"signals/{namespace}.signal1", f"signals/{namespace}.signal2"] ) ) ``` -------------------------------- ### Library API: Folders and Items Management Source: https://context7.com/exabel/python-sdk/llms.txt APIs for organizing and managing items within the Exabel library, including folders, signals, and models. ```APIDOC ## Library API ### Manage Library Folders and Items #### Description Organizes items in the library with folders and sharing capabilities. ### Method POST (for create, move, share, unshare) GET (for list, get, search) DELETE (for delete) ### Endpoints - `/api/library/folders` (POST, GET) - `/api/library/folders/{folder_name}` (GET, DELETE) - `/api/library/items` (GET) - `/api/library/items/search` (GET) - `/api/library/folders/{folder_name}/items` (POST for move) - `/api/library/folders/{folder_name}/share` (POST) - `/api/library/folders/{folder_name}/unshare` (POST) ### Create Folder #### Request Body - **name** (string) - Optional - Auto-generated if not provided. - **display_name** (string) - Required - The display name of the folder. - **description** (string) - Optional - A description for the folder. #### Response Example ```json { "name": "folders/123", "display_name": "My Analytics", "description": "Custom analytics and signals" } ``` ### List Folders #### Response Example ```json [ { "name": "folders/1", "display_name": "Default Folder", "description": "" }, { "name": "folders/123", "display_name": "My Analytics", "description": "Custom analytics and signals" } ] ``` ### Get Folder #### Parameters ##### Path Parameters - **folder_name** (string) - Required - The name of the folder to retrieve (e.g., "folders/123"). #### Response Example ```json { "name": "folders/123", "display_name": "My Analytics", "description": "Custom analytics and signals", "items": [ { "name": "derivedSignals/456", "display_name": "My Signal", "item_type": "DERIVED_SIGNAL" } ] } ``` ### List Items #### Query Parameters - **item_type** (string) - Optional - Filter items by type (e.g., "DERIVED_SIGNAL", "MODEL"). - **folder_name** (string) - Required - The name of the folder to list items from. #### Response Example ```json [ { "name": "derivedSignals/456", "display_name": "My Signal", "item_type": "DERIVED_SIGNAL" } ] ``` ### Search Items #### Query Parameters - **query** (string) - Required - The search query string. - **folder_item_type** (string) - Optional - Filter search results by item type. - **page_size** (integer) - Optional - The number of results per page. #### Response Example ```json { "results": [ { "name": "derivedSignals/789", "display_name": "Another Signal", "item_type": "DERIVED_SIGNAL" } ] } ``` ### Move Items #### Parameters ##### Request Body - **folder_name** (string) - Required - The destination folder name. - **items** (list of strings) - Required - A list of item names to move. ### Share Folder #### Parameters ##### Request Body - **folder_name** (string) - Required - The name of the folder to share. - **group_name** (string) - Required - The name of the group to share with. - **write** (boolean) - Optional - Whether to grant write access (defaults to false). ### Unshare Folder #### Parameters ##### Request Body - **folder_name** (string) - Required - The name of the folder to unshare. - **group_name** (string) - Required - The name of the group to unshare with. ### Delete Folder #### Parameters ##### Path Parameters - **folder_name** (string) - Required - The name of the folder to delete (must be empty). ``` -------------------------------- ### Execute SQL Queries Source: https://context7.com/exabel/python-sdk/llms.txt Run custom SQL-like queries or build queries programmatically to retrieve data. ```python import pandas as pd from exabel import ExabelClient from exabel.query.signals import Signals from exabel.query.column import Column client = ExabelClient() # Run a raw SQL query returning a DataFrame df = client.export_api.run_query(""" SELECT time, bloomberg_ticker, close, volume FROM signals WHERE bloomberg_ticker = 'AAPL US' AND time >= '2024-01-01' """) print(df.head()) # Build a query programmatically query = Signals.query( columns=[Signals.TIME, Signals.BLOOMBERG_TICKER, "close", "volume"], tag="tags/my_portfolio", start_time="2024-01-01", end_time="2024-06-30" ) df = client.export_api.run_query(query) ``` -------------------------------- ### Bulk Create Relationships Source: https://context7.com/exabel/python-sdk/llms.txt Efficiently creates multiple relationships in parallel. Supports an 'upsert' option to update existing relationships. ```python # Bulk create relationships relationships = [ Relationship( relationship_type=rel_type.name, from_entity=f"entityTypes/brand/entities/{namespace}.brand{i}", to_entity="entityTypes/company/entities/F_000Q07-E" ) for i in range(10) ] results = client.relationship_api.bulk_create_relationships( relationships, threads=4, upsert=True ) ``` -------------------------------- ### Manage Tags Source: https://context7.com/exabel/python-sdk/llms.txt Create, list, and modify tags to group and filter entities. ```python from exabel import ExabelClient from exabel.client.api.data_classes.tag import Tag client = ExabelClient() # Create a tag tag = client.tag_api.create_tag( Tag( name="", # Will be auto-generated display_name="Tech Giants", description="Large technology companies" ), folder="folders/123" # Optional folder ) print(f"Created tag: {tag.name}") # Add entities to a tag client.tag_api.add_entities( tag.name, [ "entityTypes/company/entities/F_000Q07-E", # Microsoft "entityTypes/company/entities/F_000BPT-E" # Apple ] ) # List entities in a tag result = client.tag_api.list_entities(tag.name) for entity_name in result.results: print(f"- {entity_name}") # List all tags for tag in client.tag_api.get_tag_iterator(): print(f"Tag: {tag.display_name}") # Remove entities from a tag client.tag_api.remove_entities(tag.name, ["entityTypes/company/entities/F_000Q07-E"]) # Delete a tag client.tag_api.delete_tag(tag.name) ``` -------------------------------- ### Query Signals with Custom DSL Source: https://context7.com/exabel/python-sdk/llms.txt Executes a signal query using custom expressions and exports the results to a DataFrame or file. ```python query = Signals.query( columns=[ Signals.TIME, Signals.NAME, Column(name="price_ma_50", expression="sma(close, 50)"), Column(name="rsi_14", expression="rsi(close, 14)") ], start_time="2024-01-01" ) df = client.export_api.run_query(query) ``` ```python content = client.export_api.run_query_bytes(query, file_format="csv") with open("output.csv", "wb") as f: f.write(content) ``` ```python excel_content = client.export_api.run_query_bytes(query, file_format="excel") ``` -------------------------------- ### Import Time Series with Control Source: https://context7.com/exabel/python-sdk/llms.txt Imports time series with granular control over parameters like parent, data replacement, and response status. ```python result = client.time_series_api.import_time_series( parent="signals/-", # Wildcard for any signal series=time_series_list[:10], allow_missing=True, status_in_response=True, replace_existing_time_series=False, replace_existing_data_points=False ) for item in result: print(f"Status: {item.status}, Resource: {item.resource.name}") ``` -------------------------------- ### Manage Derived Signals Source: https://context7.com/exabel/python-sdk/llms.txt Create and maintain computed signals using DSL expressions. ```python from exabel import ExabelClient from exabel.client.api.data_classes.derived_signal import DerivedSignal client = ExabelClient() # Create a derived signal derived_signal = client.derived_signal_api.create_derived_signal( DerivedSignal( name="", # Will be auto-generated label="Revenue Growth YoY", expression="pct_change(revenue, 252)" # DSL expression ), folder="folders/123" ) print(f"Created derived signal: {derived_signal.name}") # Get a derived signal signal = client.derived_signal_api.get_derived_signal("derivedSignals/123") if signal: print(f"Expression: {signal.expression}") # Update a derived signal derived_signal.expression = "pct_change(revenue, 63)" # Quarterly updated = client.derived_signal_api.update_derived_signal(derived_signal) # Delete a derived signal client.derived_signal_api.delete_derived_signal("derivedSignals/123") ``` -------------------------------- ### List Data Sets Source: https://context7.com/exabel/python-sdk/llms.txt Retrieves a list of all available data sets, including their display names and associated signals. ```python # List all data sets data_sets = client.data_set_api.list_data_sets() for ds in data_sets: print(f"Data Set: {ds.display_name}") print(f" Signals: {ds.signals}") print(f" Derived Signals: {ds.derived_signals}") ``` -------------------------------- ### Prediction Model API: Create Run Source: https://context7.com/exabel/python-sdk/llms.txt API for submitting prediction model results to the Exabel platform. ```APIDOC ## Prediction Model API ### Create Prediction Model Runs #### Description Submits prediction model results to the platform. ### Method POST ### Endpoint `/api/predictionModels/{model}/runs` (implied by `client.prediction_model_api.create_run`) ### Parameters #### Request Body - **run** (object) - Required - An object containing details of the prediction model run. - **name** (string) - Optional - Auto-generated if not provided. - **description** (string) - Optional - A description for the model run. - **model** (string) - Required - The name of the prediction model (e.g., "predictionModels/123"). ### Request Example ```python import pandas as pd from exabel import ExabelClient from exabel.client.api.data_classes.prediction_model_run import PredictionModelRun client = ExabelClient() run = client.prediction_model_api.create_run( run=PredictionModelRun( name="", # Will be auto-generated description="Q1 2024 model run" ), model="predictionModels/123" ) print(f"Created model run: {run.name}") ``` ### Response #### Success Response (200) - **name** (string) - The name of the created model run. - **description** (string) - The description of the model run. - **created_at** (string) - Timestamp when the run was created. ``` -------------------------------- ### Create Relationship Source: https://context7.com/exabel/python-sdk/llms.txt Establishes a specific relationship between two entities using a defined relationship type. Can include properties. ```python from exabel.client.api.data_classes.relationship import Relationship # Create a relationship relationship = client.relationship_api.create_relationship( Relationship( relationship_type=rel_type.name, from_entity=f"entityTypes/brand/entities/{namespace}.brand1", to_entity="entityTypes/company/entities/F_000Q07-E", description="Ownership relationship", properties={"acquisition_year": 2020} ) ) ``` -------------------------------- ### Manage Entities Source: https://context7.com/exabel/python-sdk/llms.txt Perform CRUD operations, bulk processing, and pagination on entities. ```python from exabel import ExabelClient from exabel.client.api.data_classes.entity import Entity client = ExabelClient() namespace = client.namespace # Create a single entity entity = client.entity_api.create_entity( Entity( name=f"entityTypes/brand/entities/{namespace}.coca_cola", display_name="Coca-Cola", description="The Coca-Cola brand", properties={"founded": 1886, "active": True} ), entity_type="entityTypes/brand" ) print(f"Created: {entity}") # Get an entity entity = client.entity_api.get_entity("entityTypes/company/entities/F_000Q07-E") if entity: print(f"Found: {entity.display_name}") # Upsert an entity (create or update) updated_entity = client.entity_api.upsert_entity( Entity( name=f"entityTypes/brand/entities/{namespace}.pepsi", display_name="Pepsi", description="The Pepsi brand", properties={"founded": 1893, "active": True} ) ) # List all entities of a type with pagination result = client.entity_api.list_entities("entityTypes/brand", page_size=100) for entity in result.results: print(f"- {entity.display_name}") # Use iterator for all entities (handles pagination automatically) for entity in client.entity_api.get_entities_iterator("entityTypes/brand"): print(f"Entity: {entity.name}") # Bulk create entities entities = [ Entity(name=f"entityTypes/brand/entities/{namespace}.brand{i}", display_name=f"Brand {i}") for i in range(10) ] results = client.entity_api.bulk_create_entities( entities, entity_type="entityTypes/brand", threads=4, upsert=True ) print(f"Created: {results.count_upserted}, Failed: {results.count_failed}") # Delete an entity (also deletes relationships and time series) client.entity_api.delete_entity(f"entityTypes/brand/entities/{namespace}.coca_cola") ``` -------------------------------- ### Create Prediction Model Runs Source: https://context7.com/exabel/python-sdk/llms.txt Submits prediction model results to the platform using the prediction model API. ```python import pandas as pd from exabel import ExabelClient from exabel.client.api.data_classes.prediction_model_run import PredictionModelRun client = ExabelClient() # Create a prediction model run run = client.prediction_model_api.create_run( run=PredictionModelRun( name="", # Will be auto-generated description="Q1 2024 model run" ), model="predictionModels/123" ) print(f"Created model run: {run.name}") ``` -------------------------------- ### Time Series API - Create and Retrieve Source: https://context7.com/exabel/python-sdk/llms.txt Endpoints for creating and retrieving time series data, including support for date ranges and point-in-time retrieval. ```APIDOC ## Time Series API ### Description Manages time series data associated with entities and signals. ### Methods - create_time_series: Creates a new time series. - get_time_series: Retrieves time series data. - get_entity_time_series: Lists time series for a specific entity. - get_signal_time_series: Lists time series for a specific signal. - upsert_time_series: Updates or creates time series data. ### Parameters - ts_name (string) - Required - The full resource name of the time series. - series (pandas.Series) - Required - The data points. - start (Timestamp) - Optional - Start date for retrieval. - end (Timestamp) - Optional - End date for retrieval. - known_time (Timestamp) - Optional - Point-in-time retrieval date. - include_metadata (boolean) - Optional - Whether to include metadata in response. ``` -------------------------------- ### Create Relationship Type Source: https://context7.com/exabel/python-sdk/llms.txt Defines a new type of relationship between entities. Requires a unique name and a description. ```python from exabel import ExabelClient from exabel.client.api.data_classes.relationship_type import RelationshipType client = ExabelClient() namespace = client.namespace # Create a relationship type rel_type = client.relationship_api.create_relationship_type( RelationshipType( name=f"relationshipTypes/{namespace}.BRAND_OWNED_BY", description="Links a brand to the company that owns it" ) ) ``` -------------------------------- ### Manage Library Folders and Items Source: https://context7.com/exabel/python-sdk/llms.txt Performs CRUD operations on library folders and manages item sharing and organization. ```python from exabel import ExabelClient from exabel.client.api.data_classes.folder import Folder from exabel.client.api.data_classes.folder_item import FolderItemType client = ExabelClient() # Create a folder folder = client.library_api.create_folder( Folder( name="", # Will be auto-generated display_name="My Analytics", description="Custom analytics and signals" ) ) print(f"Created folder: {folder.name}") # List all folders folders = client.library_api.list_folders() for f in folders: print(f"Folder: {f.display_name} ({f.name})") # Get folder with items folder = client.library_api.get_folder("folders/123") for item in folder.items: print(f"- {item.display_name} ({item.item_type})") # List items of a specific type items = client.library_api.list_items( item_type=FolderItemType.DERIVED_SIGNAL, folder_name="folders/123" ) for item in items: print(f"Derived Signal: {item.display_name}") # Search for items result = client.library_api.search_items( query="revenue", folder_item_type=FolderItemType.DERIVED_SIGNAL, page_size=10 ) for item in result.results: print(f"Found: {item.display_name}") # Move items to a folder client.library_api.move_items( folder_name="folders/123", items=["derivedSignals/456", "screens/789"] ) # Share folder with a group client.library_api.share_folder( folder_name="folders/123", group_name="groups/456", write=True # Give write access ) # Unshare folder client.library_api.unshare_folder( folder_name="folders/123", group_name="groups/456" ) # Delete folder (must be empty) client.library_api.delete_folder("folders/123") ``` -------------------------------- ### Manage Signals Source: https://context7.com/exabel/python-sdk/llms.txt Operations for creating, retrieving, updating, and deleting signal definitions. ```python from exabel import ExabelClient from exabel.client.api.data_classes.signal import Signal client = ExabelClient() namespace = client.namespace # Create a signal signal = client.signal_api.create_signal( Signal( name=f"signals/{namespace}.revenue_growth", display_name="Revenue Growth", description="Year-over-year revenue growth percentage" ), create_library_signal=True # Also add to library ) print(f"Created signal: {signal.name}") # Get a signal signal = client.signal_api.get_signal(f"signals/{namespace}.revenue_growth") if signal: print(f"Signal entity types: {signal.entity_types}") # List all signals with pagination result = client.signal_api.list_signals(page_size=100) for signal in result.results: print(f"- {signal.display_name}") # Update a signal updated_signal = client.signal_api.update_signal( Signal( name=f"signals/{namespace}.revenue_growth", display_name="Revenue Growth Rate", description="Updated description" ), allow_missing=True # Create if not exists ) # Delete a signal (also deletes all time series for this signal) client.signal_api.delete_signal(f"signals/{namespace}.revenue_growth") ``` -------------------------------- ### Search for Entities Source: https://context7.com/exabel/python-sdk/llms.txt Methods for locating companies and securities using various identifiers or text queries. ```python # Search company by Bloomberg ticker companies = client.entity_api.search.company_by_bloomberg_ticker("AAPL US", "MSFT US") for ticker, company in companies.items(): print(f"{ticker}: {company.display_name}") # Search company by ISIN companies = client.entity_api.search.company_by_isin("US0378331005") for isin, company in companies.items(): print(f"{isin}: {company.display_name}") # Search company by FactSet identifier companies = client.entity_api.search.company_by_factset_identifier("QLGSL2-R") # Search company by MIC and ticker companies = client.entity_api.search.company_by_mic_and_ticker(("XNAS", "AAPL"), ("XNYS", "IBM")) for (mic, ticker), company in companies.items(): print(f"{mic}:{ticker} -> {company.display_name}") # Text search for companies results = client.entity_api.search.companies_by_text("Apple", "Microsoft") for query, matches in results.items(): print(f"Search '{query}': {len(matches)} results") # Search securities by CUSIP securities = client.entity_api.search.security_by_cusip("037833100") ``` -------------------------------- ### Query Signal Data Source: https://context7.com/exabel/python-sdk/llms.txt Retrieve signal data for companies using various identifiers, tags, and point-in-time versions. ```python import pandas as pd from exabel import ExabelClient from exabel.query.signals import Signals client = ExabelClient() # Query a single signal for a single company by Bloomberg ticker result = client.export_api.signal_query( signal="close", bloomberg_ticker="AAPL US", start_time="2024-01-01", end_time="2024-03-31" ) print(f"Result:\n{result}") # Query multiple signals for multiple companies result = client.export_api.signal_query( signal=["close", "volume", "market_cap"], factset_id=["QLGSL2-R", "05CVW9-E"], # Apple and Microsoft start_time="2024-01-01", end_time="2024-03-31" ) print(f"DataFrame shape: {result.shape}") # Query signals for companies with a tag result = client.export_api.signal_query( signal="close", tag="tags/user:123", # A custom tag start_time="2024-01-01" ) # Query with point-in-time version result = client.export_api.signal_query( signal="revenue", bloomberg_ticker="MSFT US", version="2024-01-15" # Data as it was known on this date ) # Query with custom identifier columns result = client.export_api.signal_query( signal="close", bloomberg_ticker=["AAPL US", "MSFT US"], identifier=[Signals.BLOOMBERG_TICKER, Signals.FACTSET_ID] ) # Batched query for large number of entities result = client.export_api.batched_signal_query( batch_size=100, signal="close", bloomberg_ticker=["AAPL US", "MSFT US", "GOOGL US"], # Can be a long list start_time="2024-01-01", show_progress=True ) ``` -------------------------------- ### Update and Delete Data Sets Source: https://context7.com/exabel/python-sdk/llms.txt Modify existing data set descriptions or remove data sets from the platform. ```python # Update a data set data_set.description = "Updated description" updated = client.data_set_api.update_data_set(data_set) # Delete a data set client.data_set_api.delete_data_set(f"dataSets/{namespace}.my_signals") ``` -------------------------------- ### Signal API - Create and Manage Signals Source: https://context7.com/exabel/python-sdk/llms.txt Endpoints for creating, retrieving, listing, updating, and deleting signals that define time series data types. ```APIDOC ## Signal API ### Description Manages signals which define the data types associated with entities. ### Methods - create_signal: Creates a new signal. - get_signal: Retrieves a signal by name. - list_signals: Lists all signals with pagination. - update_signal: Updates an existing signal. - delete_signal: Deletes a signal and its associated time series. ### Parameters - name (string) - Required - The resource name of the signal. - display_name (string) - Optional - The human-readable name. - description (string) - Optional - Description of the signal. - create_library_signal (boolean) - Optional - Whether to add to library. - allow_missing (boolean) - Optional - Create if not exists during update. ``` -------------------------------- ### Create Entity Type Source: https://context7.com/exabel/python-sdk/llms.txt Define a new entity type within the Data API to organize entities. ```python from exabel import ExabelClient from exabel.client.api.data_classes.entity_type import EntityType client = ExabelClient() entity_type = client.entity_api.create_entity_type( EntityType( name="entityTypes/acme.brand", display_name="Brand", description="Custom brand entity type for tracking brand-related data" ) ) print(f"Created entity type: {entity_type.name}") ``` -------------------------------- ### Bulk Upsert Time Series Source: https://context7.com/exabel/python-sdk/llms.txt Efficiently imports multiple time series using parallel processing. Configure threads, retries, and an abort threshold for failures. ```python import pandas as pd from dateutil import tz from exabel import ExabelClient from exabel.client.api.data_classes.time_series import TimeSeries client = ExabelClient() namespace = client.namespace # Prepare multiple time series time_series_list = [] for i in range(100): series = pd.Series( [1.0, 2.0, 3.0], index=pd.DatetimeIndex(["2024-01-01", "2024-02-01", "2024-03-01"], tz=tz.tzutc()), name=f"entityTypes/brand/entities/{namespace}.brand{i}/signals/{namespace}.metric" ) time_series_list.append(series) # Bulk upsert with progress tracking results = client.time_series_api.bulk_upsert_time_series( time_series_list, threads=8, retries=3, abort_threshold=0.1 # Abort if more than 10% fail ) print(f"Upserted: {results.count_upserted}") print(f"Created: {results.count_created}") print(f"Failed: {results.count_failed}") ``` -------------------------------- ### Manage Time Series Data Source: https://context7.com/exabel/python-sdk/llms.txt Methods for creating, retrieving, and updating time series data using pandas Series. ```python import pandas as pd from dateutil import tz from exabel import ExabelClient from exabel.client.api.data_classes.time_series import TimeSeries client = ExabelClient() namespace = client.namespace # Create a time series entity_name = f"entityTypes/brand/entities/{namespace}.brand1" signal_name = f"signals/{namespace}.signal1" ts_name = f"{entity_name}/{signal_name}" series = pd.Series( [100, 105, 110, 115], index=pd.DatetimeIndex( ["2024-01-01", "2024-02-01", "2024-03-01", "2024-04-01"], tz=tz.tzutc() ) ) client.time_series_api.create_time_series(ts_name, series) # Retrieve time series result = client.time_series_api.get_time_series(ts_name) if result is not None: print(f"Time series:\n{result}") # Retrieve time series with date range result = client.time_series_api.get_time_series( ts_name, start=pd.Timestamp("2024-01-01", tz=tz.tzutc()), end=pd.Timestamp("2024-03-01", tz=tz.tzutc()) ) # Retrieve time series with metadata ts_with_metadata = client.time_series_api.get_time_series(ts_name, include_metadata=True) if isinstance(ts_with_metadata, TimeSeries): print(f"Units: {ts_with_metadata.units}") # Point-in-time retrieval (as of a specific known time) result = client.time_series_api.get_time_series( ts_name, known_time=pd.Timestamp("2024-02-15", tz=tz.tzutc()) ) # List all time series for an entity result = client.time_series_api.get_entity_time_series(entity_name) print(f"Entity has {result.total_size} time series") # List all time series for a signal result = client.time_series_api.get_signal_time_series(signal_name) for ts_name in result.results: print(f"- {ts_name}") ``` ```python import pandas as pd from dateutil import tz from exabel import ExabelClient client = ExabelClient() namespace = client.namespace ts_name = f"entityTypes/brand/entities/{namespace}.brand1/signals/{namespace}.signal1" # Upsert time series (create if not exists, update if exists) new_data = pd.Series( [120, 125, 130], index=pd.DatetimeIndex(["2024-05-01", "2024-06-01", "2024-07-01"], tz=tz.tzutc()) ) client.time_series_api.upsert_time_series(ts_name, new_data) ``` -------------------------------- ### Append Data to Time Series Source: https://context7.com/exabel/python-sdk/llms.txt Appends new data points to an existing time series. Can also return the full series after appending. ```python append_data = pd.Series( [135], index=pd.DatetimeIndex(["2024-08-01"], tz=tz.tzutc()) ) client.time_series_api.append_time_series_data(ts_name, append_data) ``` ```python full_series = client.time_series_api.append_time_series_data_and_return( ts_name, pd.Series([140], index=pd.DatetimeIndex(["2024-09-01"], tz=tz.tzutc())), allow_missing=True ) print(f"Full series:\n{full_series}") ``` -------------------------------- ### Delete Relationship Source: https://context7.com/exabel/python-sdk/llms.txt Removes a specific relationship between two entities based on the relationship type and entity identifiers. ```python # Delete a relationship client.relationship_api.delete_relationship( relationship_type=rel_type.name, from_entity=f"entityTypes/brand/entities/{namespace}.brand1", to_entity="entityTypes/company/entities/F_000Q07-E" ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.