Skip to main content

EnvisionRiskRaaS


Delve into the world of EnvisionRisk’s Python package, your portal to our sophisticated Market Risk-as-a-Service (RaaS). This comprehensive tool allows you to tap into our cutting-edge risk management services, retrieve relevant data, perform complex calculations, and generate actionable insights, all without leaving your Python programming environment. Embrace this smarter, efficient approach to handling market risk.

Are you navigating the volatile waters of financial uncertainties, seeking to make strategic decisions? Allow EnvisionRisk’s Cloud Service to be your compass, providing a precise mechanism for quantifying market risks. Replace guesswork with certainty; our platform furnishes you with standardized metrics designed to enhance cost-efficiency and fortify your financial bulwark.

Our REST API, a seamless blend of security and user-friendliness, stands as your reliable tool for everyday risk quantification. Transform data into actionable steps and unravel the potential concealed within the labyrinth of financial complexities.

With an expansive coverage spanning more than 13,000 exchange-traded and over-the-counter instruments—and continuously growing—EnvisionRisk is primed to adapt to your ever-evolving needs.

Join the EnvisionRisk community today. Convert your market insights into solid foresights, and consistently maintain a competitive edge in the ever-fluctuating financial market. Stay not just in the game, but ahead of it.

Authentication


EnvisionRisk employs robust authentication and authorization processes to safeguard systems and information. EnvisionRisk’s Market Risk-as-a-Service API operates on a token-based authentication system. To use the service you need to be a registered user. If you don’t already have credentials, you can sign up for a free trial account here: Sign up

Installation


You can install the development version of EnvisionRiskRaaS like so:
pip install EnvisionRiskRaaS

Example


Although the following example may appear simple, it’s designed to illustrate how our service functions by requesting the simulated profit/loss (P/L) distribution for a single instrument — Apple (AAPL.US) as of 2023-06-28. Remember, this is just a starting point; our service also allows you to request simulated P/L distribution for your custom portfolios. Through this, you gain invaluable insights into potential future outcomes, enabling you to make informed investment decisions.

The Profit and Loss (P/L) distribution is a crucial component in the world of market risk management as it provides a quantitative way of understanding potential financial outcomes. Here’s why it plays an essential role:

  • Risk Assessment: The P/L distribution represents the range of possible gains and losses that a portfolio might experience. It allows risk managers to visualize and quantify potential risks. For example, the tails of the distribution give insight into extreme events and potential for significant losses, enabling a comprehensive risk assessment.

  • Risk Measures Calculation: Key risk measures, like Value at Risk (VaR) and Expected Shortfall (ES), are derived from the P/L distribution. VaR estimates the potential loss a portfolio could face over a given period with a certain level of confidence, while ES provides the expected loss given that a loss exceeds the VaR threshold. These metrics help risk managers understand the risk landscape better and make informed decisions.

  • Portfolio Optimization: By understanding the P/L distribution, managers can optimize the portfolio for desired outcomes. It allows them to adjust the portfolio composition to control the risk, striking a balance between risk and return.

  • Regulatory Compliance: Regulators often require financial institutions to maintain capital reserves based on potential losses, which are derived from P/L distributions. Hence, understanding the P/L distribution is crucial to meet these regulatory requirements.

  • Stress Testing: Stress testing involves applying extreme but plausible hypothetical scenarios to the P/L distribution to assess the portfolio’s resilience. This helps managers prepare for unexpected market events and ensure that the portfolio can withstand adverse conditions.

Therefore, P/L distribution serves as a key pillar of market risk management, providing insights into potential risks, informing decision-making, enabling portfolio optimization, and ensuring regulatory compliance.

#Libraries
#Libraries
import EnvisionRiskRaaS as RaaS
from datetime import date
import matplotlib.pyplot as plt
from scipy import stats
import pandas as pd
import numpy as np
import queuelib
import seaborn as sns

#EnvisionRisk login
RaaS.envrsk_auth_log_in("your username/email here", "your password here")

#### Get the delta vector (simulated price change) ####
# The term '_raw' within the function name is indicative of a key feature: 
# the simulated price changes are denominated in the same currency as 
# the stock. This implies that the analysis maintains the original currency 
# perspective of the stock, allowing for more accurate and relevant 
# insights. It enhances ease of comprehension and direct applicability, 
# bringing us closer to the context of the actual trading environment.
use_date = date.today()
use_symbol = "AAPL.US"
api_response = RaaS.envrsk_instrument_delta_vector_raw(use_date,use_symbol)

# Leverage our sophisticated API to conduct an Expected-Shortfall computation, 
# specified at a 97.5% confidence level across a single-day span, utilizing a 
# point-in-time volatility scenario.
api_response_es = RaaS.envrsk_instrument_expected_shortfall_raw(date = use_date,symbols = use_symbol, signif_level = 0.975, volatility_id = "point_in_time")
expected_shortfall_estimate = api_response_es["Output"]["expected_shortfall"][0]

#manipulate the data for the density function
data = api_response["Output"]["PnL"]

#titles and captions
subtitle = "Profit/Loss distribution (one day) for " + use_symbol + " as seen from the " + str(use_date)
caption= "In the world of financial markets, price uncertainty is a key element that contributes to market risk - the risk of losses in positions arising \nfrom movements in market prices. Risk management aims to quantify this risk and devise strategies to mitigate potential losses."

#plot, titles, vertical line and more.
plt.suptitle("Price Uncertainty", fontsize=18)
plt.title(subtitle, fontsize=10, loc='left')
sns.histplot(data, kde=True)
plt.axvline(x = expected_shortfall_estimate, color = "#57575F", label = 'axvline - full height')
plt.text(expected_shortfall_estimate, 300, 'Expected-Shortfall (97.5%, 1 day)', ha='center', va='center',rotation='vertical', backgroundcolor='white')
plt.xlabel("Profit/Loss (in $)")
plt.ylabel("Density")
plt.yticks([])
plt.text(5,-120, caption, ha='center', size=7)
plt.show()

API documentation


You can locate our extensive API documentation here. This comprehensive guide is designed to walk you through our APIs’ functionalities, providing clear instructions on how to integrate and use them effectively.

For each API, you’ll find detailed descriptions, parameter information, example requests, and response formats to help you understand the API’s purpose and functionality. Whether you’re interested in user authentication, data retrieval, or performing specific actions, our documentation has you covered.

In addition, you’ll find a section dedicated to ‘Common Use Cases’ where we illustrate how our APIs can be combined and utilized in various scenarios. This can be an invaluable resource for those seeking to maximize the potential of our services.

Please note that our API documentation is constantly updated with new features and improvements to ensure you have the latest information at your fingertips.

Explore our API documentation today to get started with your integrations and to make the most out of our services!

Metadata

Release files for EnvisionRiskRaaS 1.1.8

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

Source distribution (sdist)

Source distribution for EnvisionRiskRaaS 1.1.8
File Size Uploaded
envisionriskraas-1.1.8.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for EnvisionRiskRaaS 1.1.8
File Interpreter ABI Platform
envisionriskraas-1.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / envisionriskraas-1.1.8.tar.gz

Download URL envisionriskraas-1.1.8.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
95a2f4d99b10bd04ac895a024c47bb4d17bbb655f065902659097b03da547384
BLAKE2b-256 checksum
How to use checksums
5f743d5520d3070994cb252478a1a0a67210083826a89bbd63283eacf1896acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / envisionriskraas-1.1.8-py3-none-any.whl

Download URL envisionriskraas-1.1.8-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
920de02da2f83f6c9555afb8d9545fd0abf835fe1f3babe7075f7fe9bf2980c8
BLAKE2b-256 checksum
How to use checksums
c579392096e6eb3666bb32d1992d648f29ef02066677b3d614c75818d59bc811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.1.8 This release

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

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