Skip to main content

Algora Labs Python SDK

Project description

Algora Labs Python SDK

Algora Labs is a fully integrated data platform for the finacial markets. We provide users data, a research environment, visualization tools and reporting capabilities to efficiently translate research ideas into actionable insights for trading. The algora-sdk allowers users to programmatically access our datasets and resources on our platform.

Installation

When running locally, set the following environment variables for your username and password for Algora Labs. When running code on our platform, there is no need to set these environment variables.

ALGORA_USER=username
ALGORA_PWD=password

Examples

These examples can be run on our platform.

Rolling Performance

import pandas as pd

from algoralabs.data.iex.stocks import historical_prices


def calculate_returns(df: pd.DataFrame, column: str = 'high', shift: int = 1):
    return df[column].diff() / df[column].shift(shift)


def main(symbol):
    shift = 30

    df = historical_prices(symbol, range="10y")
    df['rolling_return'] = calculate_returns(df, shift=shift) * 100

    df = df.iloc[shift:]

    return df


if __name__ == '__main__':
    print(main("AAPL"))

Swap Data Repository

Note: You must have privileges to access this SDR data

from algoralabs.data.sdr.query import commodity, get_by_date, get_distinct_in_field
from algoralabs.data.sdr.utils import AssetClass, Repository, DataFilter, DateRange, FieldFilter


def main():
    print("Querying Commodity dataset without filters")
    print(commodity())

    print("Querying Commodity dataset by date and repository")
    print(get_by_date(asset_class=AssetClass.COMMODITY, date="2022-01-01", repos=[Repository.CME]))

    print("Getting distinct values in `leg_1_asset` field. These values can be used in the FieldFilter")
    print(get_distinct_in_field(asset_class=AssetClass.COMMODITY, field="leg_1_asset"))

    commodity_filter = DataFilter(
        # data_range is optional, can be None
        date_range=DateRange(
            start_date="2022-01-01",
            end_date="2022-01-01",
            enabled=False  # set to True to enable
        ),
        filters=[
            FieldFilter(
                field="repository",
                # operator can be "NOT_IN" or "IN" or "NOT_EQUAL" or "EQUAL" or "GTE" or "GT" or "LTE" or "LT"
                operator="IN",
                selected_values=["CME", "DTCC"]
            ),
            FieldFilter(
                field="sector",
                operator="IN",
                selected_values=["Energy"]
            )
        ]
    )

    print("Querying Commodity dataset with filters")
    commodity_filter_df = commodity(commodity_filter)

    print(commodity_filter_df)


if __name__ == '__main__':
    main()

Contact

Please Contact Us if you have any questions!

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

algora-sdk-1.0.58.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

algora_sdk-1.0.58-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file algora-sdk-1.0.58.tar.gz.

File metadata

  • Download URL: algora-sdk-1.0.58.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for algora-sdk-1.0.58.tar.gz
Algorithm Hash digest
SHA256 1d6566a5acb81f36b03439a754e1724a691463a3abe9db9ce8ff722a260c2010
MD5 f37aab3591f605f2f6839eb1a24e3b3a
BLAKE2b-256 a4b412e8f4b30d102b66b43b02cafa3c10432ac6697bddbadb74323a3b68b193

See more details on using hashes here.

File details

Details for the file algora_sdk-1.0.58-py3-none-any.whl.

File metadata

  • Download URL: algora_sdk-1.0.58-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for algora_sdk-1.0.58-py3-none-any.whl
Algorithm Hash digest
SHA256 2997bc30a9b08323b76c7dc25fb1e4fa7af51ab89102ca5083cee703fcb120c3
MD5 3addfc5b6d592cfc5aff9a5be9db9be3
BLAKE2b-256 f0752e8b28d06bdfa28695a3558102923dcba67ca9d03441377ad4e354cd0279

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