Skip to main content

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.txt using 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anyhedge-3.0.0.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

anyhedge-3.0.0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file anyhedge-3.0.0.tar.gz.

File metadata

  • Download URL: anyhedge-3.0.0.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for anyhedge-3.0.0.tar.gz
Algorithm Hash digest
SHA256 a5f8753fdba2ec6ce6e98e71ac7b7cb0d555a0db1e8af5222fb1ba175def8a2f
MD5 691dc882117b540bb04824ceb479d6fa
BLAKE2b-256 f16b3f5f4205315daf6376f828c2a82c7793bf3f6a74f22a393b2c022ad7607c

See more details on using hashes here.

File details

Details for the file anyhedge-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: anyhedge-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for anyhedge-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 156f014d96b2d881792af7ce969a2caede2b899c19d0449a08e61ffb69b5a38d
MD5 233d1262428928017cc727527bf9a445
BLAKE2b-256 be75382882f2cf56357d8bd1ed5f053d49bf969dcdfd967179b50fb6950e6978

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