> ## Documentation Index
> Fetch the complete documentation index at: https://qi.alphakdb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

Configs are stored in `*.conf` files, and loaded into the `.conf` namespace. The format is `KEY=VAL`, and the types are dynamically inferred. For example, the following config file:

```
SOMELOGS=some/path
MYSYMS=`JPM`GE
LOT_SIZE=100
WEIGHT=0.35
WRITE_EVERY=00:05
```

will render in q as:

```
q).conf.SOMELOGS
"some/path"
q)conf.MYSYMS
`JPM`GE
q).conf.LOT_SIZE
100
q).conf.WEIGHT
0.35
q).conf.WRITE_EVERY
00:05
```

## Overriding .conf

The `.conf` namespace for a given package (e.g. tp, binance) is populated by a combination of default values in `qi.q` and the package's `defaults.conf`, if it has one. These values can be overriden with the following .conf files, from **lowest to highest precedence**:

| Location                         | Description                                   |
| -------------------------------- | --------------------------------------------- |
| `~/.qi/binance.conf`             | Applies to all binance feeds on this machine  |
| `.qi/binance.conf`               | Applies to all binance feeds in this project  |
| `stacks/dev1/stack.conf`         | Applies to all processes in the dev1 stack    |
| `stacks/dev1/hdb.conf`           | Applies to all HDBs in the dev1 stack         |
| `stacks/dev1/hdb1.conf`          | Applies to the hdb1 process in the dev1 stack |
| `q qi.q wdb1 -WRITE_EVERY 00:05` | Command-line arguments (highest priority)     |

## API keys

API keys (e.g. for feeds) are best kept in machine-wide package-specific files under `~/.qi/`. For example, if you were using Alpaca & Massive:

`~/.qi/alpaca.conf`

```
ALPACA_KEY=a1234567
ALPACA_SECRET=a2345678
```

`~/.qi/massive.conf`

```
MASSIVE_KEY=m1234567
```
