Installation and Setup
Relevant source files
The following files were used as context for generating this wiki page:
Stolgo is a specialized Price Action Trading Analysis Library designed to automate price action rules and facilitate backtesting for strategies involving support/resistance, candlestick patterns, trends, and breakouts. The installation process facilitates the integration of financial data analysis tools into Python-based trading environments.
Sources: README.md:1-12, setup.py:10-11
Package Installation
The primary method for installing the stolgo library is via the Python package manager, pip. This ensures all necessary sub-packages located within the lib directory are correctly mapped and available for use.
pip install stolgo
Sources: README.md:14-20, setup.py:25-26
Environmental Requirements
The library is designed to work with Python 3 environments. The setup configuration specifically classifies support for several Python 3 versions to ensure stability across different development environments.
| Requirement | Supported Versions / Values |
|---|---|
| Python Versions | 3.5, 3.6, 3.7, 3.8 |
| License | MIT |
| Development Status | 5 - Production/Stable |
Sources: setup.py:38-46, setup.py:12
Core Dependencies
The library relies on several third-party packages for data manipulation, web scraping, and networking. These are automatically resolved during the installation process.
| Dependency | Purpose |
|---|---|
pandas | Data structure manipulation and OHLC dataframes |
requests | Handling HTTP communication with data providers |
beautifulsoup4 | Parsing HTML data from exchanges |
lxml | High-performance XML/HTML processing |
openpyxl | Excel file operations (e.g., option chain exports) |
datetime | Date and time calculations for historical ranges |
Sources: setup.py:27-33
Network Configuration and Request Handling
Stolgo implements a robust request layer to manage interactions with external financial APIs. This system uses a custom adapter to handle timeouts and retries, ensuring stability when fetching large datasets.
Request Architecture
The system utilizes a RequestUrl class that wraps a requests.Session with a TimeoutHTTPAdapter. This architecture manages connection parameters such as DEFAULT_TIMEOUT (5 seconds) and MAX_RETRIES (2).
This diagram illustrates the relationship between the network request handlers and the underlying HTTP adapters used for connection management.
Sources: lib/stolgo/request.py:11-25, lib/stolgo/request.py:65-74
Data Provider Setup
Setting up stolgo involves configuring specific data providers. Users can choose between standard web-based sources or broker-specific APIs.
Configuring Samco (Broker)
To use the Samco data provider, users must initialize the class with their credentials. This triggers an automated authentication flow to obtain a session token.
The sequence diagram shows the authentication process required to establish a secure connection for data retrieval.
Sources: lib/stolgo/samco.py:72-87, lib/stolgo/samco.py:39-44
Configuring Nasdaq (Public Exchange)
The Nasdaq provider supports a cloud_mode toggle. If enabled, it utilizes a Curl wrapper via subprocess to bypass certain networking restrictions; otherwise, it uses the standard RequestUrl session.
Sources: lib/stolgo/nasdaq.py:46-51, lib/stolgo/request.py:38-57
Data Integration and Pre-processing
Once installed, the library requires integration with a data feed. While Stolgo provides some internal handlers, it frequently interacts with the bandl library for expanded data access.
Initialization Flow
The following flow describes the typical setup for an analysis script using Stolgo components:
This flowchart details the progression from installation to the utilization of analysis modules.
Sources: README.md:24-60, lib/stolgo/helper.py:84-87
Date and Time Helper Configuration
Successful setup for historical data retrieval relies on the helper.py module, which manages date ranges and formatting. It defaults to a range of 250 days if no specific start/end parameters are provided.
Sources: lib/stolgo/helper.py:8-10, lib/stolgo/helper.py:53-62
Summary
Installation of Stolgo is managed through pip, with a strong dependency on pandas and requests. The setup requires configuring the RequestUrl session parameters and, if applicable, providing broker credentials for authenticated data access. The library structure separates networking logic from analysis modules, allowing for modular integration of various financial data sources.