Top Python Libraries for Fintech and Trading

Posted on May 13, 2025


# Fintech product development collection (Refer to https://github.com/aigaosheng/fintech_AI_product_resource.git for updated version)

- Common financial risk and performance metrics. Used by zipline and pyfolio, [empyrical](https://github.com/quantopian/empyrical/tree/master)

- Python library for performance and risk analysis of financial portfolios that works well with the Zipline open source backtesting library. [pyfolio](https://github.com/stefan-jansen/pyfolio-reloaded/tree/main)

- Bayesian Modeling and Probabilistic Programming in Python. [PyMC](https://github.com/pymc-devs/pymc)

- Portfolio analytics for quants, [quantstats](https://github.com/ranaroussi/quantstats)

- Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity, [PyPortfolioOpt](https://github.com/robertmartin8/PyPortfolioOpt/tree/master)

- Asyncio cache manager for redis, memcached and memory, [aiocache](https://github.com/aio-libs/aiocache)

- Sampling profiler for Python programs, [py-spy](https://github.com/benfred/py-spy)

- Lightweight k-line chart that can be highly customized. Zero dependencies. Support mobile. [KLineChart](https://github.com/klinecharts/KLineChart)

- [Get SEC forms](https://github.com/dgunning/edgartools)

- [Numerai: A global artificial intelligence tournament to predict the stock market.](https://github.com/numerai)

- [tradingview-screener is a Python package that allows you to create custom stock screeners using TradingView's official API](https://github.com/shner-elmo/TradingView-Screener)

- [Awesome-quant: A curated list of insanely awesome libraries, packages and resources for Quants ](https://github.com/wilsonfreitas/awesome-quant)

- [Openbb: The first financial Platform that is free and fully open source.](https://github.com/OpenBB-finance/OpenBB)

- [BT: backtest](https://github.com/pmorissette/bt)

- [findatapy creates an easy to use Python API to download market data from many sources including ALFRED/FRED, Bloomberg, Yahoo, Google etc.](https://github.com/cuemacro/findatapy)

- [finvizfinance is a package which collects financial information from FinViz website](https://github.com/lit26/finvizfinance)

- [AKShare:: simplify the process of fetching financial data](https://github.com/akfamily/akshare)

# User profiling and Taxonomies

User profiling is to develop structued data to characterize the users in your platform, e.g. favorite, activity, behaviors, etc. The field should be human-understandable and explainable, mostly defined at semantic level. A lot of data engineering and data science efforts must be done, e.g. data aggregate, user generated content processing leveraging ML or AI models, et al. It must be tailored to your actual business platform and what user data is collected.

- IAB Taxonomies [IAB Taxonomies](https://github.com/InteractiveAdvertisingBureau/Taxonomies/tree/main/Content%20Taxonomies)

# Crawler

- Crawl4AI is the #1 trending GitHub repository, actively maintained by a vibrant community. It delivers blazing-fast, AI-ready web crawling tailored for LLMs, AI agents, and data pipelines. Open source, flexible, and built for real-time performance, Crawl4AI empowers developers with unmatched speed, precision, and deployment ease. [Crawl4AI](https://github.com/unclecode/crawl4ai)

# LLM security

- The Python Risk Identification Tool for generative AI [PyRIT](https://github.com/Azure/PyRIT)

- TextAttack is a Python framework for adversarial attacks, data augmentation, and model training in NLP.[TextAttack](https://github.com/QData/TextAttack/tree/master)

- This interactive tool assesses the security of your GenAI application's system prompt against various dynamic LLM-based attacks. [ps-fuzz](https://github.com/prompt-security/ps-fuzz)

- Contains code useful for jailbreaking LLMs.[bon-jailbreaking](https://github.com/jplhughes/bon-jailbreaking)

# LLM develop

- DSPy is the framework for programming—rather than prompting—language models. It allows you to iterate fast on building modular AI systems and offers algorithms for optimizing their prompts and weights, whether you're building simple classifiers, sophisticated RAG pipelines, or Agent loops. [dspy](https://github.com/stanfordnlp/dspy),

- TextGrad is a powerful framework building automatic ``differentiation'' via text. TextGrad implements backpropagation through text feedback provided by LLMs, strongly building on the gradient metaphor. [textgrad](https://github.com/zou-group/textgrad)

- [MarkItDown is a lightweight Python utility for converting various files to Markdown for use with LLMs and related text analysis pipelines.](https://github.com/microsoft/markitdown)

- [A curated list of awesome projects, resources, and tools for building stateful, multi-actor applications with LangGraph.](https://github.com/von-development/awesome-LangGraph)

# Trading bots

- This is a proof of concept for an AI-powered hedge fund. The goal of this project is to explore the use of AI to make trading decisions. This project is for educational purposes only and is not intended for real trading or investment.[ai-hedge-fund](https://github.com/virattt/ai-hedge-fund)

- Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning. [Freqtrade](https://github.com/freqtrade/freqtrade)

- This Python framework is designed for developing algorithmic trading strategies, with a focus on strategies that use machine learning. With PyBroker, you can easily create and fine-tune trading rules, build powerful models, and gain valuable insights into your strategy’s performance.[pybroker](https://github.com/edtechre/pybroker)

- QSTrader is an open-source event-driven backtesting platform for use in the equities markets, currently in an alpha state. [qstrader](https://github.com/quantstart/qstrader)

- Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL. [qlib](https://github.com/microsoft/qlib)

- [AI4Finance-Foundation](https://github.com/AI4Finance-Foundation)

- Lightning Fast AI Chatbot that Responds With Live Interactive Stock Charts, Financials, News, Screeners, and More. Powered by Llama3-70b on Groq, Vercel AI SDK, and TradingView Widgets. [stockbot-on-groq](https://github.com/bklieger-groq/stockbot-on-groq)

# LLM & ML used

- Name entity extraction. GLiNER is a Named Entity Recognition (NER) model capable of identifying any entity type using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to traditional NER models, which are limited to predefined entities, and Large Language Models (LLMs) that, despite their flexibility, are costly and large for resource-constrained scenarios. [gliner](https://github.com/urchade/GLiNER)

- Recommenders objective is to assist researchers, developers and enthusiasts in prototyping, experimenting with and bringing to production a range of classic and state-of-the-art recommendation systems. [recommenders](https://github.com/recommenders-team/recommenders/tree/main)

- TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting. [TimeFM](https://github.com/google-research/timesfm)

- Chronos is a family of pretrained time series forecasting models based on language model architectures. [chronos-forecasting](https://github.com/amazon-science/chronos-forecasting)

- Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning. There is a specific focus on reinforcement learning with several contextual bandit algorithms implemented and the online nature lending to the problem well. [vowpal_wabbit](https://github.com/VowpalWabbit/vowpal_wabbit)

- A Forecaster object in the skforecast library is a comprehensive container that provides essential functionality and methods for training a forecasting model and generating predictions for future points in time. [skforecast](https://github.com/skforecast/skforecast)

- SAMformer is a lightweight transformer architecture designed for time series forecasting. It uniquely integrates Sharpness-Aware Minimization (SAM) with a Channel-Wise Attention mechanism. [samformer](https://github.com/romilbert/samformer)

- StockLlama is a time series forecasting model based on Llama, enhanced with custom embeddings for improved accuracy. [StockLlama](https://github.com/LegallyCoder/StockLlama)

- SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of any machine learning model. [Shab] (https://github.com/shap/shap)

- [jina-reranker-m0 is our new multilingual multimodal reranker model for ranking visual documents](https://huggingface.co/jinaai/jina-reranker-m0)

# Embodied AI

- Genesis is a physics platform designed for general-purpose Robotics/Embodied AI/Physical AI applications. It is simultaneously multiple things. [Genesis-Embodied-AI](https://github.com/Genesis-Embodied-AI/Genesis)

# Tool collection

- SQL in Python Develop. DuckDB is a high-performance analytical database system. It is designed to be fast, reliable, portable, and easy to use. DuckDB provides a rich SQL dialect, with support far beyond basic SQL. DuckDB supports arbitrary and nested correlated subqueries, window functions, collations, complex types (arrays, structs, maps). [DuckDB](https://github.com/duckdb/duckdb)

# Reinforcement learning (RL)

- Stable Baselines3 (SB3) is a set of reliable implementations of reinforcement learning algorithms in PyTorch.[Stable Baselines3 (SB3)](https://github.com/DLR-RM/stable-baselines3)

- DI-engine is a generalized decision intelligence engine for PyTorch and JAX. It provides python-first and asynchronous-native task and middleware abstractions, and modularly integrates several of the most important decision-making concepts: Env, Policy and Model. Based on the above mechanisms, DI-engine supports various deep reinforcement learning algorithms with superior performance, high efficiency, well-organized documentation and unittest. [DI-engine](https://github.com/opendilab/DI-engine)

- AnyTrading is a collection of OpenAI Gym environments for reinforcement learning-based trading algorithms. [AnyTrading](https://github.com/AminHP/gym-anytrading)

- MtSim is a simulator for the MetaTrader 5 trading platform alongside an OpenAI Gym environment for reinforcement learning-based trading algorithms. MetaTrader 5 is a multi-asset platform that allows trading Forex, Stocks, Crypto, and Futures. It is one of the most popular trading platforms and supports numerous useful features, such as opening demo accounts on various brokers. [gym-mtsim](https://github.com/AminHP/gym-mtsim)

- [FinMem-LLM-StockTrading](https://github.com/pipiku915/FinMem-LLM-StockTrading)

- A curated list of awesome machine learning frameworks, libraries and software (by language) [awesome-machine-learning](https://github.com/josephmisiti/awesome-machine-learning)

- [RL](https://gymnasium.farama.org/)

- [RL](https://github.com/opendilab/DI-engine/tree/main)

# Graph

- igraph is a library for creating and manipulating graphs. It is intended to be as powerful (ie. fast) as possible to enable the analysis of large graphs [igraph](https://github.com/igraph/python-igraph)

# Audio/Video Demo

- [FastRTC, build speech/video interactive demo](https://fastrtc.org/)

# Robotic

- [Boston dynamics SPOT SDK](https://github.com/boston-dynamics/spot-sdk?tab=readme-ov-file)

# AI security

- [cleverhans: Python library to benchmark machine learning systems' vulnerability to adversarial examples.](https://github.com/cleverhans-lab/cleverhans)

- [A curation of awesome tools, documents and projects about LLM Security](https://github.com/corca-ai/awesome-llm-security)

- [ACL 2024 Tutorial: Vulnerabilities of Large Language Models to Adversarial Attacks](https://llm-vulnerability.github.io/)

# Miscs

- [algorithmic_trading_book](https://github.com/zslucky/algorithmic_trading_book)

- [Trading-Strategies](https://github.com/chenenen13/Trading-Strategies)

- [151 Trading Strategies](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3247865)

- [Python For Finance Cookbook - Code Repository](https://github.com/PacktPublishing/Python-for-Finance-Cookbook)

- [mplementation of code snippets and exercises from Machine Learning for Asset Managers (Elements in Quantitative Finance) written by Prof. Marcos López de Prado.](https://github.com/emoen/Machine-Learning-for-Asset-Managers)

- [Computational-Finance-Course](https://github.com/LechGrzelak/Computational-Finance-Course)

- [Self-taught training materials in quantitative finance](https://github.com/PythonCharmers/QuantFinance)

[This course is designed to be an introduction to numerical computing and data visualization in Python](https://github.com/jpmorganchase/python-training)

- [quantecon.org/lectures/](https://quantecon.org/lectures/)

- [Quantitative-Notebooks](https://github.com/LongOnly/Quantitative-Notebooks)