semvec/pypi-packages huggingface dataset:
django-management-command-decorator 0.0.7
The django management decorator package
Requires Python: >=3.8

# Django management command decorator

`django_management_command_decorator`is a small Django app to quickly create management commands using a decorator.


## Installation

* Install this package via pip `pip install django_management_command_decorator`
* Add `management_command_decorator` to your `INSTALLED_APPS` settings
* Create a `commands.py` in your app folder
* Add the `django_management_command` decorator to any function you wish to expose as a mangement command in `commands.py`


## Usage

Create a `commands.py` in your app folder, and add the following code:

```python
from management_command_decorator.decorator import django_management_command

@django_management_command
def print_command():
    print("Hello World!")

```

You should then be able to call the function from your shell like a management command:

```shell
% python manage.py print_command
Hello World!
```

Function args will be added like management command parameters:

```python
from management_command_decorator.decorator import django_management_command

@django_management_command
def greet(name):
    print(f"Hello {name}!")
```

```shell
% python manage.py greet Python
Hello Python!
```
replace-accents 0.0.5
This package helps to replace accented characters with their corresponding non-accented ascii characters

Often, we encounter data that includes special characters with accents or diacritical marks collectively referred to as diacritics. When working with this data, there's often a need to substitute these accented characters with their equivalent non-accented ASCII counterparts.

The exciting news is that this Python package simplifies the process of replacing accented characters with their non-accented ASCII equivalents. 

This Python package is compatible with both standard Python and can seamlessly integrate with Pyspark and Spark SQL for your data processing needs.

The package can be installed from the PyPi repository using the below command
```
pip install replace_accents
```

Let's delve into detailed examples

**1. Python example**
```
# Import the replace accents function
from replace_accents import replace_accents_characters

# Use the function to replace accent characters
replace_accents_characters("crème de la crème")
```

**2. Pyspark example**
```
# Import the replace accents function
from replace_accents import replace_accents_characters

# Import Pyspark col function
from pyspark.sql.functions import col

# Register python function as Pyspark UDF and Spark SQL UDF
replace_accents_characters_pyspark_udf = spark.udf.register("replace_accents_characters_sparksql_udf", replace_accents_characters)

# Create Pyspark Dataframe
df = spark.table("table_name")

# Use Pyspark UDF on the Pyspark dataframe
display(df.select("col1", replace_accents_characters_pyspark_udf(col("col1")).alias("replaced_col1")))
```

**3. Spark SQL example**
```
# Import the replace accents function
from replace_accents import replace_accents_characters

# Register python function as Pyspark UDF and Spark SQL UDF
replace_accents_characters_pyspark_udf = spark.udf.register("replace_accents_characters_sparksql_udf", replace_accents_characters)

# Use Spark SQL UDF in the SQL query
spark.sql("select col1, replace_accents_characters_sparksql_udf(col1) as replaced_col1 from table")
```

You can get more information about this package [here](https://medium.com/@rahul.madhani/replace-accented-characters-in-python-pyspark-and-spark-sql-28844b6c783e)
hedging-gym 0.0.2
HedgingGym is a reinforcement learning environment for training and testing hedging strategies.
Requires Python: >=3.10

# Hedging Gym

Hedging Gym is a reinforcement learning environment for training and testing hedging strategies. It is built on top of OpenAI's Gym framework and is designed to simulate real-world financial markets.

The hedging environment specifics are based on the following paper: [Delta hedging with Deep Reinforcement Learning](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3847272) by Giurca and Borovkova (2021).

The rewards function is defined as 

```math
r_t(s_t, a_t) = PL_t(s_t, a_t) - \frac{\lambda}{2} PL_t(s_t, a_t)^2
```

where the profit and loss function is defined as

```math
PL_t(s_t, a_t) = \delta V_t + \Delta (\delta S_t) - c(\delta \Delta_t)
```

where $V_t$ is the option value, $S_t$ is the stock price, $\Delta$ is the delta used to hedged the position, and $c$ is the cost function that represents the transaction costs for the underlying between $t - 1$ and $t$. The cost function is defined as

```math
c(\delta \Delta_t) = \xi \times \textit{Ticksize} \times (\delta \Delta_t + 0.01(\delta \Delta)^2)
```

Hereby, $\xi \in \mathbb{R}^{+}$ is the level of market friction, $\textit{Ticksize}\times\left(\left|\delta \Delta_{t}\right|\right)$ is a cost relative to the midpoint of crossing a two ticks wide bid-ask spread (for $\xi=1$ ) and $\xi \times \textit{Ticksize} \times 0.01\left(\delta \Delta_{t}\right)^{2}$ is a simplified version of market impact.

## Features

- Simulates Black-Scholes environment for call option hedging, supports both discrete and continuous action spaces.
- Simulates Heston environment for option hedging, for both discrete and continuous action spaces.
- Simulates Exchange option environment (Margrabe Environment) for option hedging, for only in continuous action spaces.

## Installation

To install Hedging Gym, run the following command:

```bash
pip install hedging-gym
```

## Usage

Here is an example of how to create a Hedging Gym environment:

```python
import gymnasium

# Initialize the environment
env = gymnasium.make(
        "CallHedgingBSCont-v0",
        s0=s0,
        strike=strike,
        expiry=expiry,
        r=r,
        mu=mu,
        sigma=sigma,
        n_steps=n_steps,
    )

# Reset the environment
obs, info = env.reset(seed=SEED)

# Take a step
action = np.array([bs_delta_0], dtype=np.float32)
obs, reward, done, info = env.step(action)
```