Skip to main content

AlphaSense API SDK

Project description

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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alphasense_api_sdk-0.1.8.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

alphasense_api_sdk-0.1.8-py2.py3-none-any.whl (24.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file alphasense_api_sdk-0.1.8.tar.gz.

File metadata

  • Download URL: alphasense_api_sdk-0.1.8.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for alphasense_api_sdk-0.1.8.tar.gz
Algorithm Hash digest
SHA256 dd65e3118acd11f5e8a286176e42476de82fd09501db090f1664f5b12d696076
MD5 8641f9466d624c396338844fa6f11860
BLAKE2b-256 4356c6458ad4ee4d79fa51b697424ce75b57fe33764495af9c78fa5076acba31

See more details on using hashes here.

File details

Details for the file alphasense_api_sdk-0.1.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for alphasense_api_sdk-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0ded91bcb27e2deff982ffd18cd81a43d0dafc165f624be98b017363a0ef6435
MD5 b5faffb27e804b64500927d68bc6c509
BLAKE2b-256 747d042320a50e96e6e572cdee9d15f3a60c2738b4ef220d018ff6315407bdb2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page