Skip to main content

D-one Trading Platform Library

Project description

D1-Pack: Trading Platform Library

D-one Trading Platform Library - это Python библиотека для алгоритмической торговли, анализа данных и управления портфелем.

Установка

d1_library
MANIFEST.in - MANIFEST.in within the d1_library directory ensures the inclusion of all SQL scripts located in the sql_tools/sql_scripts subdirectory into the distribution package
- This is crucial for the project's functionality as it guarantees the necessary SQL scripts are packaged and available for use in the application's database operations.
pyproject.toml - The 'pyproject.toml' in the 'd1_library' directory outlines the build system and project metadata for the D-one Trading Platform Library
- It specifies the required Python version, build dependencies, and the backend used for building
- Additionally, it lists the project's dependencies, ensuring the correct packages are installed for successful operation.
setup.py - The 'setup.py' in the 'd1_library' directory configures the D-one Trading Platform Library
- It specifies the library's metadata, required Python version, dependencies, and included package data
- This setup file is crucial for the library's distribution and installation, ensuring the correct environment for the trading platform's operation.
d1_library
requirements.txt - The requirements.txt in the d1_library directory specifies the necessary libraries for the project
- It includes trading APIs, data processing tools, database utilities, and other utilities
- These libraries enable the project to interact with trading platforms, process data, manage databases, and perform other utility functions.
strategies
portfolio.py - OptimizationPortfolio in portfolio.py manages the optimization of a financial portfolio
- It calculates the efficient frontier, allocates assets discretely based on the latest prices, and provides the new portfolio
- It also determines which stocks to buy or sell
- This is integral to the project's financial analysis and investment strategy formulation.
momentum.py - Momentum.py, located in the d1_library/strategies directory, is a crucial component of the project
- It calculates the momentum score of financial time series data, filters data by date, and identifies top performing symbols based on momentum
- This module aids in the selection of optimal portfolio components within the broader codebase architecture.
stock_parser
fmp_fetcher.py - FMPFetcher, located in the d1_library/stock_parser directory, serves as a data fetcher and parser for stock market data from the Financial Modeling Prep (FMP) API
- It retrieves historical and daily stock data, handles rate limits, and prepares the data for database insertion.
stock_list_fetcher.py - StockListFetcher, located in the d1_library/stock_parser directory, fetches and parses information about companies traded on 'NYSE', 'NASDAQ', 'AMEX' markets
- It retrieves data from the NASDAQ API, processes it into a pandas DataFrame, and filters it based on selected columns, providing a streamlined dataset for further analysis.
rapid_fetcher.py - Rapid_fetcher.py, located in the stock_parser directory, serves as a data fetcher from the Alpha Vantage API
- It retrieves daily adjusted stock data for specified symbols, including opening, closing, high, and low prices, volume, dividends, and split coefficients
- The data is returned as a Pandas DataFrame, supporting the project's data analysis and visualization tasks.
tdameritrade_fetcher.py - TdameritradeFetcher, located in the d1_library, interacts with the TD Ameritrade API to fetch stock market data
- It checks if the market is open, retrieves daily data for specified symbols, and organizes the data into a pandas DataFrame
- The module dynamically loads credentials from a specified secrets file.
yahoo_fetcher.py - YahooFinanceFetcher, located in the stock_parser directory, serves as a market status checker for a specific stock symbol
- It fetches the trading history of the symbol from Yahoo Finance and determines whether the market is open based on the latest trading date
- This functionality is integral to the overall project's ability to interact with real-time stock market data.
sql_tools
db_fetcher.py - DatabaseFetcher in db_fetcher.py establishes a connection to a PostgreSQL database using provided credentials
- It executes SQL scripts to fetch daily data, specific daily data, exchange IDs, vendor IDs, symbol IDs, and actual symbols
- It also provides functionality to close the database connection.
db_insert.py - DatabaseInsert in db_insert.py facilitates data loading into a database
- It dynamically loads secrets for database credentials, constructs a database engine URL, and executes SQL queries to insert data
- It also handles the insertion of symbols and daily data, with error handling and connection disposal included.
sql_scripts
daily_spec_data.sql - The daily_spec_data.sql script within the SQL tools of the D1 library retrieves specific daily data for a given symbol within a specified date range
- It forms a crucial part of the project's data extraction and manipulation process, enabling targeted data analysis and decision-making.
exchange_id.sql - The 'exchange_id.sql' script, located in the 'sql_tools/sql_scripts' directory of the 'd1_library', retrieves the unique identifier of a specific exchange from the 'exchange' table in the database
- This is achieved by matching the provided abbreviation, thereby facilitating the identification and management of different exchanges within the system.
symbols.sql - In the context of the entire codebase architecture, the script located at d1_library/d1_library/sql_tools/sql_scripts/symbols.sql serves to extract unique symbols from a database
- It specifically retrieves symbols that have been updated since a specified date, ensuring the most recent data is always utilized.
insert_symbols.sql - The insert_symbols.sql script in the d1_library/sql_tools/sql_scripts directory updates the 'symbols' table in the database
- It populates the table with data from a temporary table, handling any conflicts by updating existing records
- The script also removes the temporary table after the operation.
vendor_id.sql - Vendor_id.sql within the sql_scripts directory of the d1_library retrieves the unique identifier of a specific data vendor from the data_vendor table
- This operation is crucial for linking vendor-specific data across the entire codebase, ensuring accurate data tracking and management.
symbol_id.sql - Symbol_id.sql, located in the sql_scripts subdirectory of the d1_library, retrieves the id and ticker from the symbols table
- This operation is integral to the project's overall functionality, enabling the identification and tracking of different symbols within the system.
daily_data.sql - Daily_data.sql, located in the sql_scripts directory under the sql_tools of the d1_library, retrieves the closing price of a specific symbol between two dates
- This script plays a crucial role in the codebase architecture by providing time-bound financial data for further analysis or processing.
insert_daily_data.sql - The SQL script in the d1_library/sql_tools/sql_scripts directory serves to update the daily_data table with new stock market data
- It pulls this data from a temporary table, handles any conflicts with existing entries based on a unique key, and then removes the temporary table.
telegram_bot
notificationsender.py - Notificationsender.py, located in the telegram_bot directory of the d1_library, is responsible for interacting with the Telegram API
- It retrieves updates from a specific bot using a unique token, enabling the system to receive and process incoming messages from the Telegram platform.
terminal
ibkr.py - IBAPI, located in the terminal directory, serves as an interface to the Interactive Brokers (IB) trading platform
- It establishes a connection, handles requests, and manages trading operations such as retrieving account details, positions, portfolio, and news, as well as submitting orders
- It leverages the ib_insync library to interact with the IB's API, ensuring seamless trading operations.
alpaca.py - AlpacaTrader, located in the terminal directory of the d1_library, interfaces with the Alpaca Trade API
- It initializes the API, retrieves position data, and submits orders
- The class also validates order side input and optionally includes average entry price in position data
- This component plays a crucial role in managing and executing trades within the larger codebase.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

d1_library-1.0.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

d1_library-1.0.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file d1_library-1.0.0.tar.gz.

File metadata

  • Download URL: d1_library-1.0.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for d1_library-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2ec7863e03af6625b4223fbca638b88ad4a8307063ae2ca1a589f967c3ab874e
MD5 5872d94ddf615efa8287ea6d8b860360
BLAKE2b-256 ed8b3647ddcc6e7b79295cc8fa64213a7106f2d7d872848f6b08914c75accf9e

See more details on using hashes here.

File details

Details for the file d1_library-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: d1_library-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for d1_library-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3d748c3ff1e15ac6f455e4478db07e994ad86cb123cd626d710959d374aab1
MD5 bb5ab4501c04a13a2a273f67994cbb95
BLAKE2b-256 cce34e91dabd9313596f4188e93a13cc4f12f275b4e4f4868cf898117bdae3b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page