Skip to main content

No project description provided

Project description

Finalytics

pypi License Homepage Documentation Status PePy CodeFactor

This is a python binding for Finalytics Rust Library designed for retrieving financial data and performing security analysis and portfolio optimization.

Installation

pip install finalytics

Documentation

View Library documentation on readthedocs here

Symbol Search

from finalytics import get_symbols

print(get_symbols(query="Apple", asset_class="Equity"))
print(get_symbols(query="Bitcoin", asset_class="Crypto"))
print(get_symbols(query="S&P 500", asset_class="Index"))
print(get_symbols(query="EURUSD", asset_class="Currency"))
print(get_symbols(query="SPY", asset_class="ETF"))

Security Analysis

Binder

from finalytics import Ticker

ticker = Ticker(symbol="AAPL")
print(ticker.get_current_price())
print(ticker.get_summary_stats())
print(ticker.get_price_history(start="2023-01-01", end="2023-10-31", interval="1d"))
print(ticker.get_options_chain())
print(ticker.get_news(start="2023-11-01", end="2023-11-10", compute_sentiment=False))
print(ticker.get_income_statement())
print(ticker.get_balance_sheet())
print(ticker.get_cashflow_statement())
print(ticker.get_financial_ratios())
print(ticker.compute_performance_stats(start="2023-01-01", end="2023-10-31", interval="1d", benchmark="^GSPC", 
                                       confidence_level=0.95, risk_free_rate=0.02))
ticker.display_performance_chart(start="2023-01-01", end="2023-10-31", interval="1d", benchmark="^GSPC", 
                                 confidence_level=0.95, risk_free_rate=0.02, display_format="notebook")
ticker.display_candlestick_chart(start="2023-01-01", end="2023-10-31", interval="1d", display_format="html")
ticker.display_options_chart(risk_free_rate=0.02, chart_type="surface", display_format="png")

Portfolio Optimization

Binder

from finalytics import Portfolio

portfolio = Portfolio(ticker_symbols=["AAPL", "GOOG", "MSFT", "BTC-USD"], 
                      benchmark="^GSPC", start="2020-01-01", end="2022-01-01", interval="1d", 
                      confidence_level=0.95, risk_free_rate=0.02, max_iterations=1000, 
                      objective_function="max_sharpe")
print(portfolio.get_optimization_results())
portfolio.display_portfolio_charts("html")

DeFi Liquidity Pools

from finalytics import DefiPools

defi_pools = DefiPools()
print(f"Total Value Locked: ${defi_pools.total_value_locked:,.0f}")
defi_pools.display_top_protocols_by_tvl(pool_symbol="USDC-USDT", num_protocols=20, display_format="html")
defi_pools.display_top_protocols_by_apy(pool_symbol="USDC-USDT", num_protocols=20, display_format="html")
defi_pools.display_pool_tvl_history(pool_symbol="USDC-USDT", protocol="uniswap-v3", chain="ethereum", display_format="html")
defi_pools.display_pool_apy_history(pool_symbol="USDC-USDT", protocol="uniswap-v3", chain="ethereum", display_format="html")

DeFi User Balances

from finalytics import DefiBalances
from finalytics import get_supported_protocols

supported_protocols = get_supported_protocols()
print(supported_protocols)

# This function requires node.js and pnpm to be installed on the system
# for macos: brew install node && npm install -g pnpm
# for ubuntu: sudo apt install nodejs && npm install -g pnpm
# for windows: https://nodejs.org/en/download/ && npm install -g pnpm

defi_balances = DefiBalances(protocols=["wallet", "eigenlayer", "blast", "ether.fi"],
                             chains=["ethereum", "arbitrum"],
                             address="0x7ac34681f6aaeb691e150c43ee494177c0e2c183",
                             display_format="html")
print(defi_balances.balances)

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

finalytics-0.2.4.tar.gz (59.1 kB view hashes)

Uploaded Source

Built Distributions

finalytics-0.2.4-cp312-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

finalytics-0.2.4-cp312-cp312-macosx_11_0_arm64.whl (35.8 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

finalytics-0.2.4-cp312-cp312-macosx_10_12_x86_64.whl (36.5 MB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

finalytics-0.2.4-cp311-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

finalytics-0.2.4-cp311-cp311-macosx_11_0_arm64.whl (35.8 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

finalytics-0.2.4-cp311-cp311-macosx_10_12_x86_64.whl (36.5 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

finalytics-0.2.4-cp310-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

finalytics-0.2.4-cp310-cp310-manylinux_2_35_x86_64.whl (45.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

finalytics-0.2.4-cp310-cp310-macosx_11_0_arm64.whl (35.8 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

finalytics-0.2.4-cp310-cp310-macosx_10_12_x86_64.whl (36.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

finalytics-0.2.4-cp39-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

finalytics-0.2.4-cp38-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

finalytics-0.2.4-cp37-none-win_amd64.whl (33.2 MB view hashes)

Uploaded CPython 3.7 Windows x86-64

Supported by

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