Skip to main content

A pinescript-like financial data analysis and trading package

Project description

pinetwig 0.2.0

PineTwig is a pinescript-like financial data analysis and trading package.

Requirements

  • Python 3.7 or above on Windows, Linux or macOS

Installation

pip install pinetwig

Examples

Create main.py file with one of the following examples:

Scraping data from Binance.

import pinetwig as pt

df = pt.getDataFromBinance(ticker="BTCUSDT", interval="1h", start="2 day ago UTC", end="now")
print(df)

Scraping data from TradingView.

import pinetwig as pt

df = pt.getDataFromTradingView(symbol="NASDAQ:AAPL", interval="5m", length=5000)
print(df)

List available indicators.

import pinetwig as pt

for i in pt.indicators.all:
    print(i)

Generating a ray and visualizing.

import pinetwig as pt

x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1]
ray = pt.ray(x, (0, 0), (2, 1))

pt.visualize(lines={"Values": {"x": x, "y": y}, "Ray": {"x": x, "y": ray}})

Visualizing a financial dataframe.

import pinetwig as pt

df = pt.getDataFromBinance(ticker="BTCUSDT", interval="1h", start="2 day ago UTC", end="now")

df["SMA12"] = pt.sma(df["Close"], 12)

x, y = list(range(len(df))), df["Close"].tolist()
df["Ray1"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*1.02))
df["Ray2"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*0.98))

chart = pt.FancyChart(df, theme="light")
chart.show()

Learn more

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

pinetwig-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file pinetwig-0.2.0.tar.gz.

File metadata

  • Download URL: pinetwig-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pinetwig-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3a6e070a21a112a46fa8c2a1f61055ee787005d6561f294a146f81888d24347a
MD5 fd6c792ce5d06722471eb6f8fb7472a6
BLAKE2b-256 1841ba50ec66fff7a20f11fec03926dbe854d2af9fa3d094bb6fb6b5288f9073

See more details on using hashes here.

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