# 0. How to write code

## Code area

After setting the scheduler type, you will see an empty code area. You can write your own code in this area, and once the bot runs, it will execute the code for each time scheduled by the scheduler type.

When the code is actually executed, it will be wrapped like below, so that the methods and functions called in the code work properly.

Be aware that `import` is **not allowed** in your code.

{% hint style="warning" %}
After running your code, the variables will **not be preserved** in the memory. In other words, the variables saved at the end of the previous schedule are not accessible at the beginning of the next schedule.
{% endhint %}

{% code overflow="wrap" %}

```python
# Available libraries
import math
import numpy as np
import pandas as pd
import time
import datetime
import decimal

import get_raw_data, get_raw_data_in_df # functions to get the time-series data

import PublicAPI # A class to send public API requests  
import PrivateAPI # A class to send private API requests

# publicAPI is automatically initiated.
# privateAPI is automatically initiated by your API keys.
publicAPI = PublicAPI()
privateAPI = PrivateAPI(*api_keys)

# --------------------------------------------------------

'''
You code runs here
'''

```

{% endcode %}


---

# 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.unblinked.com/terminal/create-bot-strategy/0.-how-to-write-code.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.
