# Simulator

the purpose of the simulator is to give the most optimized configurations for 0max1 monitor. This recommended configurations is based on historic backtest simulation results.

Steps:

```
1. Start

2. Read Data 
Raw history funding rates data ('df'): fatched by Monitor.
Simulation Configurations Data ('simulations_df'): contains multiple simulations with varying configurations in each simulation.

4. Define Functions
'token_score_func(symbol, simulations_id, model_num)': 
It is used to calculate the scores for every token within each simulation. 
'simulation_apr_func(Tokens_names, simulations_id, model_num)':
It is used to calculate the APR for each simulation based on the top tokens that are selected by their scores.

5. Model Generation Process 
    - The model initially selects a 'simulations_id' from 'simulations_df'
    - Generates the simulation 10 times over 30 days, utilizing 90 data points at a frequency of every 3 days (yielding 9 data points each)
    - Calculates scores for every 40 tokens within each generation by using the function 'token_score_func(symbol, simulations_id, model_num)' 
    - Selectes the top tokens ('Token_names') based on their scores ('top3_score')
    - Calculates the realized APR of the simulation ('cal_apr') by using the function 'simulation_apr_func(Token_names, simulations_id, model_num)'
    - Stores all 10 generations realized APRs for this single simulation in 'simulation_total_apr'
    - Computes the average APR and stores in 'simulation_avg_apr'
    - Repeat the process for every simulation and the results are stored in 'sorted_simulation_avg_apr'
    - The whole model generation process will repeat every 30 days (90 data points)

6. Collect and Prepare Final Data
Compile all processed and optimized realized APR into a final DataFrame 'max_realized_apr'
Format and sort each simulation's realized APR score and merge it with Simulation Configurations Data 'simulations_df'

7. Output Results
Display the final DataFrame 'final_output'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kira.trading/trust/human-error-free-with-ai-automation/simulator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
