Basic components of AnyHedge contracts
Project description
anyhedge
Basic components for AnyHedge contracts.
Currently, this only deals with contract execution and focuses on sats-accurate values in relation to the reference typescript AnyHedge Library.
Install
pip install anyhedge (use venv, miniconda, etc. - don't install things on your system python)
Requirements
python >= 3.10(use venv, miniconda, etc. - don't install things on your system python)requirements.txt(pip install -r requirements.txtusing your virtual python)
Demo
python demo.py
You should see something like this:
ContractProposal(start_timestamp=1668818394 (2022-11-19T00:39:54+00:00),
maturity_timestamp=1668829194 (2022-11-19T03:39:54+00:00),
nominal_oracleUnits_x_satsPerBch=10000000000000,
start_price_oracleUnits_per_bch=10000,
low_liquidation_price_oracleUnits_per_bch=7143,
oracle_public_key='02d3c1de9d4bc77d6c3608cbe44d10138c7488e592dc2b1e10a6cf0e92c2ecb047',
maker_side=Hedge)
That is a $1000.0 Long Taker contract.
ContractFunding(base_proposal=...,
fee_agreements=(FeeAgreement (maker fee): Taker --> 1000 Sats (1e-05 BCH) --> Maker,
FeeAgreement (settlement service fee): Taker --> 2000 Sats (2e-05 BCH) --> Settlement Service))
That is a contract funding with a total of 1e-05 BCH in fees to Maker.
ContractRedemption(base_funding=...,
end_price_timestamp=1668829194 (2022-11-19T03:39:54+00:00),
naive_end_price_oracleUnits_per_bch=11000,
redemption_type=Maturation)
That is a redemption paying 4.90881092 BCH to Taker versus their original 3.99972001 BCH for a gain of 22.728113661135996%.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anyhedge-4.1.2.tar.gz.
File metadata
- Download URL: anyhedge-4.1.2.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8fb359fd8081bd95eb2cc6932a9d0e9c7556e5e911ea0d075aa51403f0ab102
|
|
| MD5 |
69c9bf0d9455f7d0ca8222fcc7c9eae7
|
|
| BLAKE2b-256 |
133b07f329d653d1478bdec943a38cf99db3a1c5367a05cdfb6bfc6fd110c2e3
|
File details
Details for the file anyhedge-4.1.2-py3-none-any.whl.
File metadata
- Download URL: anyhedge-4.1.2-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd4dd2343783b2a180f26f99196ef4e8fc3567c40fa9d590585809e484a849c
|
|
| MD5 |
02a164c38988613764f23f1d8e93127e
|
|
| BLAKE2b-256 |
18f7c42982b1f377ace78bb954c2f2b90d42b1635db1d76ad72e8338c17c0a9d
|