0max1
Home
  • Overview
    • Introduction
    • Our Solution
      • Quant AI Bot
        • Coin Future Funding Rate Farming
        • Spread Arbitrage
        • MEV Arbitrage
      • USDi Stablecoin
        • 1:1 Pegged to USD
        • Auto Income Distribution
      • 0max1 Token
    • Where to get USDi
  • Trust
    • Delta Neutral and Arbitrages
    • Transparency and Auditability:
      • Addresses
    • Human-error Free with AI Automation:
      • Data Source
      • Simulator
        • Definitions
        • Sample codes and details
      • Monitor
        • Process
        • Definitions
        • Sample codes and details.
  • API End Points
    • APIs for Funding ARB Analytics
Powered by GitBook
On this page
  • Raw data:
  • Calculations:
  • Output data:
  1. Trust
  2. Human-error Free with AI Automation:
  3. Simulator

Definitions

Raw data:

  • Historical Funding Rates Data (df): this DataFrame reads the CSV file containing original historical funding rate data collected by Monitor. To verify the simulation, you can use the monitor by restricting the time range and resetting the weight and allocation.

  • Simulation Configurations Input (simulations_df): this dataframe reads the CSV file containing inputs for different period funding rate weights and allocation weights for each simulation. These are the configurations that will be used to calculate tokens' scores and the simulation's realized APRs. (Simulations_df is created by Weight_Generator)

    • funding rate weights inputs: are established for a token's average funding rates over different periods—3 days, 7 days, 30 days, previous funding rate, and next funding rate within a simulation. These funding rate weights are defined in the code as

      WEIGHTS = [W3, W7, W30, W_prev, W_next]
    • allocation weights inputs: are determined for the top-ranked tokens selected based on their scores within a simulation. These allocation weights are defined in the code as

      ALLOCATIONS = [A1, A2, A3]

Calculations:

symbol: token's name

symbol∈unique(df[′symbol′])symbol∈unique(df[′symbol′]) symbol∈unique(df[′symbol′])

simulations_id: index id of the specific simulation in 'simulations_df'

simulation_id∈Simulation ID[0,1,2,3,4,5,....,n],   where Simulation ID∈simulations_dfsimulation\_id∈Simulation\:ID[0,1,2,3,4,5,...., n], \\ \:\:\:where \: Simulation\: ID \isin simulations\_dfsimulation_id∈SimulationID[0,1,2,3,4,5,....,n],whereSimulationID∈simulations_df

model_num: is the number represents the ithithith generation for a simulation that generates in the model

model_num∈[1,2,3,4,5,6,7,8,9,10]model\_num \isin [1,2,3,4,5,6,7,8,9,10]model_num∈[1,2,3,4,5,6,7,8,9,10]

group: is the subset of 'df' where the token symbol matches symbolsymbolsymbol, specifically the funding rate data.

i\bold{i}i: calculates index based on the length of 'group', the model number, and other factors. This will identify the rates that will be collected, beginning with index iii.

i=(len(group)  mod 90)+(model_num−1)×9i = (len(group)\:\:mod\:90)+(model\_num−1)×9 i=(len(group)mod90)+(model_num−1)×9

W\bold{W}W: List of weight arrays, where each weight array corresponds to a particular simulation

weights=[Wj​[simulations_id] for Wj​ in WEIGHTS]weights=[W_j​[simulations\_id] \: for \: W_j​ \: in \:WEIGHTS]weights=[Wj​​[simulations_id]forWj​​inWEIGHTS]

A\bold{A}A: List of allocation weight arrays, where each allocation weight array corresponds to a particular rank for a token that selected in a simulation

allocations=[Aj​[simulations_id] for Aj​ in ALLOCATIONS]allocations =[A_j​[simulations\_id] \: for \: A_j​ \: in \:ALLOCATIONS]allocations=[Aj​​[simulations_id]forAj​​inALLOCATIONS]

  • Token Scores Function 'token_score_func(symbol, simulations_id, model_num)': is a function to calculate all tokens' scores of a simulation in a single generation.

    Average Periodic APR Calculations: Calculate average funding rates over different periods and scale them to get APRs. For the APR calculations for different periods

APR3=Mean(group[i:i+9])×3×360×100APR7=Mean(group[i:i+21])×3×360×100APR30=Mean(group[i:i+90])×3×360×100APRprev=Mean(group[i+1])×3×360×100APRnext=Mean(group[i])×3×360×100APR_3 = Mean(group[i: i+9])\times 3\times360\times100 \\ APR_7 = Mean(group[i: i+21])\times 3\times360\times100 \\ APR_{30} = Mean(group[i: i+90])\times 3\times360\times100 \\ APR_{prev} = Mean(group[i+1])\times 3\times360\times100 \\ APR_{next} = Mean(group[i])\times 3\times360\times100 APR3​=Mean(group[i:i+9])×3×360×100APR7​=Mean(group[i:i+21])×3×360×100APR30​=Mean(group[i:i+90])×3×360×100APRprev​=Mean(group[i+1])×3×360×100APRnext​=Mean(group[i])×3×360×100
token_score_func=∑km(APRk(symbol,i)×Wk[simulation_id]),for k∈m=[3, 7, 30, prev, next]token\_score\_func= \displaystyle\sum_{k}^m(APR_k(symbol, i) × W_k[simulation\_id]) , \\ for\: k \isin m =[3,\: 7, \:30, \:prev,\:next]token_score_func=k∑m​(APRk​(symbol,i)×Wk​[simulation_id]),fork∈m=[3,7,30,prev,next]
  • Simulation Realized APR Function 'simulation_apr_func(Tokens_names, simulations_id, model_num)': is a function to calculate a simulation's APR in a single generation, using the top 3 tokens chosen by Token Scores Function.

    Average 3 days funding rate: Calculate average funding rate over 3 days for the token identified by 'symbol' that selected by its score in a simulation.

avg_3Days_rate=Mean(groupsymbol[i−9:i])avg\_3Days\_rate = Mean(group_{symbol}[i-9 : i])avg_3Days_rate=Mean(groupsymbol​[i−9:i])
simulation_apr_func=∑jr(avg_3Days_rate(symbolj)×Aj[simulation_id]),for j∈r=[1, 2, 3, ...], ′r′ represents top token′s rank in a simulation.simulation\_apr\_func= \displaystyle\sum_{j}^r(avg\_3Days\_rate(symbol_j) × A_j[simulation\_id]) , \newline for\: j \isin r =[1,\: 2, \:3, \:...], \newline \ 'r'\:represents\:top\:token's\:rank\:in\:a\:simulation.simulation_apr_func=j∑r​(avg_3Days_rate(symbolj​)×Aj​[simulation_id]),forj∈r=[1,2,3,...], ′r′representstoptoken′srankinasimulation.
  • Average Simulation APR in all generations ('simulation_avg_apr'): is a average realized APR of a single simulation in all 10 generations.

simulation_avg_apr=∑h=1Tsimulation_apr_funch  ÷  Tfor h∈model_num,where T=∑model_num,simulation\_{avg}\_{apr} = \displaystyle\sum_{h=1}^{T}simulation\_apr\_func_{h} \:\:\div\:\: T \\ for\: h\isin model\_num , \\ where \: T = \sum{model\_num}, \\simulation_avg_apr=h=1∑T​simulation_apr_funch​÷Tforh∈model_num,whereT=∑model_num,

Output data:

Final Output ('final_output'): final output is a merged table that includes 'funding_rate_weight_df' with an additional column called 'Realized APR' and 'Tokens'. 'Realized APR' contains the average APRs from each of the 9 simulations across a total of 10 generations."

The Most Optimized Configurations: is the recommend configuration selected from a simulation with the highest 'Realized APR' in the final output, which will be fed into the monitor.

PreviousSimulatorNextSample codes and details

Last updated 10 months ago