Skip to content

CruizeFinance/HedgingScripts

Repository files navigation

Data scripts

to analyze and test different models, algorithms and mock systems.

Scripts written so far:

  • Hedging fees
    Generated based on number of days the protocol was open to risks due to the assets value and trading fees based on transactions in ETH/CRUIZE open pool in a dex. File: /v1_profit_loss/views



    curl --location --request GET 'http://127.0.0.1:8000/revenue/v1?cruize_price=1&staked_asset_price=3000&dip_days=14&staked_eth_size=0.5&cover_pool=100000&current_price_of_asset=2400&tuner=0.2&transactions_per_day=500'


  • Smart Treasury - Mocked
    To maintain an 80/20 Cruize/USDC ratio by interacting with the open market to determine whether to selling or buy back cruize tokens.
    File: /smart_treasury/views/



    curl --location --request GET 'http://127.0.0.1:8000/smart_treasury?usdc_pool=6000&cruize_pool=8000&lp_usdc=400&cruize_price=4'


  • Asset Historical data
    To generate an assets historical data with high and low price of asset for any given period.
    File: /tokens/views/historical_data

    Example: Generating historical data on a day by day basis for the last 30 days will produce high and low value of the asset for each day.
    Similarly, data for a month by month basis for the last 6 months will produce high and low for each month in the last 6 months.

    curl --location --request GET 'http://127.0.0.1:8000/token_data/v1/historical_data/?token=BTC&conversion_token=USD&source=day&past_days=30'


  • Liquidation Threshold
    Calculate Liquidation threshold for an asset based on high and low price of asset for each month for a set of months in the past.
    File: /tokens/views/liquidation_threshold



    curl --location --request GET 'http://127.0.0.1:8000/token_data/v1/liquidation_threshold/?token=BTC&conversion_token=USD&source=day&past_days=30'


  • Floating Strike Price Options Data
    This API endpoint returns a total funding fee paid over a given period
    based on floating (changing) strike price for the hedged asset.

    curl --location --request GET 'http://127.0.0.1:8000/options/funding_fee?token=ETH&current_asset_price=2584&asset_vol=1&price_floor=0.85&period=7'


    Other supported params:
    1. token='ETH',
    2. current_asset_price='2584',
    3. asset_vol=1,
    4. price_floor=0.85, # 85%
    5. underlying_asset_price=3000, # At the time of withdrawal or when an option is exercised
    6. option_market_price,
    7. strike_price,

      How to run a script?

      1. Clone the repo to your local computer.
      2. Open the project on Pycharm
      3. Create a conda environment: conda create -n cr_scripts_venv python=3.7
        Activate the conda environment: conda activate cr_scripts_venv
      4. Set it as the default Python Interpreter for the project.
      5. Run pip install -r requirements.txt
      6. Run python manage.py runserver
  • About

    No description, website, or topics provided.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Contributors 3

    •  
    •  
    •