Skip to main content

AlphaSense API SDK

Installation

Before installing; you should create the virtual environment

pip install alphasense-api-sdk

or specify the version

pip install alphasense-api-sdk==0.1.0

Or adding the alphasense-api-sdk to the pyproject.toml file

dependencies = [
  "alphasense-api-sdk==0.1.0"
]

or requirements.txt file

alphasense-api-sdk==0.1.0

Usage

  • Create pyproject.toml file
  • Add the following to the pyproject.toml file
[alphasense.auth]
username = "<your username>"
password = "<your password>"
api_key = "<your api key>"
client_id = "<your client id>"
client_secret = "<your client secret>"
  • Writing the code to fetch the watchlists with raw GraphQL query
from alphasense_api_sdk.client import Client, GraphQLField

async def main():
    client = Client()
    w = await client.query(
        GraphQLField("user { watchlists { id name }}"), operation_name="user_watchlists"
    )
    print("Watchlists: ", w)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())
  • Or using the Query object to search for documents
from alphasense_api_sdk.client import Client, GraphQLField
from alphasense_api_sdk.custom_queries import Query, SearchResponseFields


async def main():
    client = Client()
    df = SearchResponseFields.documents()
    search_query = Query.search(limit=5).fields(
        SearchResponseFields.documents().fields(
            df.id,
            df.title,
            df.released_at,
            GraphQLField("type { ids }"),
        )
    )
    docs = await client.query(search_query, operation_name="searchDocs")
    print("> docs: ", docs)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Release files for alphasense-api-sdk 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alphasense-api-sdk 0.1.10
File Size Uploaded
alphasense_api_sdk-0.1.10.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alphasense-api-sdk 0.1.10
File Interpreter ABI Platform
alphasense_api_sdk-0.1.10-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 46.2 kB

Release files / alphasense_api_sdk-0.1.10.tar.gz

Download URL alphasense_api_sdk-0.1.10.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d6917db8080fd93d31d01a6300bf28c1b6a2321c0d5c8f7f5aeb3d155095383
BLAKE2b-256 checksum
How to use checksums
42d54520bb0826e653a75f3b36ff738e267002578e451815f4cd583ead4b7bb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / alphasense_api_sdk-0.1.10-py2.py3-none-any.whl

Download URL alphasense_api_sdk-0.1.10-py2.py3-none-any.whl
Size 24.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
66230968b82bf9bed0d9339f9f4a801f1bceefe503c6c34c65413c4b6ef30964
BLAKE2b-256 checksum
How to use checksums
e829973d68dca9e68c5f962c966477699240d8f927aa1b9e571730356a3d7eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page