Skip to main content

Algora Labs Python SDK

Project description

Algora Labs Python SDK

Algora Labs is an IDE for Quants. We provide users financial data, a research environment and visualization tools to efficiently translate research ideas into actionable insights for trading. The algora-sdk allows users to programmatically access 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

Auto generating Docs

To autogenerate docs we are using pdoc3. To be compatible with pdoc3 we use the Google docstring format so make sure to update pycharm to use Google as the default docstring style.

$ pdoc3 --html .\algoralabs\ --output-dir .\docs\generated

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 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.1.57.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

algora_sdk-1.1.57-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: algora-sdk-1.1.57.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for algora-sdk-1.1.57.tar.gz
Algorithm Hash digest
SHA256 af045329ae281cef132ceba24191bd82e9ce54a404bc4b33f2abf59a8706e416
MD5 c44adaed97644b78d27015f4aca220b5
BLAKE2b-256 6bb6beed7307d1e468a9ecfa72372d3c6a9f38694cc1b7441aabf164ec3c0262

See more details on using hashes here.

File details

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

File metadata

  • Download URL: algora_sdk-1.1.57-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for algora_sdk-1.1.57-py3-none-any.whl
Algorithm Hash digest
SHA256 94210a6e4237620123cce4b7b6e484588d59e0167f7024e024ca43fb17a2af9a
MD5 e04aeb6594e7d4e62358131db257e6d0
BLAKE2b-256 1d90b066a5caa38759f5a535d63b000f5f6b79c914399d425269203913652e3c

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