Where Are AutoHedge Outputs and Logs Stored? A Complete Guide to Artefact Locations
AutoHedge stores runtime artefacts in two distinct directories relative to the repository root: trading-cycle results are written to the outputs/ folder, while granular trade logs are saved as CSV files in the logs/ directory.
The AutoHedge repository by The-Swarm-Corporation automatically generates persistent files during algorithmic trading sessions. Understanding exactly where AutoHedge outputs and logs are stored is essential for debugging, audit trails, and downstream analysis pipelines.
Default Output Directory Location
The AutoHedge class creates an outputs folder adjacent to the project root to store trading-cycle results. According to the source code in autohedge/main.py, the output_dir parameter defaults to the string "outputs" and the directory is instantiated during class initialization (lines 19-28).
When you initialize the system without custom arguments, AutoHedge resolves this path relative to the execution context. This design ensures that high-level results remain accessible regardless of whether you run the system locally, in a container, or on a cloud instance.
Log File Storage Location
Detailed transaction records reside in the logs/ directory at the repository root. The trading workers implemented in autohedge/workers.py generate CSV files following the naming convention trades_YYYYMMDD_HHMMSS.csv every time a trade executes.
These CSV files capture granular execution data including timestamps, trading symbols, order sides (buy/sell), quantities, and prices. Unlike the outputs folder—which may be created dynamically—the logs directory is pre-populated in the repository and serves as the authoritative audit trail location.
How the Output Directory Is Configured
The configuration logic lives in autohedge/main.py. The constructor accepts an output_dir argument that takes either a string or a pathlib.Path object. If omitted, the system defaults to "outputs" and automatically creates the directory if it does not exist.
This allows users to redirect artefacts to external volumes or cloud storage by passing absolute paths during instantiation.
Trade Log CSV Structure
Each CSV written to logs/ contains standardized columns representing a complete trade lifecycle. The files are written by the worker processes to prevent data loss during concurrent trading operations.
The persistent schema includes temporal data, asset identifiers, directional indicators, and execution prices—providing sufficient granularity for regulatory reporting or strategy backtesting.
Accessing Output and Log Files Programmatically
The following examples demonstrate how to locate and consume these artefacts from Python code.
Running a Trading Cycle and Resolving Output Paths
from autohedge.main import AutoHedge
# Initialize with default outputs/ location
hedge = AutoHedge()
# Execute trading task
logs = hedge.run(task="Find arbitrage opportunities")
# Display resolved absolute path to output directory
print(f"Outputs saved in: {hedge.output_dir.resolve()}")
This snippet instantiates the AutoHedge engine with the default configuration, executes a task, then prints the resolved filesystem path to the output directory.
Reading Historical Trade Logs
import pathlib
import pandas as pd
logs_path = pathlib.Path("logs")
# Iterate over all trade log CSVs
for csv_file in logs_path.glob("trades_*.csv"):
df = pd.read_csv(csv_file)
print(f"--- {csv_file.name} ---")
print(df.head())
This pattern loads every trades CSV in the logs directory into pandas DataFrames, enabling aggregation across multiple trading sessions.
Summary
- Outputs directory: Defaults to
outputs/at the repository root; configurable via theoutput_dirparameter inautohedge/main.py(lines 19-28). - Logs directory: Fixed at
logs/at the repository root; contains timestamped CSV files generated byautohedge/workers.py. - File formats: Outputs contain trading-cycle results while logs contain granular trade records with timestamps, symbols, sides, quantities, and prices.
- Programmatic access: Both locations support standard Python filesystem operations and pandas ingestion for analysis pipelines.
Frequently Asked Questions
Can I change the default logs directory location?
The current implementation in the The-Swarm-Corporation/AutoHedge repository hardcodes the logs path to logs/ at the repository root within the worker implementations. To redirect log storage, you must modify the path constants in autohedge/workers.py or implement a custom logging adapter, as the AutoHedge class constructor only exposes the output_dir parameter for outputs.
What data format do the log files use?
Log files are standard CSV (Comma-Separated Values) documents with headers. Each row represents a single executed trade and includes columns for the timestamp, trading symbol, transaction side (buy or sell), quantity transacted, and execution price. This format ensures compatibility with pandas, Excel, and regulatory reporting tools without additional parsing.
Does AutoHedge create the outputs folder automatically?
Yes. When instantiating the AutoHedge class, the initialization logic in autohedge/main.py checks for the existence of the specified output_dir and creates it if absent. This occurs during object construction (lines 19-28), ensuring the directory is ready before any trading cycles begin writing results.
How do I backup AutoHedge logs and outputs?
Since both outputs/ and logs/ are standard directories at the repository root, you can backup these locations using standard filesystem tools like rsync, cp, or cloud storage sync commands. For containerized deployments, mount these directories to persistent volumes at runtime to ensure data survives container restarts.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →