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
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
Built Distribution
File details
Details for the file algora-sdk-1.1.36.tar.gz
.
File metadata
- Download URL: algora-sdk-1.1.36.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5ee6ad5bc15f8f84e9bee044db5694de357f42f4e7aa2a38c72b60dd1f13fa7 |
|
MD5 | 55d8de31b74e4dcfe88b6a3570a368a7 |
|
BLAKE2b-256 | 704b74cd5b464e9e2cf2e18fdb9730cb0c8223a5f4ba3c48ae8e0aaa48bee366 |
File details
Details for the file algora_sdk-1.1.36-py3-none-any.whl
.
File metadata
- Download URL: algora_sdk-1.1.36-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae551decae6f70e0c7dacfb93ae121a26d752312858a676e2515381ac91784f1 |
|
MD5 | 022a0143f35961eaa20789717c82d026 |
|
BLAKE2b-256 | e8c639a65a56f3f01a73b23530fbd586cc6a6fa951cce64f2bd1e331d1d82660 |