Skip to content

Shivang0/dynamic-hedging

Repository files navigation


Logo

Dynamic hedging

Options delta neutrality as a crypto native uncorrelated asset class

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • npm
npm install npm@latest -g

Installation

  1. Clone the repo
git clone
  1. Install NPM packages
npm install

or

yarn
  1. Add environment variables

Create free API keys for alchemy and infura

a. Create /packages/contracts/.env with:

ALCHEMY_KEY=<your-alchemy-key>

b. Create /packages/front-end/.env with:

REACT_APP_INFURA_KEY=<your-infura-key>
  1. Start a hardhat node as mainnet fork
cd packages/contracts
npm run mainnet-fork

From a new terminal window

  1. Compile contracts
cd packages/contracts
npm run compile
  1. Deploy contracts and update ABIs + address
cd packages/contracts
npm run deploy:localhost
  1. Start the React app
cd packages/front-end
npm run start

Testing Contracts

Complete steps 1 to 3 from above:

Compile all files

npm run compile

Run all tests

npx hardhat test

To run a specific test suite, e.g. LiquidityPool.ts

npx hardhat test test/LiquidityPool.ts

Run test coverage

npm run test-coverage

Contract Architecture

Rysk Architecture Diagram C Diagram F

Contract layout

contracts
├── hedging
│   ├── PerpHedgingReactor.sol
│   └── UniswapV3HedgingReactor.sol
├── interfaces
│   ├── AddressBookInterface.sol
│   ├── IAuthority.sol
│   ├── AggregatorV3Interface.sol
│   ├── GammaInterface.sol
│   ├── IERC20.sol
│   ├── IOptionRegistry.sol
│   ├── ILiquidityPool.sol
│   ├── IHedgingReactor.sol
│   ├── IMarginCalculator.sol
│   └── IOracle.sol
├── libraries
│   ├── BlackScholes.sol
│   ├── CustomErrors.sol
│   ├── NormalDist.sol
│   ├── OptionsCompute.sol
│   ├── OpynInteractions.sol
│   ├── AccessControl.sol
│   ├── SafeTransferLib.sol
│   └── Types.sol
├── tokens
│   └── ERC20.sol
├── Authority.sol
├── LiquidityPool.sol
├── OptionRegistry.sol
├── OptionHandler.sol
├── Protocol.sol
├── PortfolioValuesFeed.sol
├── VolatilityFeed.sol
└── PriceFeed.sol

About

Options delta neutrality as a crypto native uncorrelated asset class

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors